I'm attempting to define a property that can be either a lambda function or a string in TypeScript.
class TestClass {
name: string | () => string;
}
You can find a sample of non-working code on the TS playground here.
However, when compiling, the TS compiler throws an error saying:
"[ts] Member 'string' implicitly has an 'any' type."
Could it be that the type is declared incorrectly? Or are there any workarounds for this issue?