Struggling with implementing type guards in Typescript 3.2.2:
interface Bird {
fly(): boolean;
}
interface Fish {
swim(): boolean;
}
function checkIfSwim(x: Fish | Bird) {
if ((<&Fish>x).swim) {
return true
}
}
Encountering the error message
Error:(50, 11) TS2693: 'Fish' only refers to a type, but is being used as a value here.
in WebStorm and SyntaxError: /Users/sea-kent/git/docket-management/webapp/src/App.tsx: Unexpected token (51:8)
from yarn
. Any suggestions on how to resolve this syntax issue?