@nmtjs/type
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -7,7 +7,7 @@ import { NativeEnum } from "../schemas/native-enum.js"; | ||
constructor(values, options = {}, isNullable = false, isOptional = false, hasDefault = false){ | ||
super(options, isNullable, isOptional, hasDefault); | ||
super(options, isNullable, isOptional, hasDefault, values); | ||
this.values = values; | ||
} | ||
_constructSchema(options) { | ||
return NativeEnum(this.values, options); | ||
_constructSchema(options, values) { | ||
return NativeEnum(values, options); | ||
} | ||
@@ -14,0 +14,0 @@ nullable() { |
@@ -6,7 +6,7 @@ import { Type } from '@sinclair/typebox'; | ||
constructor(types, options = {}, isNullable = false, isOptional = false, hasDefault = false){ | ||
super(options, isNullable, isOptional, hasDefault); | ||
super(options, isNullable, isOptional, hasDefault, types); | ||
this.types = types; | ||
} | ||
_constructSchema(options) { | ||
return Type.Union(this.types.map(getTypeSchema), options); | ||
_constructSchema(options, types) { | ||
return Type.Union(types.map(getTypeSchema), options); | ||
} | ||
@@ -55,7 +55,7 @@ nullable() { | ||
constructor(types, options = {}, isNullable = false, isOptional = false, hasDefault = false){ | ||
super(options, isNullable, isOptional, hasDefault); | ||
super(options, isNullable, isOptional, hasDefault, types); | ||
this.types = types; | ||
} | ||
_constructSchema(options) { | ||
return Type.Intersect(this.types.map(getTypeSchema), options); | ||
_constructSchema(options, types) { | ||
return Type.Intersect(types.map(getTypeSchema), options); | ||
} | ||
@@ -62,0 +62,0 @@ nullable() { |
@@ -24,3 +24,3 @@ { | ||
"temporal-polyfill": "^0.2.5", | ||
"@nmtjs/common": "0.3.7" | ||
"@nmtjs/common": "0.3.8" | ||
}, | ||
@@ -30,3 +30,3 @@ "devDependencies": { | ||
"temporal-polyfill": "^0.2.5", | ||
"@nmtjs/common": "0.3.7" | ||
"@nmtjs/common": "0.3.8" | ||
}, | ||
@@ -40,3 +40,3 @@ "files": [ | ||
], | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"scripts": { | ||
@@ -43,0 +43,0 @@ "build": "neemata-build -p neutral --root=./src './**/*.ts'", |
@@ -16,3 +16,3 @@ import type { SchemaOptions } from '@sinclair/typebox' | ||
constructor( | ||
readonly values: T, | ||
protected readonly values: T, | ||
options: SchemaOptions = {}, | ||
@@ -23,7 +23,10 @@ isNullable: N = false as N, | ||
) { | ||
super(options, isNullable, isOptional, hasDefault) | ||
super(options, isNullable, isOptional, hasDefault, values) | ||
} | ||
protected _constructSchema(options: SchemaOptions): TNativeEnum<T> { | ||
return NativeEnum(this.values, options) | ||
protected _constructSchema( | ||
options: SchemaOptions, | ||
values: T, | ||
): TNativeEnum<T> { | ||
return NativeEnum(values, options) | ||
} | ||
@@ -30,0 +33,0 @@ |
@@ -35,3 +35,3 @@ import { | ||
constructor( | ||
readonly types: T, | ||
protected readonly types: T, | ||
options: SchemaOptions = {}, | ||
@@ -42,3 +42,3 @@ isNullable: N = false as N, | ||
) { | ||
super(options, isNullable, isOptional, hasDefault) | ||
super(options, isNullable, isOptional, hasDefault, types) | ||
} | ||
@@ -48,5 +48,6 @@ | ||
options: SchemaOptions, | ||
types: T, | ||
//@ts-expect-error | ||
): TUnion<UnionToTuple<T[number][typeStatic]['schema']>> { | ||
return Type.Union(this.types.map(getTypeSchema), options) as any | ||
return Type.Union(types.map(getTypeSchema), options) as any | ||
} | ||
@@ -107,3 +108,3 @@ | ||
constructor( | ||
readonly types: T, | ||
protected readonly types: T, | ||
options: SchemaOptions = {}, | ||
@@ -114,3 +115,3 @@ isNullable: N = false as N, | ||
) { | ||
super(options, isNullable, isOptional, hasDefault) | ||
super(options, isNullable, isOptional, hasDefault, types) | ||
} | ||
@@ -120,5 +121,6 @@ | ||
options: SchemaOptions, | ||
types: T, | ||
// @ts-expect-error | ||
): TIntersect<UnionToTuple<T[number][typeStatic]['schema']>> { | ||
return Type.Intersect(this.types.map(getTypeSchema), options) as any | ||
return Type.Intersect(types.map(getTypeSchema), options) as any | ||
} | ||
@@ -125,0 +127,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
232248
3841