Skip to content

Commit

Permalink
feat(core): add IsSpecialShape type-level function to check shape whe…
Browse files Browse the repository at this point in the history
…ther special shape
  • Loading branch information
NWYLZW committed Mar 22, 2024
1 parent a08f24e commit 8be29be
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/core/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ export namespace t {
if (!s.shape.type) return false
return s.shape.type === t.specialShapeTypeMapping[type]
}
export type IsSpecialShape<
Shape,
K extends keyof t.SpecialShapeTypeMapping,
T extends t.SpecialShapeTypeMapping[K] = t.SpecialShapeTypeMapping[K]
> = Shape extends SpecialShape<T, SpecialShapeSchemaMapping[T]> ? true : false
}
// Base
/* istanbul ignore next -- @preserve */
Expand Down

0 comments on commit 8be29be

Please sign in to comment.