Closed
Description
Environment
- TypeScript Version 2.0.0-dev.20160707
Step to Reproduce
compile the following code with tsc test.ts --noUnusedParameters
// test.ts
class A {
constructor(private a: number) {}
b(this: A): number {
return this.a;
}
}
function bar(this: Window): string {
return window.location.href;
}
Expected behavior
There is not any compile error.
Actual behavior
tsc
reports following compilation errors
test.ts(4,7): error TS6133: 'this' is declared but never used.
test.ts(10,14): error TS6133: 'this' is declared but never used.
// test.ts
class A {
constructor(private a: number) {}
b(this: A): number { // error TS6133: 'this' is declared but never used.
return this.a;
}
}
function bar(this: Window): string { // error TS6133: 'this' is declared but never used.
return window.location.href;
}