-
I'm currently going through the documentation and I'm getting a little confused by the "Help! My Types Are Missing!" section as a Typescript newbie. Everything makes perfect sense until I hit the following section.
What should be the path's name if my module's name is "special-module"? From the above section, I'm led to believe that the path name should be "special-module-type" but that doesn't seem right... Also, shouldn't the path value begin with
Some clarification and explanation around this would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Remember that With that explanation out of the way, check out the official TypeScript documentation for paths: |
Beta Was this translation helpful? Give feedback.
-
@cspotcode thanks so much for the explanation. I don't think I explained my misunderstanding as well as I could so I will try again. In order to make sure This involved adding the following to my
Having the below project structure:
And having the following module declaration file:
These steps alone were enough to get However, the documentation contains an additional step (below) and I'm not sure what its purpose is for.
Just to make things easier for you, my first question is - what do you mean by "module definitions"? Do you just mean "module declaration files" like the one below?
|
Beta Was this translation helpful? Give feedback.
-
The example is super confusing, why would you rename Eventually ended with this, which worked for me.
|
Beta Was this translation helpful? Give feedback.
ts-node --files
does not change TypeScript's behavior at all, so everything you need to know about configuring TypeScript, including"baseUrl"
and"paths"
, you can learn from TypeScript's official documentation, the TypeScript Community Discord, or any other online resource.ts-node
without the--files
flag changes only one thing: it overrides yourtsconfig.json
"files"
and"include"
arrays. If you dots-node ./index.ts
, then it overrides your tsconfig like this:Remember that
"paths"
affects the way TypeScript resolves types, but it does not affect the wa…