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

types(reactivity): support DeepReadonly type #1462

Merged
merged 16 commits into from
Jul 15, 2020
Merged

types(reactivity): support DeepReadonly type #1462

merged 16 commits into from
Jul 15, 2020

Conversation

Picknight
Copy link
Contributor

fix #1452

@yyx990803
Copy link
Member

Thanks for the PR! Could you please add a test case in test-dts? (For test format, consult other files in that directory)

@Picknight
Copy link
Contributor Author

Sure.

@Picknight
Copy link
Contributor Author

Done. @yyx990803

@jacekkarczmarczyk
Copy link
Contributor

this looks like a breaking change?

@Picknight
Copy link
Contributor Author

this looks like a breaking change?

This is not a new feature, it just improves type checking.

@jacekkarczmarczyk
Copy link
Contributor

As far as i understand before this PR you could do

r.obj.k = 'x'

and now you can't

How can I now create shallow readonly variable so that

r.obj = {}; // should fail
r.obj.k = 'x'; // should work

?

This is not a new feature

Maybe it should a new feature? Or is shallow readonly considered to be a feature that nobody needs?

@Picknight
Copy link
Contributor Author

  1. Before this PR, if you execute r.obj.k = 'x', actually it will not take effect. Now we have completed the type checking to avoid unnecessary troubles for developers.
  2. For shallow readonly variable, you can use shallowReadonly. @jacekkarczmarczyk

@jacekkarczmarczyk
Copy link
Contributor

Before this PR, if you execute r.obj.k = 'x', actually it will not take effect.

Ah I see, that makes perfectly sense

@yyx990803 yyx990803 merged commit b772bba into vuejs:master Jul 15, 2020
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 this pull request may close these issues.

DeepReadonly type
3 participants