object-shape-tester
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -35,4 +35,4 @@ import { ArrayElement, AtLeastTuple } from '@augment-vir/common'; | ||
export type ShapeUnknown<Parts extends Readonly<[]>> = ShapeSpecifier<Parts, typeof unknownSymbol>; | ||
type ExpandParts<Parts extends BaseParts, IsExact extends boolean> = Extract<ArrayElement<Parts>, ShapeDefinition<any>> extends never ? SpecifierToRunTimeType<ArrayElement<Parts>, IsExact> : Exclude<ArrayElement<Parts>, ShapeDefinition<any>> | ShapeToRunTimeType<Extract<ArrayElement<Parts>, ShapeDefinition<any>>['shape']>; | ||
export type SpecifierToRunTimeType<PossiblySpecifier, IsExact extends boolean = false> = PossiblySpecifier extends ShapeSpecifier<infer Parts, infer Type> ? Type extends typeof andSymbol ? UnionToIntersection<ExpandParts<Parts, IsExact>> : Type extends typeof orSymbol ? ExpandParts<Parts, IsExact> : Type extends typeof exactSymbol ? WritableDeep<ExpandParts<Parts, true>> : Type extends typeof enumSymbol ? WritableDeep<Parts[0][keyof Parts[0]]> : Type extends typeof unknownSymbol ? unknown : 'TypeError: found not match for shape specifier type.' : PossiblySpecifier extends Primitive ? IsExact extends true ? PossiblySpecifier : LiteralToPrimitive<PossiblySpecifier> : PossiblySpecifier extends object ? { | ||
type ExpandParts<Parts extends BaseParts, IsExact extends boolean> = Extract<ArrayElement<Parts>, ShapeDefinition<any>> extends never ? SpecifierToRunTimeType<ArrayElement<Parts>, IsExact> : SpecifierToRunTimeType<Exclude<ArrayElement<Parts>, ShapeDefinition<any>>, IsExact> | Extract<ArrayElement<Parts>, ShapeDefinition<any>>['runTimeType']; | ||
export type SpecifierToRunTimeType<PossiblySpecifier, IsExact extends boolean = false> = PossiblySpecifier extends ShapeSpecifier<infer Parts, infer Type> ? Type extends typeof andSymbol ? UnionToIntersection<ExpandParts<Parts, IsExact>> : Type extends typeof orSymbol ? ExpandParts<Parts, IsExact> : Type extends typeof exactSymbol ? WritableDeep<ExpandParts<Parts, true>> : Type extends typeof enumSymbol ? WritableDeep<Parts[0][keyof Parts[0]]> : Type extends typeof unknownSymbol ? unknown : 'TypeError: found not match for shape specifier type.' : PossiblySpecifier extends Primitive ? IsExact extends true ? PossiblySpecifier : LiteralToPrimitive<PossiblySpecifier> : PossiblySpecifier extends object ? PossiblySpecifier extends ShapeDefinition<any> ? PossiblySpecifier['runTimeType'] : { | ||
[Prop in keyof PossiblySpecifier]: SpecifierToRunTimeType<PossiblySpecifier[Prop], IsExact>; | ||
@@ -39,0 +39,0 @@ } : PossiblySpecifier; |
{ | ||
"name": "object-shape-tester", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Test object properties and value types.", | ||
@@ -30,3 +30,3 @@ "keywords": [], | ||
"test": "virmator test-web", | ||
"test:all": "concurrently \"npm run test:types\" \"npm run test:coverage\" \"npm run test:spelling\" \"npm run test:format\" \"npm run test:docs\"", | ||
"test:all": "concurrently --kill-others-on-fail --colors -c auto --names types,tests,spelling,format,docs \"npm run test:types\" \"npm run test:coverage\" \"npm run test:spelling\" \"npm run test:format\" \"npm run test:docs\"", | ||
"test:coverage": "npm run test coverage", | ||
@@ -52,3 +52,3 @@ "test:docs": "virmator code-in-markdown check", | ||
"@web/test-runner-visual-regression": "^0.8.0", | ||
"concurrently": "^8.0.1", | ||
"concurrently": "^8.1.0", | ||
"cspell": "^6.31.1", | ||
@@ -67,2 +67,3 @@ "esbuild": "^0.17.19", | ||
"prettier-plugin-toml": "^0.3.1", | ||
"typescript": "^5.1.3", | ||
"virmator": "^6.6.1", | ||
@@ -69,0 +70,0 @@ "vite": "^4.3.9", |
52286
27