Nativebase: Typescript error: Interface 'Card' incorrectly extends interface 'ReactListViewProperties'

Created on 11 Apr 2018  路  3Comments  路  Source: GeekyAnts/NativeBase

- react-native 0.54.2 (via expo sdk-26.0.0)
- @types/react-native 0.55.1
- react 16.3.0-alpha.1
- @types/react 16.3.8
- native-base 2.4.1
- typescript 2.7.1

Expected behaviour

./node_modules/.bin/tsc --pretty command should not return any errors

Actual behaviour

./node_modules/.bin/tsc --pretty
node_modules/native-base/index.d.ts:482:13 - error TS2430: Interface 'Card' incorrectly extends interface 'ReactListViewProperties'.
  Types of property 'ref' are incompatible.
    Type 'string | ((instance: ViewProperties | ReactListViewProperties | null) => any) | RefObject<ViewPro...' is not assignable to type 'string | ((instance: (ListViewStatic & ScrollViewStatic & ViewStatic) | null) => any) | RefObject...'.
      Type 'RefObject<ViewProperties | ReactListViewProperties>' is not assignable to type 'string | ((instance: (ListViewStatic & ScrollViewStatic & ViewStatic) | null) => any) | RefObject...'.
        Type 'RefObject<ViewProperties | ReactListViewProperties>' is not assignable to type 'RefObject<ListViewStatic & ScrollViewStatic & ViewStatic>'.
          Type 'ViewProperties | ReactListViewProperties' is not assignable to type 'ListViewStatic & ScrollViewStatic & ViewStatic'.
            Type 'ViewProperties' is not assignable to type 'ListViewStatic & ScrollViewStatic & ViewStatic'.
              Type 'ViewProperties' is not assignable to type 'ListViewStatic'.
                Property 'DataSource' is missing in type 'ViewProperties'.

482     interface Card extends ReactNative.ViewProperties, ReactListViewProperties {
                  ~~~~

Thank you for Native Base and thank you for helping with this issue!

bug

Most helpful comment

I had the same issue and I think the problem is with the latest @types/react as opposed to Native Base???

  • If I use @types/react 16.3.10 I get the above error but if I revert to 16.3.5 I can build OK

See my working package.json - where I have 2 React Native hacks currently:

  • Fix TypeScript at 2.7.2 since the 2.8 version is broken I think
  • Fix the above typings at version 16.3.5 to work around the issue you've found

Anyway - I'm not any kind of React Native expert - but I hope this helps.

All 3 comments

Seeing the same issue.

I had the same issue and I think the problem is with the latest @types/react as opposed to Native Base???

  • If I use @types/react 16.3.10 I get the above error but if I revert to 16.3.5 I can build OK

See my working package.json - where I have 2 React Native hacks currently:

  • Fix TypeScript at 2.7.2 since the 2.8 version is broken I think
  • Fix the above typings at version 16.3.5 to work around the issue you've found

Anyway - I'm not any kind of React Native expert - but I hope this helps.

Fixed with 2.4.3

Was this page helpful?
0 / 5 - 0 ratings