make @ts-ignore available when using {/* @ts-ignore */}.
See original GitHub issueSearch Terms
@ts-ignore annotation
Suggestion
Hi, I apologize if it is already discussed. However, I believe we need this feature for @ts-ignore
.
Currently @ts-ignore
only mutes the errors only using with // @ts-ignore
.
I believe we also need to make @ts-ignore
available when using {/* @ts-ignore */}
.
I’ve already founded this issue. It’s a similar issue but not the same and I think this is easier to implement.
I think this feature only need to change this code. https://github.com/Microsoft/TypeScript/blob/master/src/compiler/program.ts#L2
Use Cases
I’d like to use this in the html structures in the TSX file.
Examples
This is implementation for amp-script
. We have to use onclick
instead of onClick
and it’s not supported for now.
const App = () => {
return (
<div>
...
{/* @ts-ignore */}
<button onclick={() => setCount(count + 1)}>Click me</button> // this line should be ignored
...
</div>
);
}
Checklist
My suggestion meets these guidelines:
- This wouldn’t be a breaking change in existing TypeScript/JavaScript code
- This wouldn’t change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript’s Design Goals.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:91
- Comments:7
Top Results From Across the Web
How to use `@ts-ignore` for a block? - Stack Overflow
So to disable checking for a block (function, class, etc.), you can move it into its own file, then use the comment/flag above....
Read more >How to Ignore errors in TypeScript files | bobbyhadz
Use `// @ts-ignore` to ignore the type checking errors on the next line in a TypeScript file. If you use a linter, you...
Read more >How To Ignore The Next Line In TypeScript? - Tim Mousk
An in-depth article on how to ignore the next line in TypeScript. How to ignore an error with @ts-expect-error?
Read more >ban-ts-comment - typescript-eslint
Using these to suppress TypeScript compiler errors reduces the effectiveness of ... ts-expect-error , ts-ignore , ts-nocheck , ts-check directives.
Read more >TypeScript ignore error - remarkablemark
// @ts-nocheck · To disable the compiler error for a single line, add the comment before the line: ; // @ts-ignore · If...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
use this for now :
Here’s how I was able to work around this issue: