-
Notifications
You must be signed in to change notification settings - Fork 12.8k
make @ts-ignore available when using {/* @ts-ignore */}. #31147
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
Comments
waiting feedback asap. |
Use of `@ts-ignore` in jsx expressions is unsupported. Somehow it works anyway in [email protected] so we need to pin until we've resolved the ignore comments. Example of unsupported comment: ``` { /* // @ts-ignore something */ } ``` see microsoft/TypeScript#31147
Use of `@ts-ignore` in jsx expressions is unsupported. Somehow it works anyway in [email protected] so we need to pin until we've resolved the ignore comments. Example of unsupported comment: ``` { /* // @ts-ignore something */ } ``` see microsoft/TypeScript#31147
use this for now :
|
Parsing error: '...' expected |
I wasn't able to get the workarounds shown in this and other issues (#27552, #37738) to work. I started with code that looks a bit like this const Foo = () => {
const thing = mightReturnNull();
return (
<div>
<SomeComponent someProp={thing}></SomeComponent> 👈 tsc tells me off here
</div>
);
}; and turned it into this const Foo = () => {
const thing = mightReturnNull();
// @ts-ignore
const workaround: NonNullable<string> = thing;
return (
<div>
<SomeComponent someProp={workaround}></SomeComponent>
</div>
);
}; I think this is reasonably clean and that the general idea likely applies more broadly. (And, no, in the real, non-simplified code in question I'm not being quite so cavalier shuffling |
I may be misunderstanding some simpler approach but I had trouble ts-ignore'ing a single prop on a tag, so I made the tag single lined with a prettier-ignore and then added a ts-ignore to that Example
|
Here's how I was able to work around this issue: <div>
{
// @ts-ignore
<App />
}
</div> |
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 useonclick
instead ofonClick
and it's not supported for now.Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: