-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
Description
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>>;