import "./symbol.shim.js"; import { Schema } from './Schema.js'; import { ArraySchema } from './types/custom/ArraySchema.js'; import { MapSchema } from './types/custom/MapSchema.js'; import { TypeDefinition } from "./types/registry.js"; import { OPERATION } from "./encoding/spec.js"; import type { InferValueType, InferSchemaInstanceType, AssignableProps } from "./types/HelperTypes.js"; import { CollectionSchema } from "./types/custom/CollectionSchema.js"; import { SetSchema } from "./types/custom/SetSchema.js"; export type RawPrimitiveType = "string" | "number" | "boolean" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "int64" | "uint64" | "float32" | "float64" | "bigint64" | "biguint64"; export type PrimitiveType = RawPrimitiveType | typeof Schema | object; export type DefinitionType = T | T[] | { type: T; default?: InferValueType; view?: boolean | number; sync?: boolean; } | { array: T; default?: ArraySchema>; view?: boolean | number; sync?: boolean; } | { map: T; default?: MapSchema>; view?: boolean | number; sync?: boolean; } | { collection: T; default?: CollectionSchema>; view?: boolean | number; sync?: boolean; } | { set: T; default?: SetSchema>; view?: boolean | number; sync?: boolean; }; export type Definition = { [field: string]: DefinitionType; }; export interface TypeOptions { manual?: boolean; } export declare const DEFAULT_VIEW_TAG = -1; export declare function entity(constructor: any): any; /** * [See documentation](https://docs.colyseus.io/state/schema/) * * Annotate a Schema property to be serializeable. * \@type()'d fields are automatically flagged as "dirty" for the next patch. * * @example Standard usage, with automatic change tracking. * ``` * \@type("string") propertyName: string; * ``` * * @example You can provide the "manual" option if you'd like to manually control your patches via .setDirty(). * ``` * \@type("string", { manual: true }) * ``` */ export declare function view(tag?: number): (target: T, fieldName: string) => void; export declare function unreliable(target: T, field: string): void; export declare function type(type: DefinitionType, options?: TypeOptions): PropertyDecorator; export declare function getPropertyDescriptor(fieldCached: string, fieldIndex: number, type: DefinitionType, complexTypeKlass: TypeDefinition): { get: (this: Schema) => number | ((index: number) => any) | ((index: number) => void) | (() => Schema) | (>>(props: AssignableProps) => Schema) | ((jsonData: import("./index.js").ToJSON>) => Schema) | ((property: number | K, operation?: OPERATION) => void) | ((this: any) => import("./index.js").ToJSON>) | (() => void); set: (this: Schema, value: any) => void; enumerable: boolean; configurable: boolean; }; /** * `@deprecated()` flag a field as deprecated. * The previous `@type()` annotation should remain along with this one. */ export declare function deprecated(throws?: boolean): PropertyDecorator; export declare function defineTypes(target: typeof Schema, fields: Definition, options?: TypeOptions): typeof Schema; type ExtractInitProps = T extends { initialize: (...args: infer P) => void; } ? P extends readonly [] ? never : P extends readonly [infer First] ? First extends object ? First : P : P : T extends Definition ? AssignableProps> : never; type IsInitPropsRequired = T extends { initialize: (props: any) => void; } ? true : T extends { initialize: (...args: infer P) => void; } ? P extends readonly [] ? false : true : false; export interface SchemaWithExtends { extends: (fields: T2 & ThisType>, name?: string) => SchemaWithExtendsConstructor, P>; } /** * Get the type of the schema defined via `schema({...})` method. * * @example * const Entity = schema({ * x: "number", * y: "number", * }); * type Entity = SchemaType; */ export type SchemaType = T['~type']; export interface SchemaWithExtendsConstructor extends SchemaWithExtends { '~type': InferSchemaInstanceType; new (...args: [InitProps] extends [never] ? [] : InitProps extends readonly any[] ? InitProps : IsInitPropsRequired extends true ? [InitProps] : [InitProps?]): InferSchemaInstanceType & InstanceType

; prototype: InferSchemaInstanceType & InstanceType

& { initialize(...args: [InitProps] extends [never] ? [] : InitProps extends readonly any[] ? InitProps : [InitProps]): void; }; } export declare function schema, P extends typeof Schema = typeof Schema>(fieldsAndMethods: T & ThisType>, name?: string, inherits?: P): SchemaWithExtendsConstructor, P>; export {};