Skip to content

Commit cc9159b

Browse files
committed
🎉 feat: 1.4.27
1 parent e9d6b17 commit cc9159b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ export default class Elysia<
417417

418418
'~adapter': ElysiaAdapter
419419

420-
env(model: TObject<any>, _env = env) {
420+
env(model: TObject, _env = env) {
421421
const validator = getSchemaValidator(model, {
422422
modules: this.definitions.typebox,
423423
dynamic: true,

src/schema.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import type {
2626
AnySchema,
2727
ElysiaConfig,
2828
InputSchema,
29+
IsAny,
2930
MaybeArray,
3031
StandaloneInputSchema,
3132
StandardSchemaV1LikeValidate,
@@ -47,7 +48,7 @@ export interface ElysiaTypeCheck<T extends AnySchema>
4748
schema: T
4849
config: Object
4950
Check(value: unknown): T extends TSchema
50-
? UnwrapSchema<T>
51+
? boolean
5152
:
5253
| {
5354
value: UnwrapSchema<T>
@@ -432,9 +433,11 @@ export const getSchemaValidator = <T extends AnySchema | string | undefined>(
432433
validators?: InputSchema['body'][]
433434
sanitize?: () => ExactMirrorInstruction['sanitize']
434435
} = {}
435-
): undefined extends T
436-
? undefined
437-
: ElysiaTypeCheck<NonNullable<Exclude<T, string>>> => {
436+
): IsAny<T> extends true
437+
? ElysiaTypeCheck<TAnySchema>
438+
: undefined extends T
439+
? undefined
440+
: ElysiaTypeCheck<NonNullable<Exclude<T, string>>> => {
438441
validators = validators?.filter((x) => x)
439442

440443
if (!s) {
@@ -782,10 +785,10 @@ export const getSchemaValidator = <T extends AnySchema | string | undefined>(
782785
const validator: ElysiaTypeCheck<any> = {
783786
provider: 'typebox',
784787
schema,
788+
// @ts-ignore
785789
references: '',
786790
checkFunc: () => {},
787791
code: '',
788-
// @ts-expect-error
789792
Check: (value: unknown) => Value.Check(schema, value),
790793
Errors: (value: unknown) => Value.Errors(schema, value),
791794
Code: () => '',

0 commit comments

Comments
 (0)