ink-select-input icon indicating copy to clipboard operation
ink-select-input copied to clipboard

React.createElement: type is invalid

Open DomVinyard opened this issue 4 years ago • 4 comments

Using a fresh install of https://github.com/vadimdemedes/create-ink-app, installing ink-select-input, and running the demo from the README generates the following error:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

The above error occurred in the <Demo> component:
    in Demo (created by App)
    in div (created by Box)
    in Box (created by App)
    in App
    in App

Check the render method of `Demo`.
    at createFiberFromTypeAndProps (/node_modules/react-reconciler/cjs/react-reconciler.development.js:16627:21)
    at createFiberFromElement (/node_modules/react-reconciler/cjs/react-reconciler.development.js:16650:15)
    at reconcileSingleElement (/node_modules/react-reconciler/cjs/react-reconciler.development.js:5302:23)
    at reconcileChildFibers (/node_modules/react-reconciler/cjs/react-reconciler.development.js:5362:35)
    at reconcileChildren (/node_modules/react-reconciler/cjs/react-reconciler.development.js:7865:28)
    at mountIndeterminateComponent (/node_modules/react-reconciler/cjs/react-reconciler.development.js:8629:5)
    at beginWork$1 (/node_modules/react-reconciler/cjs/react-reconciler.development.js:9938:16)
    at Object.invokeGuardedCallbackImpl (/node_modules/react-reconciler/cjs/react-reconciler.development.js:11563:10)
    at invokeGuardedCallback (/node_modules/react-reconciler/cjs/react-reconciler.development.js:11740:31)
    at beginWork$$1 (/node_modules/react-reconciler/cjs/react-reconciler.development.js:15778:7)

DomVinyard avatar Mar 19 '20 10:03 DomVinyard

Same problem

sarmong avatar May 23 '20 08:05 sarmong

Something weird in the way it's bundled. I haven't had a chance to dig in. But if you're requiring, then you can do: const SelectInput = require('ink-select-input').default

deshiknaves avatar Jul 05 '20 06:07 deshiknaves

@deshiknaves is correct, it's exported via default prop for non-ESM imports.

vadimdemedes avatar Sep 19 '20 09:09 vadimdemedes

Looks like it isn't configured to output ESM and is outputting ES6 instead Doing this works (although TypeScript is giving errors as if it was ESM)

image

This is the current output of ink-select-input:

image

pfftdammitchris avatar Sep 07 '21 01:09 pfftdammitchris