-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Can not find local declaration file for scoped packages #23999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
the file name is irrelevant. in both files you are using in the file the problem is you are not naming the module correctly, i.e. your module should look like: declare module '@feathersjs/express' {
function init(options: string): any;
namespace init {
export let service: (options: string) => any;
}
export = init;
} |
@mhegazy I believe that the file name is irrelevant, but then the error message is wrong, because I am naming the module exactly as specified by the error message (see above: And that did work (I thought I had tried using the name early on w/o success, but I probably had other issues at that time). Thanks, so I think this bug probably needs to be renamed to specify that the error message needs to be corrected. |
A PR to update the error message would be appreciated. |
I just encountered this issue. Took me quite awhile to figure it out. Here's the Stackoverflow question I ended up creating because of it, and solution. |
This should be an easy PR. I'm working on it. |
unmangled package name where appropriate. Add a test case for an untyped sub-module of a scoped package with typings. The other diagnostic message is covered by existing tests; I guess no one looked at the baselines closely enough. Fixes microsoft#23999.
I am using the
noImplicitAny
switch, but I'm not sure whether that matters other than not showing that the declaration file is not found as quickly. However I should be able to use thenoImplicitAny
switch by creating the required declaration file locally.My testing seems to show that a local declaration file for a non-scoped package is found, but that one for a scoped package (@<scope>/name) is not.
The test sample I've attached uses the
@feathersjs/express
scoped package to demonstrate the issue.Note that the
feathersjs__express.d.ts
file below does contain thedeclare module 'feathersjs__express';
as specified in the error message.Also note that the contents of
feathersjs__express.d.ts
are basically identical to the contents offeathers-mongoose.d.ts
which is correctly found (and when remove produces a similar TS7016 error.TypeScript Version: 2.9.0-dev.20180506
Search Terms:
TS7016: Could not find a declaration file for module
Code
index.ts
feathers-mongoose.d.ts
feathersjs__express.d.ts
Zip file containing the sources (as in the tree above)
ts_bug_src.zip
Expected behavior:
No errors
Actual behavior:
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: