MCPcopy
hub / github.com/Effect-TS/effect / TypeLiteralClass

Class TypeLiteralClass

packages/effect/src/Schema.ts:2871–2904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2869 ast: AST.AST = getDefaultTypeLiteralAST(fields, records)
2870): TypeLiteral<Fields, Records> {
2871 return class TypeLiteralClass extends make<
2872 Simplify<TypeLiteral.Type<Fields, Records>>,
2873 Simplify<TypeLiteral.Encoded<Fields, Records>>,
2874 | Struct.Context<Fields>
2875 | IndexSignature.Context<Records>
2876 >(ast) {
2877 static override annotations(
2878 annotations: Annotations.Schema<Simplify<TypeLiteral.Type<Fields, Records>>>
2879 ): TypeLiteral<Fields, Records> {
2880 return makeTypeLiteralClass(this.fields, this.records, mergeSchemaAnnotations(this.ast, annotations))
2881 }
2882
2883 static fields = { ...fields }
2884
2885 static records = [...records] as Records
2886
2887 static make = (
2888 props: Simplify<TypeLiteral.Constructor<Fields, Records>>,
2889 options?: MakeOptions
2890 ): Simplify<TypeLiteral.Type<Fields, Records>> => {
2891 const propsWithDefaults: any = lazilyMergeDefaults(fields, { ...props as any })
2892 return getDisableValidationMakeOption(options)
2893 ? propsWithDefaults
2894 : ParseResult.validateSync(this)(propsWithDefaults)
2895 }
2896
2897 static pick(...keys: Array<keyof Fields>): Struct<Simplify<Pick<Fields, typeof keys[number]>>> {
2898 return Struct(struct_.pick(fields, ...keys) as any)
2899 }
2900
2901 static omit(...keys: Array<keyof Fields>): Struct<Simplify<Omit<Fields, typeof keys[number]>>> {
2902 return Struct(struct_.omit(fields, ...keys) as any)
2903 }
2904 }
2905}
2906
2907/**

Callers

nothing calls this directly

Calls 2

lazilyMergeDefaultsFunction · 0.85
makeFunction · 0.70

Tested by

no test coverage detected