Alexander Mills Alexander Mills - 3 years ago 314
Javascript Question

relative path using typeRoots vs. baseUrl in TypeScript tsconfig.json file

This tsconfig.json configurations works as expected:

"baseUrl": ".",
"typeRoots": [
"./node_modules/@types",
"./node_modules/suman-types/dts"
],


but this one does not

"baseUrl": ".",
"typeRoots": [
"node_modules/@types",
"node_modules/suman-types/dts"
],


does anybody know why? I am trying to figure out if baseUrl has something to do with it.

Answer Source

I am trying to figure out if baseUrl has something to do with it.

No.

You need relative path starters in typeRoots if the path is not simple (i.e. includes some /)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download