Why does typescript allows this code ?
class Test<T> {
private value: T;
public setValue(value: T): this {
this.value = value;
return this;
}
}
const test = new Test();
test.setValue(5);
As i instantiate the generic Test class without specifying the generic argument, the test variable is of type Test<{}>.
I thought that {} was an empty type, how can it be assigned a number ?
Thanks