Bug Report
Using @ts-expect-error in a multi-line JSX leads to false-positive type-checks.
🔎 Search Terms
- jsx, ignore, expect, error
🕗 Version & Regression Information
"typescript": "4.5.4" & "typescript": "4.7.4"
I also tried typescript@next (4.8.0-dev.20220720)
This is the behavior in every version I tried, and I reviewed the FAQ for entries about JSX.
⏯ Playground Link
Playground link with relevant code
💻 Code
import{React,FunctionComponent}from'react'exportconstMyComponent: FunctionComponent<{validProp: string}>=(props)=>{return<>MyComponent</>}exportconstMyComponent2: FunctionComponent<{validProp: string}>=(props)=>{return(<><MyComponentvalidProp='validProp'invalidProp1invalidProp2/><MyComponentvalidProp='validProp'// @ts-expect-errorinvalidProp1invalidProp2// <-- here it should still throw and show me that this prop is invalid/><MyComponentvalidProp='validProp'invalidProp1// @ts-expect-errorinvalidProp2/></>)}🙁 Actual behavior
Using @ts-expect-error if you want to suppress a warning for e.g. one invalid React component prop is not checking the rest of the other props anymore.
🙂 Expected behavior
Using @ts-expect-error if you want to suppress a warning for e.g. one invalid React component prop should still check the rest of the other props.
Bug Report
Using
@ts-expect-errorin a multi-line JSX leads to false-positive type-checks.🔎 Search Terms
🕗 Version & Regression Information
"typescript": "4.5.4"&"typescript": "4.7.4"I also tried
typescript@next(4.8.0-dev.20220720)This is the behavior in every version I tried, and I reviewed the FAQ for entries about JSX.
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Using
@ts-expect-errorif you want to suppress a warning for e.g. one invalid React component prop is not checking the rest of the other props anymore.🙂 Expected behavior
Using
@ts-expect-errorif you want to suppress a warning for e.g. one invalid React component prop should still check the rest of the other props.