react-input-range icon indicating copy to clipboard operation
react-input-range copied to clipboard

JSX element type 'InputRange' does not have any construct or call signatures.

Open slackjaw47 opened this issue 7 years ago • 2 comments

When importing InputRange into a .tsx file as a default import:

import InputRange from 'react-input-range';

I get this error: Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of COMPONENT.

When importing InputRange int a .tsx file as a default import with the alias method:

import * as InputRange from 'react-input-range';

I get this error: JSX element type 'InputRange' does not have any construct or call signatures.

Had other people look at it. Doesn't seem to be anything wrong with the import. Using the latest version of Typescript 2.6.2 and React 15.5.4.
Anybody else having this issue?

slackjaw47 avatar Dec 08 '17 19:12 slackjaw47

Yeah, I think there's an issue with the definition file.

davidchin avatar Jan 15 '18 11:01 davidchin

For the moment, this workaround works for me without losing the type check:

import * as ReactInputRange from 'react-input-range'

const InputRange: typeof ReactInputRange.default = ReactInputRange as any

<InputRange ... />

shuhei avatar Feb 28 '18 12:02 shuhei