Answer the question
In order to leave comments, you need to log in
How to do ES6 import from default directory in TypeScript?
I think you understand what I mean, but I'll explain. For example, I have a UI directory and at its root there is an index.js file that contains exports from all components in this directory. And then I can do the import like this.
Because ES6 by default looks for index.js in the folder if we try to import something from it.
How can this be done with TypeScript? It turns out two problems - the index.js file is searched and not index.ts, but even if I make these index files in js, TypeScript will still highlight errors, because it does not understand such paths.
What do you think about this?
import * as components from 'components/UI';
Answer the question
In order to leave comments, you need to log in
all the same, TypeScript will highlight errors, because it does not understand such paths
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question