-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TypeScript 2.5 "unused type parameter" breaks existing code #18370
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
You can turn off no unused variables, or name them with a leading underscore ( |
I tried adding a leading underscore: type Foo<_s> = object; Still causes the same error ( Switching off |
I'm interested in what you use phantom type parameters for, as they are not enforced by the compiler. If a type parameter is not referenced in the type's body, it's not considered during checking. |
You are right, it turns out that the code in the style above was actually from some older experiments with phantom types, that we don't actually use. The way we actually use phantom types with correct type checking is by adding a dummy field: export class Q<s> {
protected dummy: [Q<s>, s];
} |
Logged #18420 |
TypeScript Version: 2.5.2
Code
This worked fine in TypeScript 2.4, but causes the following error in 2.5.2:
This change in TypeScript is breaking massive amounts of code that use phantom type parameters. And there doesn't seem to be any workaround.
The text was updated successfully, but these errors were encountered: