You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: TS7016 Could not find a declaration file for module #14379
try.ts(1,19): error TS7016: Could not find a declaration file for module 'test'. '~/tsc-test/node_modules/test/lib/index.js' implicitly has an 'any' type.
It works fine with [email protected], or specified types field in package.json:
But I think this is a bug, since the documentation said:
Also note that if your main declaration file is named index.d.ts and lives at the root of the package (next to index.js) you do not need to mark the "types" property, though it is advisable to do so.
Reacted by David Gonzalez, Laurentiu Ciobanu, Electrisim, Wildan Zulfikar, pavelpashkovsky, Dhruvdutt Jadhav, Marcel Heeremans, Amit Dahan, Tim Wu, Deo Gochava and 7 more
Reacted by David Sveningsson, gonugunta, Isaac Lyman, Bryson Thill, Fabian Lauer, Artem Sapegin, Victor Widell, 崔鹏飞 Cui Pengfei, Praneet Rohida, Alexander and 28 more
Reacted by Laurentiu Ciobanu and Kerwyn
Reacted by Laurentiu Ciobanu
Reacted by Laurentiu Ciobanu, Jan Nikolaus Wirth and Dragos Cojocaru
It was not about how to hide the error message but for what strategy does TS use to find declaration files.
I used to think that the "root" means "main" field (./lib/index.js in this case) in package.json, so that I just have to place ./lib/index.d.ts next to ./lib/index.js.
The fact is that the "root" means where package.json stands.
I used to think that the "root" means "main" field (./lib/index.js in this case) in package.json, so that I just have to place ./lib/index.d.ts next to ./lib/index.js.
Activity
mhegazy commentedon Mar 2, 2017
The behavior matches the documentation. the
index.d.tsis not at the root, it is underlib.The request to look up
<value of package.json::main>.d.tsis tracked for #9854dhruvdutt commentedon Jun 2, 2017
Edit your tsconfig.json
"noImplicitAny": falseikatyang commentedon Jun 2, 2017
It was not about how to hide the error message but for what strategy does TS use to find declaration files.
I used to think that the "root" means "main" field (
./lib/index.jsin this case) inpackage.json, so that I just have to place./lib/index.d.tsnext to./lib/index.js.The fact is that the "root" means where
package.jsonstands.dhruvdutt commentedon Jun 2, 2017
Ah! Alrighty. 👍
TrungRueta commentedon Dec 24, 2017
I know this question is old. But i got same issue and found way to resolve:
from tsconfig.json of module you made. add :
with "lib" is folder "outDir" value. Assume you put .d.ts files same place with .js file. and it will be good!
bennycode commentedon Feb 19, 2018
I agree that the documentation is quite misleading. It should say "next to
package.json" instead of "next toindex.js".