In my Typescript code, I have the following function: In C#, you can use default(T), but I'm not sure what the equivalent is in Typescript.
public Base {
...
}
public Get<T extends Base>(cultura: string): T[]
{
let res = null;
try
{
}
catch (ex)
{
throw ex;
}
return res;
}
When trying to return a null value, I encounter an error. Even assigning null to a variable and then returning that variable results in the same error.
The error message states: The 'null' type cannot be assigned to the type T[].
This is the error screenshot:
https://i.stack.imgur.com/L8PgN.png
How can I address this issue in TypeScript?