metaplex icon indicating copy to clipboard operation
metaplex copied to clipboard

[Bug]: 'Countdown' cannot be used as a JSX component. Its instance type 'Countdown' is not a valid JSX element.

Open awesome1128 opened this issue 2 years ago • 5 comments

Which package is this bug report for?

candy machine ui

Issue description

  1. When I run Mint page using yarn start command, it returns an error like this.
  2. TypeScript error in E:/project/blockchain/solana/metaplex/js/packages/candy-machine-ui/src/MintCountdown.tsx(108,8): 'Countdown' cannot be used as a JSX component. Its instance type 'Countdown' is not a valid JSX element. The types returned by 'render()' are incompatible between these types. Type 'React.ReactNode' is not assignable to type 'import("E:/project/blockchain/solana/metaplex/js/packages/candy-machine-ui/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode'. Type '{}' is not assignable to type 'ReactNode'. TS2786

Command

I ran yarn start command in /metaplex/js/packages/candy-machine-ui folder.

Relevant log output

TypeScript error in E:/project/blockchain/solana/metaplex/js/packages/candy-machine-ui/src/MintCountdown.tsx(108,8):
'Countdown' cannot be used as a JSX component.
  Its instance type 'Countdown' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("E:/project/blockchain/solana/metaplex/js/packages/candy-machine-ui/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode'.
        Type '{}' is not assignable to type 'ReactNode'.  TS2786

    106 |   if (date) {
    107 |     return (
  > 108 |       <Countdown
        |        ^
    109 |         date={date}
    110 |         onComplete={onComplete}
    111 |         renderer={renderCountdown}

Operating system

Windows

Priority this issue should have

High (immediate attention needed)

Check the Docs First

  • [X] I have checked the docs and it didn't solve my issue

awesome1128 avatar May 31 '22 18:05 awesome1128

I was able to fix it by installing the latest types for react: yarn add @types/react@latest

Orlandster avatar Jun 06 '22 15:06 Orlandster

Latest @types react broke my ConnectButton, but I was able to fix that by doing const ConnectButton:React.FC<ButtonProps> = styled(WalletMultiButton)

kameoxylon avatar Jun 16 '22 01:06 kameoxylon

yarn add @types/react@latest

It works for me also, thanks

Skelt24 avatar Jun 21 '22 16:06 Skelt24

I was able to fix it by installing the latest types for react: yarn add @types/react@latest

This works for me.

Harry-Robson avatar Jul 23 '22 09:07 Harry-Robson

yarn add @types/react@latest works for me also.

octo8ight avatar Mar 20 '23 10:03 octo8ight