TypeScript Version: nightly (2.3.0-dev.20170331)
Code
import { Foo } from "bad-import";
export interface I<T> {
x: Foo<T>;
}
Expected behavior:
Only an error at the import.
Actual behavior:
src/a.ts(3,20): error TS6133: 'T' is declared but never used.
Another case:
import { foo } from "badImport";
type T = number;
foo<T>();
Another case:
import { A, B } from "unknown";
export class C extends A<B> {}
B is marked unused.
Hello, it seems to be fixed on typescript@next. However since this issue can affect users of Typescript v2.2.2 and v2.3 and tslint, would it be possible to ship it in [email protected] instead of 2.4?
I have a similar problem: ERROR in ng:///C:/Projekte/groupify/src/app/export/export.component.html (2,1): '$event' is declared but never used.
But the code inside my export.component.html looks like: <button (click)="export()">Export</button>
And yes, the error go away after I set noUnusedParameters to false.
@Chris2011 I can't really help you without a reproducible code sample. Can you find-all-references on $event to see if you have any uses?
I did a full text search. I will have a look later to see where it comes from. I thought it could be the same error here, thats why I jumped in.
Not sure if this helps anyone, but I solved this "bug" by removing an incorrect spread props {...this.props} in a parent react component.
I'm getting a lot of these in a piece of code that was working fine a couple of days ago. They seem a bit random. One that caught my eye (because it happens again and again in different files) says:
[16:12:52] tslint: src/pages/detail.ts, line: 4
All imports are unused.
L4: import { Http } from "@angular/http";
And the relevant code is:
import { Http } from "@angular/http";
export class detail {
constructor(private http: Http) {}
pushData(url, payload) {
this.http.post(url, payload).map(res => res.json()).subscribe(data => console.log(data));
}
}
Also, this one:
'ErrorHandler' is declared but never used.
import { ErrorHandler } from "@angular/core";
export class MyErrorHandler implements ErrorHandler {
}
I don't know why TSLint started picking these as errors. But it sure started today.
@juanpablodelatorre Can you try that out on typescript@next?
@andy-ms Yep, that worked. Thanks!
Most helpful comment
Hello, it seems to be fixed on typescript@next. However since this issue can affect users of Typescript v2.2.2 and v2.3 and tslint, would it be possible to ship it in [email protected] instead of 2.4?