'It's possible to generate a type based on files name?

I have a build process to generate svg files on react components in splits with @svgr/rollup-plugin. I need to generate types on typescript to reference each splits on code.

My doubt is, it's possible to get all name of dirs and generate a type with this names? I thought about using fs function of node to do this, but I don't have idea if this is the better solution or a new workaround.

Output build example

svg
|__svgOne
|  |__index.tsx
|__svgTwo
   |__index,tsx

Output of a type I need

interface ISvg {
    name: 'svgOne' | 'svgTwo'
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source