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

[4.8.0] type error on jsonify #758

Closed
AviVahl opened this issue Nov 17, 2023 · 5 comments
Closed

[4.8.0] type error on jsonify #758

AviVahl opened this issue Nov 17, 2023 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@AviVahl
Copy link

AviVahl commented Nov 17, 2023

with the new version, I get:

ode_modules/type-fest/source/jsonify.d.ts:122:28 - error TS2344: Type 'WritableDeep<T>' does not satisfy the constraint 'unknown[]'.
  Type 'T | (T extends (...arguments_: any[]) => unknown ? {} extends WritableObjectDeep<((...arguments_: any[]) => unknown) & T> ? ((...arguments_: any[]) => unknown) & T : HasMultipleCallSignatures<((...arguments_: any[]) => unknown) & T> extends true ? ((...arguments_: any[]) => unknown) & T : ((...arguments_: Parameters...' is not assignable to type 'unknown[]'.
    Type 'readonly unknown[] & T' is not assignable to type 'unknown[]'.
      The type 'readonly unknown[]' is 'readonly' and cannot be assigned to the mutable type 'unknown[]'.

122              ? JsonifyList<WritableDeep<T>>
                               ~~~~~~~~~~~~~~~

changing:
type JsonifyList<T extends unknown[]>
to:
type JsonifyList<T extends readonly unknown[]>

fixes the issue.

saw this in https://github.com/wixplosives/file-services when I've upgraded to type-fest@4.8.0

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@AviVahl
Copy link
Author

AviVahl commented Nov 17, 2023

can also be seen in a dependabot PR: wixplosives/resolve-directory-context#288

@sindresorhus
Copy link
Owner

Fixed: https://github.com/sindresorhus/type-fest/releases/tag/v4.8.1

@sindresorhus
Copy link
Owner

@Emiyaaaaa Would be great if you could add a test for this.

@Emiyaaaaa
Copy link
Collaborator

Emiyaaaaa commented Nov 17, 2023

@Emiyaaaaa Would be great if you could add a test for this.

ok, but look like typescript think WritableDeep<T> can return readonly unknown[]?

@sindresorhus
Copy link
Owner

@Emiyaaaaa Yeah, it probably needs a better fix too. It should not return readonly unknown[]. I just pushed out a quick fix to fix the breakage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants