-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Errors with noUnusedLocals #65
Comments
yeah, I have no idea how to fix the 2nd one. However, I fixed the first one. I think you can use "skipLibCheck": true to suppress this. |
Thank you for advice! But... I think what you are saying is wrong (sorry). Second If setting skipLibCheck=true, the compiler skips type checking of *.d.ts files.
For this argument's information, I paste our tsconfig. {
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es6",
"dom"
],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "../dist/out-tsc",
"skipLibCheck": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "es5"
}
} |
It has d.ts. Check your node_module folder. I think you might have 2 tsConfigs one for build one for IDE. I believe skipLibCheck is the answer. Maybe you can check with Stackoverflower on this. |
Hello all, I wanted to use the ngx-clipboard library, but faced also this TSLint error. After trying - without luck - to exclude the library from TSLint configuration, I've tried to simply removed the two unused declarations. Unlike @hiro-hori, I didn't encounter any issue afterwards, and the library works great. Some information that may help:
|
For information, I changed my import from: import { ClipboardModule } from 'ngx-clipboard'; to: import { ClipboardModule } from 'ngx-clipboard/dist'; and the error is now gone (as I rely on JS and not on TS files now) |
@maxisam I've used the latest one, which means 8.0.4. |
The same here!
I'm using webpack and the output is:
|
@maxisam, with the latest version (8.1.1) I got only one error:
This can be easily solved by removing |
@sandro-csimas as I mentioned before, I actually don't know how to fix it. I think it might be typescript's issue. I can't remove that import and build successfully. |
@maxisam ,
|
I know. You can try to build it yourself. |
@maxisam , OK, I will try. |
https://travis-ci.org/maxisam/ngx-clipboard/builds/259478307 This was the build record for the commit trying to remove that import. But maybe typescript fix the bug now if so, feel free to submit a PR. |
Build passes with noUnusedLocals compiler option. Fix involved explicit casting with InjectionToken<Document>. fix maxisam#65
Build passes with noUnusedLocals compiler option. Fix involved explicit casting with InjectionToken<Document>. fix maxisam#65
In my project, we use stricter TypeScript option i.e.
noUnusedLocals
I saw compilation error from ngx-clipboard.
It seems easy to fix, so I tried to fix it.
But it was difficult.
After I deleted importing InjectToken from src/clipboard.service.ts, I met a new error.
That error seems microsoft/TypeScript#5711
I really want to solve this problem, does anyone have good ideas?
The text was updated successfully, but these errors were encountered: