Strict TypeScript API

The Strict TypeScript API and Instance Types

The Strict TypeScript API, opt-in since 0.80 and default since 0.87, generates types from React Native 36,878 's source and exposes only the package root, so deep imports from react-native/Libraries/... stop working. Expo SDK 57 6,418 pins 0.86.3, so opt in; customConditions replaces the base list, so repeat "react-native":

BookNest's tsconfig.json with the Strict TypeScript APIJSON
{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "strict": true,
    "customConditions": ["react-native", "react-native-strict-api"],
    "paths": { "@/*": ["./src/*"], "@/assets/*": ["./assets/*"] }
  },
  "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
}

A notes input written the old way passed the classic types and now fails four times:

Output of 22
$ npx tsc --noEmit
src/components/note-input.tsx(3,15): error TS2305: Module '"react-native"' has no exported
member 'ViewProperties'.
src/components/note-input.tsx(4,33): error TS2307: Cannot find module
'react-native/Libraries/StyleSheet/StyleSheet' or its corresponding type declarations.
src/components/note-input.tsx(12,18): error TS2322: Type 'RefObject<TextInputType | null>'
is not assignable to type 'Ref<_TextInputInstance> | undefined'.
...
src/components/note-input.tsx(13,64): error TS2339: Property 'focus' does not exist on type
'TextInputType'.

Import ViewProps and ColorValue from 'react-native'. TextInput is now a function component, not an instance type: use useRef<ComponentRef<typeof TextInput>>(null), or 0.87's TextInputInstance.