Under TypeScript 2.4.0, the following code returns a not-quite-helpful error message:
function Coalesce<T>(t: T, default: T) {
return t != null ? t : default;
}
The errors are
script.ts(1,28): error TS1003: Identifier expected.
script.ts(2,21): error TS1109: Expression expected.
script.ts(2,29): error TS1128: Declaration or statement expected.
Obviously the actual error here is the use of the reserved keyword default as a parameter name.
Is there a valid usage for default in the parameter list or can this be caught and turned into a more helpful message such as Use of reserved keyword "default" as parameter name. or similar?
Under TypeScript 2.4.0, the following code returns a not-quite-helpful error message:
The errors are
Obviously the actual error here is the use of the reserved keyword
defaultas a parameter name.Is there a valid usage for
defaultin the parameter list or can this be caught and turned into a more helpful message such asUse of reserved keyword "default" as parameter name.or similar?