Skip to content

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

Description

@danawoodman

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions