This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
'this' banned term conflicts with Typescript's function this-types #261
Closed
Description
I'm finding that the function level this-type introduced by Microsoft/TypeScript #6739 is triggering the "noReservedKeywords" rule.
Using this example from the PR
interface I {
n: number;
method: (m: number) => number;
}
function futureMethod(this: I, m: number) {
return this.n + m;
}
let o: I = { n: 12, method: futureMethod };
The this-type feature of TS declares the futureMethod has having one parameter (m
) and that the
"this
" object within its scope implements interface I
.
But instead it has a tslint error:
[tslint] Forbidden reference to reserved keyword: this
(parameter) this: I
It feels like a special exception is needed for the this keyword, to allow for function this-types.
Metadata
Metadata
Assignees
Labels
No labels