Mair / react-meetup-draftjs

Samples for Draftjs
https://draft-js-samples.now.sh
67 stars 13 forks source link

TypeScript Errors #1

Open tgrecojs opened 7 years ago

tgrecojs commented 7 years ago

hey @Mair !

I watched your video from the Melbourne Meet up on draft-js which then led me to this repo. That being said, I would love to help bring this project along and hopefully turn it into something that many people can use 😄 !

When trying to run the project however, TypeScript gave me a gang of errors so I am wondering how to fix this. By no means am I skilled with TypeScript however i do know the basics so I figured it wouldn't be a problem jumping in. Also, I have a solid bit of knowledge regarding styling so I thought that could be one of the first issues I tackle. I'd also love to make versions that uses Redux, and Next.js so let me know if you're interested in exploring those topics !

Below you can check a out some of the errors that create-react-app is spitting out. Let me know if there's any additional info that I can supply you wish. my typescript version is 2.3.4.

Error in ./src/draftjs/complex-decorator.tsx
(117,5): error TS2424: Class 'Component<StockSuggestionProps, StockSuggestionState>' defines instance member function 'componentDidMount', but extended class 'StockSuggestion' defines it as instance member property.

Error in ./src/draftjs/complex-decorator.tsx
(121,5): error TS2424: Class 'Component<StockSuggestionProps, StockSuggestionState>' defines instance member function 'componentWillReceiveProps', but extended class 'StockSuggestion' defines it as instance member property.

Error in ./src/index.tsx
(9,36): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<App> & Readonly<{ children?: ReactNode; }> & null'.
  Type '{}' is not assignable to type 'null'.

Error in ./src/index.tsx
(9,36): error TS2605: JSX element type 'App' is not a constructor function for JSX elements.
  Types of property 'setState' are incompatible.
    Type '{ <K extends never>(f: (prevState: null, props: null) => Pick<null, K>, callback?: (() => any) | ...' is not assignable to type '{ <K extends never>(f: (prevState: {}, props: any) => Pick<{}, K>, callback?: (() => any) | undef...'.
      Types of parameters 'f' and 'f' are incompatible.
        Type '(prevState: {}, props: any) => Pick<{}, any>' is not assignable to type '(prevState: null, props: null) => Pick<null, any>'.
          Types of parameters 'prevState' and 'prevState' are incompatible.
            Type 'null' is not assignable to type '{}'.

Error in ./src/App.tsx
(9,8): error TS1005: ')' expected.

Error in /Users/thomasgreco/draft-js/react-meetup-draftjs/src/App.test.tsx
(7,19): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<App> & Readonly<{ children?: ReactNode; }> & null'.
  Type '{}' is not assignable to type 'null'.

Error in /Users/thomasgreco/draft-js/react-meetup-draftjs/src/App.test.tsx
(7,19): error TS2605: JSX element type 'App' is not a constructor function for JSX elements.
sunshinesanty commented 7 years ago

@tgrecojs from what I see, the project was created with TypeScript 2.2.2. you can try running the project with that version of typescript.

Mair commented 7 years ago

Its all working now ☺

From: Santoshkumar Krishnamurthy Iyer notifications@github.com Reply-To: Mair/react-meetup-draftjs reply@reply.github.com Date: Tuesday, 19 September 2017 at 10:01 am To: Mair/react-meetup-draftjs react-meetup-draftjs@noreply.github.com Cc: Mair mair.swartz@live.com, Mention mention@noreply.github.com Subject: Re: [Mair/react-meetup-draftjs] TypeScript Errors (#1)

@tgrecojshttps://github.com/tgrecojs from what I see, the project was created with TypeScript 2.2.2. you can try running the project with that version of typescript.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Mair/react-meetup-draftjs/issues/1#issuecomment-330389383, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACXPDxmmTSqtOqW6w6RTVI2edN7xrL8Pks5sjwQ4gaJpZM4OFlUE.