-
Notifications
You must be signed in to change notification settings - Fork 12.8k
noimplicitany and module without typings #13348
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
why? |
Because users can benefit from By the way, would this consider explicit and remedy the situation? import * as Something from 'some-module-without-typings'
declare module 'some-module-without-typings/*' |
all you need is to declare the module. so something like declare module 'some-module-without-typings/*' {
var _a: any;
export = _a;
} |
Is an even more general solution having this?
|
All you need is |
For this to be seamless we really need a solution for #12971 |
Hello there! I have this module, called This line:
Gives me:
How do I make it explicitly If I try to use declarations to handle this, then I'm getting this error:
@mhegazy could you elaborate please? Thanks! |
@mhegazy I get Or when I try to be specific in my case I get: I would love to have an import as an explicit |
because otherwise this simple use case is a pain in the neck? |
This means you are putting the |
@mhegazy Is there still no way to make the
Currently I do the following in a TypeScript module with import _m = require("../vendor/grove-js");
declare namespace grove {
//...
}
export default _m; If I enable This seems like a bug to me, since the error is not that the type of the import is It's simple enough for me to leave |
why not create a |
This results in |
Can you share a repro? |
also, it seems onerous to require the creation (and continual maintenance) of a .d.ts for every imported .js library just to enable the project-wide noImplicitAny flag. surely if you're importing a .js file doesn't that import itself explicitly declare that everything imported is of type |
First, Second, you do not need a file unless you want to go into details of the module |
I prepared a tiny repo, which
when setting UPDATE: updated link, had to ensure that the d.ts is really used by tsc |
@mhegazy i think the repo above reproduces the behavior described above |
@mhegazy you can check out https://github.com/LaboratoryForPlayfulComputation/pxexec-runtime as well. We're trying to type the grove-pi javascript library. As is, I have lpc-grove-translation.ts and a module in lpc-grove-js/index.js. Currently, this repository is in a stop-gap state where it works but doesn't actually typecheck (seems like the When I want to typecheck the code, I rename lpc-grove-translation.ts to lpc-grove-js.d.ts and comment out the module declarations in the file. This gets me typechecking but the resulting error is that Again, if I were importing this library using |
tsc 2.1.4
In 2.1 tsc support import module as
any
if they are installed through npm but no typings is found.With
--noImplicitAny
, this is prohibited, meaning user need to get all typings for all modules again.Should we consider this as an exception case for
--noImplicitAny
?The text was updated successfully, but these errors were encountered: