When working with this code, I encounter a syntax error at m1 and m2. The error message states:
Type 'T' is not assignable to Type 'boolean'
or Type 'T' is not assignable to Type 'string'
interface customMethod {
<T>(param: T): customizedObject<T>;
}
class customizedObject<T> {
constructor(private value: T) {
}
}
var m1: customMethod = function (param : boolean) {
return new customizedObject(param);
}
var m2: customMethod = function (param: string) {
return new customizedObject(param);
}
Is there a solution for this issue?