Skip to content

Conversation

@antfu
Copy link
Member

@antfu antfu commented Nov 22, 2020

No description provided.

* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
export function readonly<T extends object>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if is worth to have readonly if it's the same as shallowReadonly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for the API alignment with Vue 3, lowing the difference between them. Thinking import { readonly } from 'vue-demi will work for Vue 3 but failed on Vue 2. This implementation acts like a noop but providing the type-level checking as the same as Vue 3. Should be good enough for users using TypeScript.

@antfu antfu requested a review from pikax December 3, 2020 02:41
@antfu antfu merged commit 3b726d4 into vuejs:master Dec 7, 2020
@antfu antfu deleted the feat/readonly branch December 7, 2020 13:44
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.

2 participants