Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Undeprecate Global React JSX Namespace
DefinitelyTyped#64464 (landed in semver patch release `@types/react@18.2.6`) scopes the JSX namespace as `React.JSX` to avoid collisions with multiple libraries working in the JSX namespace. This change also deprecated the existing JSX namespace, so existing usages of `JSX.Element`, etc are flagged in-editor. <img width="686" alt="Screenshot 2023-07-25 at 14 11 59" src="https://github.com/facebook/react-native/assets/4661784/531a4f88-8090-43aa-86d6-4af595d4cb5d"> This has a pretty drastic effect of making every previous non-anonymous function component, with an explicit return type, now fire deprecation warnings. E.g. this patch update now makes the out-of-the-box React native template create deprecation warnings. facebook/react-native#38615 In DefinitelyTyped itself, the hundreds of packages using `JSX.Element` outside of the direct React typings were not updated. TypeScript's [own documentation](https://www.typescriptlang.org/docs/handbook/jsx.html) also still suggests using `JSX.Element`. This is echoed by a platitude of existing documentation, and googling for `React.JSX.Element` will just bring up information about `JSX.Element`. Due to the widespread nature of the breakage here (especially in a patch release), and disconnect with existing code, documentation, and resources, this change removes the `@deprecated` annotation. I think there might still be a possible path to discouraging usage, but there needs to be a lot of legwork to get there in a way which isn't disruptive.
- Loading branch information