You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(typescript): don't assume : after '=> ()' is part of '? :'
In the following two TypeScript examples, the treatment of ':' after
'=> (somevar)' differs:
true ? () => (somevar) : thing => { };
() => (somevar) : thing => { };
When parsing an arrow function body, quick-lint-js assumes that a ':' is
*not* a type annotation. This works well for the first case, but causes
quick-lint-js to misunderstand the second case.
Teach arrow function body parsing to behave differently depending on
whether we're inside the truthy branch of a conditional expression.
Parsing of the truthy branch (parse-expression.cpp line 1801) sets
.colon_type_annotation = allow_type_annotations::never, so pass that
along; whereas calls which should treat the ':' as an type annotation
set .colon_type_annotation = allow_type_annotations::typescript_only
(default), so pass that along too.
0 commit comments