Closed
Description
We noticed TypeScript switches the order of the union type members in the error message. And we hope someone can shine a light on this. The error is for React Ref type.
The error message used to be:
"Type 'Ref<unknown>' is not assignable to type 'string | RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined'."
Now it becomes: (RefObject and ((instance: HTMLDivElement | null) => void) switches)
Type 'Ref<unknown>' is not assignable to type 'string | ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
We did not change relevant code, but did add react-transition-group
dependency.
What puzzles me is in @types/react, the ref type is defined as:
type Ref<T> = { bivarianceHack(instance: T | null): void }["bivarianceHack"] | RefObject<T> | null;
Why the order of the bivarianceHack and RefObject would switch all of sudden?
Metadata
Metadata
Assignees
Labels
No labels