Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type 'DeepNullable<K>' does not satisfy the constraint 'WeakKey' #130

Closed
zervant-konstantin opened this issue Mar 14, 2024 · 3 comments · Fixed by #131
Closed

Type 'DeepNullable<K>' does not satisfy the constraint 'WeakKey' #130

zervant-konstantin opened this issue Mar 14, 2024 · 3 comments · Fixed by #131

Comments

@zervant-konstantin
Copy link

zervant-konstantin commented Mar 14, 2024

I am using:

NodeJS v21.7.1
typescript@5.4.2
jest-mock-extended@3.0.5

When I build project by command tsc I have these errors from ts-essentials, that is the dependency of jest-mock-extended

I understand that errors inside ts-essentials, but it effect to jest-mock-extended.
jest-mock-extended uses old version ts-essentials - ^7.0.3 (latest is 9.4.1)

I created also the issue ts-essentials/ts-essentials#381

Do you have any ideas to fix it?

node_modules/ts-essentials/dist/types.d.ts:67:13 - error TS2344: Type 'DeepNullable<K>' does not satisfy the constraint 'WeakKey'.
  Type 'symbol | object | (Builtin & object) | Map<unknown, unknown> | WeakMap<symbol | object | null, unknown> | Set<unknown> | WeakSet<symbol | object | null> | unknown[] | Promise<unknown> | null' is not assignable to type 'WeakKey'.
    Type 'null' is not assignable to type 'WeakKey'.

67   ? WeakMap<DeepNullable<K>, DeepNullable<V>>
               ~~~~~~~~~~~~~~~

node_modules/ts-essentials/dist/types.d.ts:71:13 - error TS2344: Type 'DeepNullable<U>' does not satisfy the constraint 'WeakKey'.
  Type 'symbol | object | (Builtin & object) | Map<unknown, unknown> | WeakMap<symbol | object | null, unknown> | Set<unknown> | WeakSet<symbol | object | null> | unknown[] | Promise<unknown> | null' is not assignable to type 'WeakKey'.

71   ? WeakSet<DeepNullable<U>>
               ~~~~~~~~~~~~~~~

node_modules/ts-essentials/dist/types.d.ts:91:13 - error TS2344: Type 'DeepUndefinable<K>' does not satisfy the constraint 'WeakKey'.
  Type 'symbol | object | (Builtin & object) | Map<unknown, unknown> | WeakMap<symbol | object | undefined, unknown> | Set<unknown> | WeakSet<symbol | object | undefined> | unknown[] | Promise<...> | undefined' is not assignable to type 'WeakKey'.
    Type 'undefined' is not assignable to type 'WeakKey'.

91   ? WeakMap<DeepUndefinable<K>, DeepUndefinable<V>>
               ~~~~~~~~~~~~~~~~~~

node_modules/ts-essentials/dist/types.d.ts:95:13 - error TS2344: Type 'DeepUndefinable<U>' does not satisfy the constraint 'WeakKey'.
  Type 'symbol | object | (Builtin & object) | Map<unknown, unknown> | WeakMap<symbol | object | undefined, unknown> | Set<unknown> | WeakSet<symbol | object | undefined> | unknown[] | Promise<...> | undefined' is not assignable to type 'WeakKey'.

95   ? WeakSet<DeepUndefinable<U>>
image
@Beraliv
Copy link
Contributor

Beraliv commented Apr 6, 2024

Hey @zervant-konstantin!

First of all, sorry for this inconvenience!

I've released ts-essentials@9.4.2 with TypeScript 5.3 and 5.4 support and now it is expected to be working.

Kindly ask to verify it on your side and come back to me should something doesn't work on your side

@kpachbiu88
Copy link

Hey @zervant-konstantin!

First of all, sorry for this inconvenience!

I've released ts-essentials@9.4.2 with TypeScript 5.3 and 5.4 support and now it is expected to be working.

Kindly ask to verify it on your side and come back to me should something doesn't work on your side

Thank you, for fast solution!

@timdavish
Copy link
Contributor

Adding a comment just in case the above doesn't notify ^^

See #131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants