rnx-kit
rnx-kit copied to clipboard
TypeScript support for react-native
Add react-native support to TypeScript. Problem is demonstrated and explained in https://github.com/afoxman/rnts-example.
- [x] Update the TypeScript resolver: https://github.com/microsoft/TypeScript/pull/48189
- [ ] Module name substitution -- still in design discussions: https://github.com/microsoft/TypeScript/issues/48095
Followup: What's missing now is getting types for the target platform when the import/require is for 'react-native' (e.g. react-native-windows, which has types in its core package).
Met with the TypeScript team, and it sounds like we can get this without further TS core changes. Rough plan is to move everything to @types packages and use existing path/baseurl mapping to make it work. Andrew Branch is going to help when I find time to dig in further. One big step that he pointed out is the need to avoid "links" between types packages -- e.g. RNW types import RN types. This won't work with the remapping system. This means moving every RN platform to its own @types/... package.
react-native
is now shipping types.