magic-js
magic-js copied to clipboard
version 6.x incompatible with more modern typescript versions
🐛 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 |
Please help us isolate the issue with the following:
- Your version of TypeScript
- The content of your
tsconfig.json
file - Any
@magic-ext/*
packages you're using (and their versions) - A reproducible example
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.
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
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.
If you find any incompatibilities with TS and v9.x, please feel free to open a new issue.