Skip to content

Commit

Permalink
feat(validator): simplify literal number match expression by `OnlySub…
Browse files Browse the repository at this point in the history
…Type`
  • Loading branch information
NWYLZW committed Feb 27, 2024
1 parent ad53ea4 commit 8772432
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/validator/src/types/primitive.number.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IsEqual, IsWhat, Not, t as tn } from '@typp/core'
import type { IsEqual, IsWhat, OnlySubType, t as tn } from '@typp/core'

import { FALSY } from '../base'
import type { SwitchBaseType } from '../base.inner'
Expand All @@ -11,10 +11,7 @@ declare module '@typp/core' {
IsWhat<T, number>, number | Number
]
'literal:number': [
Not<IsWhat<T, number>> extends true
? T extends number ? true : false
: false,
T & number
OnlySubType<T, number>, T & number
]
}
export interface ValidateTransformEntries<T, Input, InputRest> {
Expand Down

0 comments on commit 8772432

Please sign in to comment.