Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element type is invalid #15

Open
mkilpatrick opened this issue Mar 28, 2022 · 3 comments
Open

Element type is invalid #15

mkilpatrick opened this issue Mar 28, 2022 · 3 comments

Comments

@mkilpatrick
Copy link

When I import this library and use it exactly the same way as the example I get

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

However, if I copy the src into my own project, along with this fix, it works fine.

@Gotfrid
Copy link

Gotfrid commented Sep 4, 2022

@mkilpatrick not sure if it's still relevant, but I faced the same issue today. I'm using commmonJS and was able to work around this issue the following way:

const { default: Spinner } = require("ink-spinner");

Have a good one 👋

@lynn1286
Copy link

@mkilpatrick Hey bro, did you solve this problem?

@jdeniau
Copy link
Contributor

jdeniau commented Jan 29, 2023

For the record, I had the same issue (and with ink-text-input too).

I solved it this way (even in TS)

import SpinnerCJS from 'ink-spinner';
import TextInputCJS from 'ink-text-input';

// @ts-expect-error -- issue with ink-text-input and CommonJS definition
const TextInput = TextInputCJS.default as typeof TextInputCJS;

// @ts-expect-error -- issue with ink-text-input and CommonJS definition
const Spinner = SpinnerCJS.default as typeof SpinnerCJS;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants