I have this generic class and I want to use that generic parameters:
export class OperationResult<TResult>
{
public success: boolean;
public message: string;
public result: TResult;
constructor(success: boolean, message: string, result: TResult) {
this.success = success;
this.message = message;
this.result = result;
}
public static BuildSuccessResult(message: string, result: TResult): OperationResult<TResult> {
return new OperationResult<TResult>(true, message, result);
}
}
but it show me this error for the BuildSuccessResult function:
Static members cannot reference class type parameters.ts
How can I return a generic value on a static function?