Uh oh!
There was an error while loading. Please reload this page.
Ignore specified error in //@ts-ignore - #21602
Conversation
Mikhail Busyrev (Busyrev)
commented
Feb 3, 2018
sorry for linting issues, fixing them |
Jessica Franco (Jessidhia)
commented
Feb 5, 2018
I actually suggested this in the original PR, but the author said he didn't like the idea because you can't tell what is being ignored by just the error code. |
| namespace ts { | ||
| const ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; | ||
| const ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?(?:\s+((?:(?:TS\d+),\s*)*(?:TS\d+)?))?)/; |
There was a problem hiding this comment.
The ? in (?:TS\d+)? is redundant (causes an extra backtrack into a 0-length match, which is already allowed by the ? in the outer non-capturing match)
There was a problem hiding this comment.
agree, thanks, I'll remove it later
Error codes are public now, they printed berfore error message in error report. Imho blindly ignore everything is very dangerous and not good idea. Ignoring is always not good idea, but additional safety is not superfluous, we are at TypeScript repository, right? |
Mikhail Busyrev (Busyrev)
commented
Feb 5, 2018
Another suggestion: |
Don't you have to split the provided string at the We have cases like this: TS9002 Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause. and TS90020 Initialize property '{0}' in the constructor In this case, if we have a TS9002 and a comment |
Mikhail Busyrev (Busyrev)
commented
Feb 15, 2018
Leonardo Carreiro (@lmcarreiro) yes, you are right. I`ll fix it |
Leonardo Carreiro (lmcarreiro)
commented
Feb 15, 2018
Your regex doesn't match error codes with spaces before comma: |
Mohamed Hegazy (mhegazy)
commented
Feb 27, 2018
Thanks Mikhail Busyrev (@Busyrev) for the contribution. We have had another heated discussion about this topic in the last language design meeting (see notes in #22011). The conclusion is we could not reach consensuses whether this feature should be added or not. It boils down to concerns about using error numbers, and how they do not add to expressiveness in a position like such. It is a discussion we have once every quarter or so, including when we first added support for ignoring errors. I am sure we will come to it again in the near future. |
Mikhail Busyrev (Busyrev)
commented
Feb 27, 2018
Mohamed Hegazy (@mhegazy) no problem, I can use my own fork :). For discussion I think that short text error idents, like in tslint, would be better. But someone should create them. |
👍 Thank you 😍 This is one if the points we keep going back to 😉 |
Mohamed Hegazy (mhegazy)
commented
Mar 2, 2018
closing for now. |
Fixes#21197
Special syntax available now:
to ignore only "Cannot invoke an expression whose type lacks a call signature." error.
Comma separated list supported, trailing comma is supported too:
If no error code specified, it ignores all errors.