Show correct type of FileTypeIconMap #30982
LYH977
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As a Typescript Developer, currently there is no way to get all the supported extensions from "FileTypeIconMap.ts" because FileTypeIconMap is
{ [key: string]: { extensions?: string[] } }
. I cannot even get the key names because the key is set to general type of 'string'Also, I use
IFileTypeIconOptions
in my project but theextension
isstring
instead of supported extension literal like'accdb' | 'archive' | ...
When i try to use
keyof typeof FileTypeIconMap
, what i get is string | number instead of'accdb' | 'archive' | ...
Hence, in my project, in order to get all the supported extensions, I would need to copy the whole object of FileTypeIconMap and rewrite the type in my own project. Now FileTypeIconMap is correctly typed(but in my project).
Of course, this is not a good idea because I might miss out new supported extension in future.
Hope FluentUI team could update the type of FileTypeIconMap. Or maybe I can make a pull request.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions