Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript errors in AllProps type #4239

Closed
szymn opened this issue Oct 26, 2021 · 2 comments
Closed

Typescript errors in AllProps type #4239

szymn opened this issue Oct 26, 2021 · 2 comments
Assignees
Labels
v3 V3

Comments

@szymn
Copy link

szymn commented Oct 26, 2021

Describe the bug

#4173 introduced ts-ignore comments in AllProps type. These are stripped in d.ts files, so now when library is used in a project, we get these errors:

node_modules/native-base/lib/typescript/theme/types.d.ts:11:205 - error TS2536: Type '"scale"' cannot be used to index type 'T[key]'.

11     [key in Extract<keyof T, string>]?: T[key] extends boolean ? GetRNStyles<key> : key extends 'shadow' ? GetRNStyles<null, 'shadows'> : 'property' extends keyof T[key] ? GetRNStyles<T[key]['property'], T[key]['scale']> : 'properties' extends keyof T[key] ? T[key]['properties'] extends {
                                                                                                                                                                                                               ~~~~~~~~~~~~~~~

node_modules/native-base/lib/typescript/theme/types.d.ts:13:21 - error TS2536: Type '"0"' cannot be used to index type 'T[key]["properties"]'.

13     } ? GetRNStyles<T[key]['properties']['0'], T[key]['scale']> : unknown : unknown;
                       ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/native-base/lib/typescript/theme/types.d.ts:13:48 - error TS2536: Type '"scale"' cannot be used to index type 'T[key]'.

13     } ? GetRNStyles<T[key]['properties']['0'], T[key]['scale']> : unknown : unknown;
                                                  ~~~~~~~~~~~~~~~

To Reproduce
Steps to reproduce the behaviour:

  1. Create react-native project: npx react-native init MyApp --template react-native-template-native-base-typescript
  2. Bump typescript version (on initial version there is a different error) - I used 4.4.3
  3. yarn tsc
@tlenclos
Copy link

Dupplicate of #4189

@makkarMeenu
Copy link
Collaborator

This has been resolved in NativeBase 3.2.2 . Please let us know if you face any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 V3
Projects
Development

No branches or pull requests

4 participants