0

I'm very new to TypeSccript. I'm trying to convert my React Native to use TypeScript. I followed the instructions here: https://reactnative.dev/docs/typescript

After running yarn tsc I get errors like:

node_modules/@react-navigation/stack/lib/typescript/src/types.d.ts:99:67 - error TS2339: Property 'style' does not exist on type 'PropsWithChildren<AnimatedProps<TextProps & RefAttributes<Text>>>'.

99     headerTitleStyle?: React.ComponentProps<typeof Animated.Text>['style'];

Is this an error in the node module or in my own code? Any tips on what I need to do?

I have a minimal project here: https://github.com/jauggy/React-Native-TypeScript-Test

2
  • can you provide more information - what does your file look like, what version of react-navigation are you on etc? Even better can you create a minimal reproduction on a github repo? Commented Aug 3, 2020 at 3:38
  • I've added a minimal project here: github.com/jauggy/React-Native-TypeScript-Test Commented Aug 3, 2020 at 4:29

1 Answer 1

2

This seems to be caused by bad declaration typings in the @react-navigation version you're on. You can get around this by updating your tsconfig to tell typescript to skip type checking of all declaration files (*.d.ts files):

// tsconfig.json
"compilerOptions": {
  // ...
  "skipLibCheck": true
}

Docs https://www.typescriptlang.org/docs/handbook/compiler-options.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.