TS1228
A type predicate is only allowed in return type position for functions and methods.
Broken Code ❌
function hasErrorCode(error: any) error is {code: string} {
return typeof (error && error.code) === 'string'
}Fixed Code ✔️
You have to separate the argument list from the return type definition by a ::
function hasErrorCode(error: any): error is { code: string } {
return typeof (error && error.code) === 'string';
}