Skip to content

Installing native-recipe

Terminal window
npm install @lynstack/native-recipe

Its one dependency is @lynstack/recipe. React Native is a peer dependency: the package checks styles against its types, and imports nothing from it at runtime.

NeedsSupported
TypeScript5.4 or newer
RuntimesNode.js 16.9, Bun 1.0, Deno 2.0, or newer
BrowsersES2022: Chrome 93, Firefox 92, Safari 15.4, or newer
ModulesES modules only: import it, or require it in Bun or from Node.js 20.19, 22.12, or newer
React Native0.76 or newer, as in Expo SDK 52 or newer

Every change runs each package on the oldest and the newest Node.js, Bun, and Deno in this table, and compiles its types with the oldest and the newest TypeScript.

In an Expo app, tsconfig.json extends expo/tsconfig.base, which works as it is. A React Native CLI app extends @react-native/typescript-config, which works too.

A tsconfig that you write by hand can report errors inside React Native’s own type declarations. Some, such as Duplicate identifier 'FormData', come from the DOM types, which declare the same globals as React Native. Others come from React Native’s declarations themselves, which do not compile without skipLibCheck. Set skipLibCheck, and leave the DOM out of lib:

tsconfig.json
{
"compilerOptions": {
// Next to your other options, such as "jsx" and "module".
"lib": ["ES2022"],
"skipLibCheck": true,
"strict": true,
},
}