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.

TypeScript definitions are out of date

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? Latest version of react-dropzone at the time of submitting this issue is 4.1.3, however the latest available version of @types/react-dropzone is 3.13.1 and it’s already missing at least one property definition.

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

  1. Add a Dropzone component to your page
    import * as Dropzone from 'react-dropzone';
    
  2. Try to define the disabledClassName
    <Dropzone
        disabledClassName="my-disabled-classname"
    >
    
  3. Receive a transpilation error:
    error TS2339: Property 'disabledClassName' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Dropzone> & Readonly<{ children?: ReactNode; }> & ...'.
    

Same seems to be happening to acceptClassName.

What is the expected behavior? Being able to use all properties available in the current version.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18

github_iconTop GitHub Comments

2reactions
benbayardcommented, Sep 25, 2017

A note: in TS you should not import React-dropzone with * as imports. This module is exported as common JS in its source. You should use import Dropzone = require('react-dropzone);

1reaction
FlayaNcommented, Nov 4, 2017

@ashok-sc It seems like the typescript-definition is still wrong.

I got it to work using:

"@types/react-dropzone": "4.1.0",
"react-dropzone": "4.1.3

Either you can change typing locally row 51 in index.d.ts export = Dropzone; => export default Dropzone; But that will get overwritten of course…

So I instead added this when I import the module:

import * as Dropzone2 from "react-dropzone";
const Dropzone: any = Dropzone2; // @types/react-dropzone 4.1.0 exports wrong

And this works both in typescript and runtime…

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript definitions are out of date · Issue #102 · eemeli/yaml
The DefinitelyTyped TS definitions haven't been updated since the 1.0 release last fall, and the library's API has expanded a bit since then....
Read more >
How do I express a date type in TypeScript? - Stack Overflow
The type is Date : const d: Date = new Date(); // but the type can also be inferred from "new Date()" already....
Read more >
Serverless service file Typescript definitions will never be ...
Serverless service file Typescript definitions will never be outdated again! Illustration for automated Typescript definitions generation.
Read more >
Handling date strings in TypeScript - LogRocket Blog
When dates are string variables, TypeScript infers the string type by default, making them tough to handle.
Read more >
Documentation - tsc CLI Options - TypeScript
Flag Type Default ‑‑allowJs boolean false ‑‑allowUmdGlobalAccess boolean false ‑‑allowUnreachableCode boolean
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