import { Scope } from './scope'; import { NonNeverType, StructDescriptor, StructInstanceType } from './types'; /** * This function creates an instance of a struct and checks that the fields are valid. * * ### Examples: * * ```ts * const pointDesc = new StructDescriptor('Point', [ * new StructField('x', NumberType.instance), * new StructField('y', NumberType.instance), * new StructField('z', NumberType.instance), * ]); * * // create the default instance * createInstance(pointDesc); * * // create an instance with named fields * // (this can include only a subset of the fields) * createInstance(pointDesc, { * x: literal(1), * y: literal(2), * }); * createInstance(pointDesc, { * x: literal(1), * y: literal(2), * z: literal(3), * }); * * // create an instance with the given field array * // (this has to include all fields in the correct order) * createInstance(pointDesc, [ * literal(1), * literal(2), * literal(3), * ]); * ``` */ export declare const createInstance: (descriptor: StructDescriptor, fields?: Partial>> | readonly NonNeverType[]) => StructInstanceType; /** * Returns the struct descriptor with the given name in the given scope. If no such struct exists, * an error is thrown. * * Use `Scope.has` to check if a struct exists. */ export declare const getStructDescriptor: (scope: Scope, name: string) => StructDescriptor;