pull/10268/head
Simon Holthausen 3 years ago
parent 5e9937013b
commit 241fc6ea15

@ -320,7 +320,9 @@ export function readonly(value) {
) { ) {
const proxy = new Proxy( const proxy = new Proxy(
value, value,
/** @type {ProxyHandler<import('./types.js').ProxyReadonlyObject<U>>} */ (readonly_handler) /** @type {ProxyHandler<import('./types.js').ProxyReadonlyObject<U>>} */ (
readonly_proxy_handler
)
); );
define_property(value, READONLY_SYMBOL, { value: proxy, writable: false }); define_property(value, READONLY_SYMBOL, { value: proxy, writable: false });
return proxy; return proxy;
@ -341,7 +343,7 @@ const readonly_error = (_, prop) => {
}; };
/** @type {ProxyHandler<import('./types.js').ProxyReadonlyObject>} */ /** @type {ProxyHandler<import('./types.js').ProxyReadonlyObject>} */
const readonly_handler = { const readonly_proxy_handler = {
defineProperty: readonly_error, defineProperty: readonly_error,
deleteProperty: readonly_error, deleteProperty: readonly_error,
set: readonly_error, set: readonly_error,

@ -402,7 +402,7 @@ export type TaskEntry = { c: TaskCallback; f: () => void };
export interface ProxyMetadata<T = Record<string | symbol, any>> { export interface ProxyMetadata<T = Record<string | symbol, any>> {
/** A map of signals associated to the properties that are reactive */ /** A map of signals associated to the properties that are reactive */
s: Map<string | symbol, SourceSignal<any>>; s: Map<string | symbol, SourceSignal<any>>;
/** A version counter, used within the proxy to signal changes in places where there's no other way to signal and update */ /** A version counter, used within the proxy to signal changes in places where there's no other way to signal an update */
v: SourceSignal<number>; v: SourceSignal<number>;
/** `true` if the proxified object is an array */ /** `true` if the proxified object is an array */
a: boolean; a: boolean;

Loading…
Cancel
Save