You just need an extra set of parenthesis.
class TestClass {
name: string | (() => string);
}
The compiler is trying to do (string | ()) => string
if you don’t use them, because of precedence.
You just need an extra set of parenthesis.
class TestClass {
name: string | (() => string);
}
The compiler is trying to do (string | ()) => string
if you don’t use them, because of precedence.