typescript - Where should I place custom .d.ts files? -


i'm trying provide typings package not have them:

error ts7016: not find declaration file module 'inputmask-core'. './node_modules/inputmask-core/lib/index.js' implicitly has 'any' type. try `npm install @types/inputmask-core` if exists or add new declaration (.d.ts) file containing `declare module 'inputmask-core';` 

i'm using ts-loader in webpack typescript 2.4.2, , have following type roots set in tsconfig.json:

"typeroots": [   "./node_modules/@types",   "./src/client/types" ] 

i tried mimic package structure in node_modules/@types:

src/client/types |--inputmask-core   |--index.d.ts 

with following in index.d.ts:

declare class inputmask {} export default inputmask; 

but error still there. doing wrong? should place custom .d.ts files?

and difference between node_modules/@types , other type root? why typescript treat them differently?

possible solution: place following in index.d.ts, , compile:

declare module "inputmask-core" {     declare class inputmask {}     export default inputmask; } 

i still don't understand special handling node_modules/@types gets, though.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -