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

ReadonlyDeep / WritableDeep not modifying arrays as of TS 5.3.3 #833

Closed
trevorade opened this issue Mar 14, 2024 · 3 comments · Fixed by #839
Closed

ReadonlyDeep / WritableDeep not modifying arrays as of TS 5.3.3 #833

trevorade opened this issue Mar 14, 2024 · 3 comments · Fixed by #839

Comments

@trevorade
Copy link
Contributor

trevorade commented Mar 14, 2024

See a repro of the issue for ReadonlyDeep in this TS Playground (change the version to 5.2.2 to see the older correct behavior)

This is verified in the test here (though failing to fail as it should):

expectType<readonly boolean[]>(readonlyData.namespace.baz);

WritableDeep exhibits the same issue.

I suspect that the typing system is behaving differently in tsd than the raw tsc leading to this issue not being detected. Not sure why...

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
@gloomweaver
Copy link

The issue here is HasMultipleCallSignatures
In 5.2.2 it returned false for Namespace, in current it returns true
You can actually break it 5.2.2 if you provide additional signature in the type

Tried this
HasMultipleCallSignatures<T> extends true ? T & ReadonlyObjectDeep<T> : ((...arguments_: Parameters<T>) => ReturnType<T>) & ReadonlyObjectDeep<T>
But then type of baz is boolean[] & readonly boolean[]
Didn't find a way to pick only signatures from T

@voxpelli
Copy link
Collaborator

@trevorade I think the issue is that this repo is using an outdated version of tsd and since tsd ships with its own version of typescript this isn't discovered by it. When updating tsd it does error on this: #839

Hence why we probably should move away from tsd as we talked about in #837

@mrazauskas
Copy link

I was looking at the issue with ReadonlyDeep. Bisecting tells that the first bad commit is microsoft/TypeScript#54448. Hope that helps.

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