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 types do no support "dataSet" attribute in 0.13.3 #1668

Closed
danawoodman opened this issue Jul 11, 2020 · 4 comments
Closed

Typescript types do no support "dataSet" attribute in 0.13.3 #1668

danawoodman opened this issue Jul 11, 2020 · 4 comments

Comments

@danawoodman
Copy link

The problem
Based on the latest release, the recommended approach to pass data- attributes to a view is dataSet but it appears the types have not been updated to reflect this.

Based on the release notes I should be able to do this:

Forwarding of data-* props is no longer supported. Use dataSet instead. For example, dataSet={{ someName: 1 }}.

However, when passing dataSet I get a TS error (see below)

How to reproduce
Create a Typescript React component with dataSet:

<View dataSet={{ foo: 'bar' }} />

View TS errors.

Expected behavior
I don't get TS errors for a supported attribute.

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.13.3
  • React (version): 16.13.1
  • Browser: Brave (Chromium)

Typescript error:

(JSX attribute) dataSet: {
    foo: string;
}
No overload matches this call.
  Overload 1 of 2, '(props: Readonly<ViewProps>): View', gave the following error.
    Type '{ dataSet: { foo: string; }; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'dataSet' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps> & Readonly<{ children?: ReactNode; }>'.
  Overload 2 of 2, '(props: ViewProps, context?: any): View', gave the following error.
    Type '{ dataSet: { foo: string; }; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'dataSet' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps> & Readonly<{ children?: ReactNode; }>'.ts(2769)
@necolas
Copy link
Owner

necolas commented Jul 11, 2020

Someone needs to update the TS types wherever they are maintained

@necolas necolas closed this as completed Jul 11, 2020
@danawoodman
Copy link
Author

Sorry, I assumed they were maintained here.

Do you know who is the maintainer?

@necolas
Copy link
Owner

necolas commented Jul 24, 2020

I don't know who the maintainer is. I started a discussion about this if you would like to share your experience #1684

@georgii-ivanov
Copy link

georgii-ivanov commented Mar 13, 2021

Does anyone know how to implement a workaround for this property? (typescript project-scope definition)

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

No branches or pull requests

3 participants