magic-js icon indicating copy to clipboard operation
magic-js copied to clipboard

version 6.x incompatible with more modern typescript versions

Open mwawrusch opened this issue 3 years ago • 4 comments

🐛 Description

Compilation with a typescript version like 4.3.5 fails:

Error: node_modules/@magic-sdk/provider/dist/es/modules/base-extension.d.ts:109:34 - error TS2344: Type 'TExt extends Extension<string>[] ? UnwrapArray<{ [P in keyof TExt]: TExt[P] extends Extension<infer K> ? K : never; }> : keyof TExt' does not satisfy the constraint 'string'.
  Type 'UnwrapArray<{ [P in keyof TExt]: TExt[P] extends Extension<infer K> ? K : never; }> | keyof TExt' is not assignable to type 'string'.
    Type 'UnwrapArray<{ [P in keyof TExt]: TExt[P] extends Extension<infer K> ? K : never; }>' is not assignable to type 'string'.
      Type 'unknown' is not assignable to type 'string'.
        Type 'string | ({ [P in TCustomExtName]: Extension<string>; } extends Extension<string>[] ? UnwrapArray<{ [P in keyof (Extension<string>[] & { [P in TCustomExtName]: Extension<...>; })]: (Extension<...>[] & { [P in TCustomExtName]: Extension<...>; })[P] extends Extension<...> ? K : never; }> : TCustomExtName)' is not assignable to type 'string'.
  ....

🧩 Steps to Reproduce

create a typescript project (for example angular 12) with "typescript": "4.3.5"

🌎 Environment

Software Version(s)
magic-sdk 6.x
Browser n/a
yarn npm v6.14.11
Operating System Mac

mwawrusch avatar Oct 31 '21 16:10 mwawrusch

Please help us isolate the issue with the following:

  1. Your version of TypeScript
  2. The content of your tsconfig.json file
  3. Any @magic-ext/* packages you're using (and their versions)
  4. A reproducible example

smithki avatar Nov 02 '21 16:11 smithki

I haven't been able to reproduce this, so will need a bit more help from you to isolate the issue. Let me know if you can put together a reproduction.

smithki avatar Nov 02 '21 17:11 smithki

Repro is easy. Create angular app , upgrade to v12, then include magic somewhere.

I created a sample for you - https://www.dropbox.com/s/nxlx4k27x5aihp6/magic.zip?dl=0

mwawrusch avatar Nov 03 '21 02:11 mwawrusch

THere are a few more errors, those go away if you set "allowSyntheticDefaultImports": true, in the tsconfig.json, which still leaves the .semver bug, and probably the typings bug.

mwawrusch avatar Nov 03 '21 02:11 mwawrusch

If you find any incompatibilities with TS and v9.x, please feel free to open a new issue.

ayv8er avatar Aug 17 '22 14:08 ayv8er