-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Allow trailing lines in multiline comment directives #38370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
@DanielRosenwasser and @RyanCavanaugh should comment on whether @ts-ignore is allowed anywhere in the comment or not but the scenario particularly shows discrepancies is: // @ts-ignore
// come comment
// some other comment
// @another
x(); // This ignores error
/* @ts-ignore */
/*another comment
that could be multiline*/
x(); // while this does not ignore error
/* @ts-ignore */
// another comment
// that could be multiline
x(); // this will ignore the error
// @ts-ignore
/*another comment
that could be multiline*/
x(); // while this does not ignore error
|
Wow, // @ts-ignore
// come comment
// some other comment
// @another
x(); // This ignores error Really!? |
@DanielRosenwasser we have test for that which i only realized when i was looking into #38296 and e860d48 failed for the test |
@DanielRosenwasser Oof. Please come up with some kind of specification on how this should work |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
TypeScript Version: 4.0.0-dev.20200507
Search Terms: multiline comment directive ts-expect-error ts-ignore
Code
Expected behavior:
The comment looks like a directive to ignore the
x();
's type checking complaint.Actual behavior:
Comment directive parsing only looks at the last line of the comment. It should also allow the first line of the comment.
I'm in favor of not allowing any other lines (i.e. "middle" lines) to count as directives. Extending to allow characters after the
@ts-
has precedent from what's already allowed (we're really just adding newlines). But putting characters before the@ts-
has a precedent of not working even in single-line comments.Playground Link: https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=28&pc=2#code/MYewdgzgLgBAHjAvDADAbgFAYPQCoYACUEAtAJYDmYIATgKYahhRlgCurFMoAtj3cxgYYUABYBDWKDYAbACYwARnRg9ZLGazq5sWOAAoAlGiA
Related Issues: Following discussion in #38228 (comment), as suggested by @sheetalkamat.
The text was updated successfully, but these errors were encountered: