question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

make @ts-ignore available when using {/* @ts-ignore */}.

See original GitHub issue

Search 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:open
  • Created 4 years ago
  • Reactions:91
  • Comments:7

github_iconTop GitHub Comments

11reactions
Mathijs003commented, Jun 8, 2020

use this for now :

{/*
 // @ts-ignore*/}
10reactions
zhouzicommented, Apr 2, 2021

Here’s how I was able to work around this issue:

<div>
  {
    // @ts-ignore
    <App />
  }
</div>
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found