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
Looks like this is same problem as with class fields proposal tc39/proposal-class-fields#7.
ASI won't insert ; if next line starts with [ and therefore your code is parsed as indexed access id: number = 0[key which leads to an error, because : won't be part of valid expression for indexed access.
ASI hazard is hazardous. We don't want to do a complex lookahead here on [ to figure out if it's an index signature or element access expression (I'm not even 100% convinced it's never ambiguous).
Line-leading [ should always have an associated ; in desemicoloned style
TypeScript Version: 3.5.3
Code
Expected behavior:
Should work like
Actual behavior:
error TS1005: ']' expected.
Playground Link:
https://www.typescriptlang.org/play/#code/KYDwDg9gTgLgBAYwDYEMDOa4FU3CnAbwCg44BLAEwC44A7AVwFsAjPOAXjgAYiS4BtANbAAnjTQwoZWgHMAujRS0RRAL5A
CC prettier/prettier#6727 , prettier/prettier#6728
The text was updated successfully, but these errors were encountered: