reactjs - Tür 'React.ReactNode', tür 'import(".../@types/react-transition-group/node_modules/@types/react/index").ReactNode' olarak atanamaz


React projesiyle çalıştım, Circle CI ile entegre ettim ve bazı küçük değişikliklerden sonra tüm yapılar başarısız olmaya başladı

Its instance type 'ReactApexChart' 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("/home/circleci/app.mxney-board-v2.test/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'.

79       <Chart options={fillOptions} series={graphData} height={chartHeight} />
          ~~~~~

src/index.tsx:20:8 - error TS2786: 'App' cannot be used as a JSX component.
  Its element type 'ReactElement<any, any> | Component<Omit<Subtract<unknown, WithTranslationProps>, keyof WithTranslation<N>> & WithTranslationProps, any, any> | null' is not a valid JSX element.
    Type 'Component<Omit<Subtract<unknown, WithTranslationProps>, keyof WithTranslation<N>> & WithTranslationProps, any, any>' is not assignable to type 'Element | ElementClass | null'.
      Type 'Component<Omit<Subtract<unknown, WithTranslationProps>, keyof WithTranslation<N>> & WithTranslationProps, any, any>' is not assignable to type 'ElementClass'.
        The types returned by 'render()' are incompatible between these types.
          Type 'React.ReactNode' is not assignable to type 'import("/home/circleci/app.mxney-board-v2.test/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'.

20       <App />
          ~~~

Yerel olarak, proje sorunsuz çalışıyor.

Denedim:

  • @types ve kütüphaneleri güncelle
  • react-apexchart kütüphanesini kaldır
  • react-transition kütüphanesini kaldır
  • yarn.lock ve node_modules'u kaldırın ve yeniden yükleyin - bu her şeyi bozar ve bu hataları yerel olarak alırım

Cevap #1

@types/react sürümünüz, kurulu olan react sürümüyle eşleşiyor mu?

İlgili makaleler