I am using an npm package (say foo) and during development I would like to associate this package with a local (committed along with project files) typescript definitions file. I explicitly do not intend to publish the definitions file as an npm package because as of now it is incomplete and covers only the parts of the library I actually use.
So far I have tried the following:
Adding the following to tsconfig.json
"typeRoots": [
"./node_modules/@types",
"./src/types"
],
And added definition file in ./src/types/foo/index.d.ts
. However neither VSCode nor the typescript webpack-loader are able to associate imports from 'foo' with the exports in the definition file.
What is the right approach for handling this?
That's pretty much what I did here
created "my Type" for an existing lib following the instructions from @types
and publish it to "my" Github. instead of publishing to @types
finally
it's going to end up in node_modules/@types/chosen-name
exactly where tsc expect it to be
I didn't try but I don't see a reason why it shouldn't work from other sources