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

DeepReadonly type #1452

Closed
stefnotch opened this issue Jun 26, 2020 · 0 comments · Fixed by #1462
Closed

DeepReadonly type #1452

stefnotch opened this issue Jun 26, 2020 · 0 comments · Fixed by #1462

Comments

@stefnotch
Copy link

What problem does this feature solve?

Currently, readonly({}) uses the Readonly<> type. This makes all properties readonly. However, it should also affect nested properties.

any nested property accessed will be readonly as well
-- https://vue-composition-api-rfc.netlify.app/api.html#readonly

So, I suggest adding a DeepReadonly type like the one in ts-essentials and using it for the readonly({}) function. This would result in Typescript being able to catch more errors at compile time.

What does the proposed API look like?

export type DeepReadonly<T> = ...;

export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
@stefnotch stefnotch changed the title DeepReadonly DeepReadonly type Jun 26, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants