File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export interface RenderOptions<
127
127
* @see {@link https://react.dev/reference/react-dom/client/createRoot#parameters createRoot#options }
128
128
*/
129
129
onCaughtError ?: ReactDOMClient . RootOptions extends {
130
- onCaughtError : infer OnCaughtError
130
+ onCaughtError ? : infer OnCaughtError
131
131
}
132
132
? OnCaughtError
133
133
: never
Original file line number Diff line number Diff line change @@ -266,9 +266,16 @@ export function testContainer() {
266
266
export function testErrorHandlers ( ) {
267
267
// React 19 types are not used in tests. Verify manually if this works with `"@types/react": "npm:types-react@rc"`
268
268
render ( null , {
269
- // Should work with React 19 types
270
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
271
- // @ts -expect-error
269
+ // Should work with React 19 types but intentionally fails with React 18 types.
270
+ //
271
+ // > Why use `@ts-ignore` instead of `@ts-expect-error`?
272
+ // > Default React 19 types work error-free, causing TS compiler
273
+ // > to report `@ts-expect-error` as unused (requiring removal).
274
+ // > But for compatibility with React 18 types in tests,
275
+ // > we have to use `@ts-ignore` instead.
276
+ //
277
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
278
+ // @ts -ignore
272
279
onCaughtError : ( ) => { } ,
273
280
} )
274
281
render ( null , {
You can’t perform that action at this time.
0 commit comments