-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitterDomain: Quick FixesEditor-provided fixes, often called code actions.Editor-provided fixes, often called code actions.
Milestone
Description
TypeScript Version: 3.2.0-dev.20181004
Search Terms:
disableJsDiagnostics
JSX
Code fix
Ignore this error message
Add '@ts-ignore' to all error messages
Code
// MyComponent.jsx
// @ts-check
import React from "react";
class MyComponent extends React.Component {
render() {
return (
<div>
// @ts-ignore
{doesNotExist}
</div>
);
}
}
export default MyComponent;
Running the Ignore this error message
or Add '@ts-ignore' to all error messages
code fix inserts a // @ts-ignore
which satisfies the compiler.
But,
<div>
// @ts-ignore
{doesNotExist}
</div>
will actually render // @ts-ignore
.
Expected behavior:
Looks like {/* @ts-ignore */}
or {/* // @ts-ignore */}
are not recognized as valid ignore comments.
So, the best I could come up with is
<div>
{/*
// @ts-ignore */}
{doesNotExist}
</div>
Actual behavior:
// MyComponent.jsx
// @ts-check
import React from 'react';
class MyComponent extends React.Component {
render() {
return (
<div>
// @ts-ignore
{doesNotExist}
</div>
);
}
}
export default MyComponent;
where // @ts-ignore
mistakenly gets rendered.
Related Issues:
pesho, Dinika, oshalygin, roeyb, thekevinbrown and 26 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitterDomain: Quick FixesEditor-provided fixes, often called code actions.Editor-provided fixes, often called code actions.