question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@types/react@16.9.46: Types of property 'style' are incompatible

See original GitHub issue

Do you want to request a feature or report a bug?

  • I found a bug
  • I want to propose a feature

What is the current behavior?

Typescript errors out when building the react-dropzone example, using the latest version of @types/react

If the current behavior is a bug, please provide the steps to reproduce.

  1. Upgrade @types/react to 16.9.46
  2. Use react-dropzone 11.0.3
  3. Run example code:
function MyDropzone() {
  const onDrop = useCallback(acceptedFiles => {
    // Do something with the files
  }, [])
  const {getRootProps, getInputProps, isDragActive} = useDropzone({onDrop})

  return (
    <div {...getRootProps()}>
      <input {...getInputProps()} />
      {
        isDragActive ?
          <p>Drop the files here ...</p> :
          <p>Drag 'n' drop some files here, or click to select files</p>
      }
    </div>
  )
}

Typescript fails with the following errors:

string | number | string[] | undefined; suppressContentEditableWarning?: boolean | undefined; ... 249 more ...; onTransitionEndCapture?: ((event: TransitionEvent<...>) => void) | undefined; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
  Type '{ children: Element[]; refKey?: string | undefined; defaultChecked?: boolean | undefined; defaultValue?: string | number | string[] | undefined; suppressContentEditableWarning?: boolean | undefined; ... 249 more ...; onTransitionEndCapture?: ((event: TransitionEvent<...>) => void) | undefined; }' is not assignable to type 'HTMLAttributes<HTMLDivElement>'.
    Types of property 'style' are incompatible.
      Type 'import("/Users/ldiqual/Siteline/siteline/node_modules/@types/react/index").CSSProperties | undefined' is not assignable to type 'React.CSSProperties | undefined'.
        Type 'import("/Users/ldiqual/Siteline/siteline/node_modules/@types/react/index").CSSProperties' is not assignable to type 'React.CSSProperties'.
          Types of property 'appearance' are incompatible.
            Type '"-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "button-bevel" | "checkbox" | "listbox" | "menulist" | "menulist-button" | "meter" | "progress-bar" | "push-button" | ... 7 more ... | undefined' is not assignable to type '"-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "checkbox" | "listbox" | "menulist" | "menulist-button" | "meter" | "progress-bar" | "push-button" | "radio" | ... 6 more ... | undefined'.
              Type '"button-bevel"' is not assignable to type '"-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "checkbox" | "listbox" | "menulist" | "menulist-button" | "meter" | "progress-bar" | "push-button" | "radio" | ... 6 more ... | undefined'.

This happens for @types/react v16.9.44 to v16.9.46. Does not affect v16.9.43.

What is the expected behavior?

Typescript successfully compiles the example code.

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Operating System and react-dropzone version.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

26reactions
eric-burelcommented, Jul 15, 2021

For lost googlers: this usually means you have multiple occurrence of @types/react with incompatible versions, either in your app or dependencies such as react-dropzone or others. You can add Yarn resolutions to fix this issue:

  "resolutions": {
    "@types/react": "^17.0.14",
    "@types/react-dom": "^17.0.9"
  }

Note: this seems problematic to me that those package comes with this dependency at first, but this seems to happen a lot.

4reactions
rolandjitsucommented, Mar 26, 2021

Closing this as it doesn’t happen with the latest versions of typings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Types of property 'type' are incompatible. Problem with ...
I am building a react site with some reusable generic UI components. Our backend service will return some responses with the data conforming...
Read more >
@types/react - npm
Start using @types/react in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type declarations.
Read more >
the types returned by 'render()' are incompatible between ...
The types returned by 'render()' are incompatible between these types. Type 'React.ReactNode' is not assignable to type 'import("/home/circleci/app.mxney-board- ...
Read more >
Open Source Used In Assist 3.1 - Cisco
This document contains licenses and notices for open source software used in this product.
Read more >
Section 4: @types/react and @types/react-dom APIs
The @types typings export both "public" types meant for your use as well as ... CSSProperties - used to type style objects; all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found