1export enum ReactiveFlags {
2 SKIP = '__v_skip',
3 IS_REACTIVE = '__v_isReactive',
4 IS_READONLY = '__v_isReadonly',
5 IS_SHALLOW = '__v_isShallow',
6 RAW = '__v_raw',
7}
8
9
10 * Checks whether the passed value is a readonly object. The properties of a
11 * readonly object can change, but they can't be assigned directly via the
12 * passed object.
13 *
14 * The proxies created by {@link readonly()} and {@link shallowReadonly()} are
15 * both considered readonly, as is a computed ref without a set function.
16 *
17 * @param value - The value to check.
18 * @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
19 */
20export function isReadonly(value: unknown): boolean {
21 return !!(value && (value as Target)[ReactiveFlags.IS_READONLY])
22}