/** * A value native can store directly inside an object. * * A `Set` or `Set` (of finite numbers) is converted to an array; an empty or * mixed-type `Set`, like an empty array, is dropped. Readonly collections are accepted because the * serializer only reads them. */ export type InsiderObjectLeaf = | string | number | boolean | Date | readonly string[] | readonly number[] | ReadonlySet | ReadonlySet; /** * The one nesting level native stores: a nested value may hold leaves but not another object. * Named and exported so a nested object can be held in a variable and passed in, not only written * inline - `InsiderObject` itself is wider and does not fit here. */ export type InsiderNestedObject = { readonly [key: string]: InsiderObjectLeaf | undefined }; /** * One nesting level only: native stores an object inside an object, and drops anything deeper. * `undefined` is accepted so an optional property can be passed straight through; it is skipped at * runtime. */ export type InsiderObjectValue = InsiderObjectLeaf | InsiderNestedObject | undefined; /** * Keys must match `^[a-z][0-9a-z_]*$` — lowercase, starting with a letter, `_` as the only * separator. A camelCase key is dropped by native at every nesting level, and a string value over * 500 characters is dropped with the key that carries it. */ export type InsiderObject = { readonly [key: string]: InsiderObjectValue };