typescript cannot find module which is defined in declaration file of npm linked local project -
i have module foo has declaration file builds/declarations.d.ts
, mentioned in package.json
:
'types' : './builds/declarations.d.ts'
the declaration file declares things so:
declare module '@my/module/lib/models/base' { export default class base { test():void; } }
then in module bar have module foo linked npm link
. , has files trying access classes foo:
import base "@my/module/lib/models/base";
however compiler give error:
cannot find module '@my/module/lib/models/base'.
note working before when temporarily had separate declaration files, when @my/module/lib/models/base.d.ts
existing file.
but have bundled declarations nicely 1 file, , mentioned in package.json compiler can't find module.
but does work when add declaration file tsconfig.json
so:
"files": [ "./src/index.ts", "./node_modules/@my/module/lib/models/declarations.d.ts" ]
but thought whole point of having declared in package.json picked automatically?
any hints should doing differently have compiler pick declarations automatically?
Comments
Post a Comment