#Typescript and `import.meta.glob`

1 messages · Page 1 of 1 (latest)

worn dawn
#

Hey everybody, I'm battling with typescript to look for files referenced with import.meta.glob. Is there a recommended way of doing this? For context, the app I'm building references another module in my monorepo that uses import.meta.glob. From my app, executing tsc --noEmit doesn't show typescript errors for the files referenced with the glob syntax. I feel like typescript cannot support this as it's Vite specific (not sure). If so, is there a plugin of some sort to fix this?

analog olive
#

I think you'll need to reference the glob imports in the tsconfig.json file's include array, explicitly telling typescript that they're part of your project. I'm a little surprised your typescript config doesn't already include them. What are you currently including/excluding in the config (if anything)? Are they outside your typescript root?

worn dawn
#

The application config includes the application only files and extends the base config which has path aliases to entry points of other modules. But you are right tsconfig.json doesn't explicitly include those files unless explicitly imported somewhere.