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
ts-expect-error comment expects more than one error multiple lines
Code
// @ts-expect-error(({a: true}asconst).a===false);// <-- compiles (as expected via comment)(({a: true}asconst).a===false);// <-- compiles, expected an error though(({a: true}asconst).a===false);// error (as I would expect)(({a: true}asconst).a===false);// error (as I would expect)
Expected behavior:
I only expect // @ts-expect-error to ignore a single error at a time.
Actual behavior:
The // @ts-expect-error comment expected two errors spanning across two separate lines. The comment seems to take empty lines into account as a separator? Quite odd, seeing as code should ignore whitespace.
Work-around:
Add an empty line between the expected error line and the one that follows.
Component commits:
168be30 Fix incorrect line text computation to stop comment directive searching Fixesmicrosoft#38289e860d48 Stop searching for comment directive if the previous line is not empty
TypeScript Version: 3.9.1-rc
Search Terms:
ts-expect-error comment expects more than one error multiple lines
Code
Expected behavior:
I only expect
// @ts-expect-error
to ignore a single error at a time.Actual behavior:
The
// @ts-expect-error
comment expected two errors spanning across two separate lines. The comment seems to take empty lines into account as a separator? Quite odd, seeing as code should ignore whitespace.Work-around:
Add an empty line between the expected error line and the one that follows.
Playground Link:
https://www.typescriptlang.org/play/index.html?ts=4.0.0-dev.20200430#code/PTAEAEBcGcFoFMAeAHeBjSCBOWD2WAoACiIG9QBDALlEiwFd5QBfS6UNXAO2kgEoAdBVABeMaABmFADbR4fANzEylGnUYs2Hbr0HCxIyTLmKCy8tVoMmrCu049+Q0eKmz5S86qsbb9nU76rsYeBEA
Related Issues:
Couldn't find any.
The text was updated successfully, but these errors were encountered: