react-tournament-bracket icon indicating copy to clipboard operation
react-tournament-bracket copied to clipboard

Trouble with new version of TS

Open baomastr opened this issue 6 years ago • 4 comments

new flag in tsconfig need for new version of TS

https://github.com/Microsoft/TypeScript/issues/25260#issuecomment-400600877

baomastr avatar Aug 21 '18 10:08 baomastr

@baomastr is this flag supposed to be set in the dependencies, or in the project including them? the comment says...

Fixing the packages by hand is senseless.

moodysalem avatar Aug 21 '18 14:08 moodysalem

@moodysalem the flag is supposed to be in tsconfig.json files for dev and prod in order to fix the errors with new version of TS like this:

Type 'keyof T' does not satisfy the constraint 'string'.
  Type 'string | number | symbol' is not assignable to type 'string'.
    Type 'number' is not assignable to type 'string'.

fixing TS package version by hand can also help but it is not right solution if you want to use new version of TS.

baomastr avatar Aug 21 '18 15:08 baomastr

here is the link to changelist of TS : https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#keyof-now-includes-string-number-and-symbol-keys

and line in code, that causes error in new version is: https://github.com/moodysalem/react-tournament-bracket/blob/436b4ab75da8ca047a00c14a72db95b60e3a703a/src/components/BracketGenerator.tsx#L65

you can also see last comments about that trick http://ideasintosoftware.com/typescript-advanced-tricks/

baomastr avatar Aug 21 '18 16:08 baomastr

You can just remove the export type Omit // ... line now as normal TS has this type built-in.

You'll need to ignore the 2nd error about {} not being part of the types.

davwheat avatar Jan 10 '21 19:01 davwheat