@nmtjs/contract
Advanced tools
Comparing version 0.0.1 to 0.0.2
import { Type } from '@sinclair/typebox/type'; | ||
export const Nullable = (schema)=>Type.Union([ | ||
export const Nullable = (schema, options = {})=>Type.Union([ | ||
schema, | ||
Type.Null() | ||
]); | ||
], options); |
@@ -23,7 +23,7 @@ { | ||
"@sinclair/typebox": "^0.32.34", | ||
"@nmtjs/common": "0.0.1" | ||
"@nmtjs/common": "0.0.2" | ||
}, | ||
"devDependencies": { | ||
"@sinclair/typebox": "^0.32.34", | ||
"@nmtjs/common": "0.0.1" | ||
"@nmtjs/common": "0.0.2" | ||
}, | ||
@@ -37,3 +37,3 @@ "files": [ | ||
], | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"scripts": { | ||
@@ -40,0 +40,0 @@ "build": "neemata-build -p neutral --root=./src './**/*.ts'", |
@@ -9,6 +9,2 @@ import { | ||
export const NativeEnumKind = 'NativeEnum' | ||
// ------------------------------------------------------------------------------------- | ||
// TNativeEnum | ||
// ------------------------------------------------------------------------------------- | ||
export interface TNativeEnum<T extends Record<string, string>> extends TSchema { | ||
@@ -20,6 +16,2 @@ [Kind]: typeof NativeEnumKind | ||
// ------------------------------------------------------------------------------------- | ||
// NativeEnum | ||
// ------------------------------------------------------------------------------------- | ||
/** `[Experimental]` Creates a Union type with a `enum` schema representation */ | ||
export function NativeEnum<T extends Record<string, string>>( | ||
@@ -26,0 +18,0 @@ value: T, |
@@ -1,4 +0,6 @@ | ||
import { type TSchema, Type } from '@sinclair/typebox/type' | ||
import { type SchemaOptions, type TSchema, Type } from '@sinclair/typebox/type' | ||
export const Nullable = <T extends TSchema>(schema: T) => | ||
Type.Union([schema, Type.Null()]) | ||
export const Nullable = <T extends TSchema>( | ||
schema: T, | ||
options: SchemaOptions = {}, | ||
) => Type.Union([schema, Type.Null()], options) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
92570
1177