TypeScript Version: 3.3.1
Search Terms:
Type parameter defaults can only reference previously declared type parameters.
Code
interface INamed {
name: string;
}
class Person<T extends INamed = T> {
// ...
}
Intended use
I wanted to use T as shorthand for INamed, because it may get very long and unless you make a separate type variable, there wasn't an easy and clean way to do it.
Previous behavior:
no error
Current behavior:
Error: Type parameter defaults can only reference previously declared type parameters.
Playground Link:
Demo
Related Issues:
Not really found anything...
TypeScript Version: 3.3.1
Search Terms:
Type parameter defaults can only reference previously declared type parameters.
Code
Intended use
I wanted to use
Tas shorthand forINamed, because it may get very long and unless you make a separate type variable, there wasn't an easy and clean way to do it.Previous behavior:
no error
Current behavior:
Error: Type parameter defaults can only reference previously declared type parameters.
Playground Link:
Demo
Related Issues:
Not really found anything...