ts-pattern
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -54,4 +54,4 @@ /** | ||
*/ | ||
export declare type Pattern<a> = GuardPattern<a> | NotPattern<a | any> | SpecialPattern<a> | (a extends Primitives ? a : a extends [infer b, infer c, infer d, infer e, infer f] ? [Pattern<b>, Pattern<c>, Pattern<d>, Pattern<e>, Pattern<f>] : a extends [infer b, infer c, infer d, infer e] ? [Pattern<b>, Pattern<c>, Pattern<d>, Pattern<e>] : a extends [infer b, infer c, infer d] ? [Pattern<b>, Pattern<c>, Pattern<d>] : a extends [infer b, infer c] ? [Pattern<b>, Pattern<c>] : a extends (infer b)[] ? Pattern<b>[] : a extends Map<infer k, infer v> ? Map<k, Pattern<v>> : a extends Set<infer v> ? Set<Pattern<v>> : a extends object ? { | ||
[k in keyof a]?: Pattern<a[k]>; | ||
export declare type Pattern<a> = GuardPattern<a> | NotPattern<a | any> | SpecialPattern<a> | (a extends Primitives ? a : a extends [infer b, infer c, infer d, infer e, infer f] ? readonly [Pattern<b>, Pattern<c>, Pattern<d>, Pattern<e>, Pattern<f>] : a extends [infer b, infer c, infer d, infer e] ? readonly [Pattern<b>, Pattern<c>, Pattern<d>, Pattern<e>] : a extends [infer b, infer c, infer d] ? readonly [Pattern<b>, Pattern<c>, Pattern<d>] : a extends [infer b, infer c] ? readonly [Pattern<b>, Pattern<c>] : a extends (infer b)[] ? readonly Pattern<b>[] : a extends Map<infer k, infer v> ? Map<k, Pattern<v>> : a extends Set<infer v> ? Set<Pattern<v>> : a extends object ? { | ||
readonly [k in keyof a]?: Pattern<a[k]>; | ||
} : a); | ||
@@ -66,3 +66,3 @@ /** | ||
value: InvertPattern<pb>; | ||
} : p extends Primitives ? p : p extends [infer pb, infer pc, infer pd, infer pe, infer pf] ? [InvertPattern<pb>, InvertPattern<pc>, InvertPattern<pd>, InvertPattern<pe>, InvertPattern<pf>] : p extends [infer pb, infer pc, infer pd, infer pe] ? [InvertPattern<pb>, InvertPattern<pc>, InvertPattern<pd>, InvertPattern<pe>] : p extends [infer pb, infer pc, infer pd] ? [InvertPattern<pb>, InvertPattern<pc>, InvertPattern<pd>] : p extends [infer pb, infer pc] ? [InvertPattern<pb>, InvertPattern<pc>] : p extends (infer pp)[] ? InvertPattern<pp>[] : p extends Map<infer pk, infer pv> ? Map<pk, InvertPattern<pv>> : p extends Set<infer pv> ? Set<InvertPattern<pv>> : p extends object ? { | ||
} : p extends Primitives ? p : p extends readonly [infer pb, infer pc, infer pd, infer pe, infer pf] ? [InvertPattern<pb>, InvertPattern<pc>, InvertPattern<pd>, InvertPattern<pe>, InvertPattern<pf>] : p extends readonly [infer pb, infer pc, infer pd, infer pe] ? [InvertPattern<pb>, InvertPattern<pc>, InvertPattern<pd>, InvertPattern<pe>] : p extends readonly [infer pb, infer pc, infer pd] ? [InvertPattern<pb>, InvertPattern<pc>, InvertPattern<pd>] : p extends readonly [infer pb, infer pc] ? [InvertPattern<pb>, InvertPattern<pc>] : p extends readonly (infer pp)[] ? InvertPattern<pp>[] : p extends Map<infer pk, infer pv> ? Map<pk, InvertPattern<pv>> : p extends Set<infer pv> ? Set<InvertPattern<pv>> : p extends object ? { | ||
[k in keyof p]: InvertPattern<p[k]>; | ||
@@ -79,3 +79,3 @@ } : p; | ||
declare type LeastUpperBound<a, b> = b extends a ? b : a extends b ? a : never; | ||
declare type ExtractMostPreciseValue<a, b> = [a, b] extends [[infer a1, infer a2, infer a3, infer a4, infer a5], [infer b1, infer b2, infer b3, infer b4, infer b5]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>, ExtractMostPreciseValue<a3, b3>, ExtractMostPreciseValue<a4, b4>, ExtractMostPreciseValue<a5, b5>] : [a, b] extends [[infer a1, infer a2, infer a3, infer a4], [infer b1, infer b2, infer b3, infer b4]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>, ExtractMostPreciseValue<a3, b3>, ExtractMostPreciseValue<a4, b4>] : [a, b] extends [[infer a1, infer a2, infer a3], [infer b1, infer b2, infer b3]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>, ExtractMostPreciseValue<a3, b3>] : [a, b] extends [[infer a1, infer a2], [infer b1, infer b2]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>] : [a, b] extends [(infer a1)[], (infer b1)[]] ? ExtractMostPreciseValue<a1, b1>[] : [a, b] extends [Map<infer ak, infer av>, Map<infer bk, infer bv>] ? Map<ExtractMostPreciseValue<ak, bk>, ExtractMostPreciseValue<av, bv>> : [a, b] extends [Set<infer av>, Set<infer bv>] ? Set<ExtractMostPreciseValue<av, bv>> : b extends __ ? a : b extends { | ||
declare type ExtractMostPreciseValue<a, b> = b extends [] ? [] : [a, b] extends [[infer a1, infer a2, infer a3, infer a4, infer a5] | infer otherBranches, [infer b1, infer b2, infer b3, infer b4, infer b5]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>, ExtractMostPreciseValue<a3, b3>, ExtractMostPreciseValue<a4, b4>, ExtractMostPreciseValue<a5, b5>] : [a, b] extends [[infer a1, infer a2, infer a3, infer a4] | infer otherBranches, [infer b1, infer b2, infer b3, infer b4]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>, ExtractMostPreciseValue<a3, b3>, ExtractMostPreciseValue<a4, b4>] : [a, b] extends [[infer a1, infer a2, infer a3] | infer otherBranches, [infer b1, infer b2, infer b3]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>, ExtractMostPreciseValue<a3, b3>] : [a, b] extends [[infer a1, infer a2] | infer otherBranches, [infer b1, infer b2]] ? [ExtractMostPreciseValue<a1, b1>, ExtractMostPreciseValue<a2, b2>] : [a, b] extends [(infer a1)[], (infer b1)[]] ? ExtractMostPreciseValue<a1, b1>[] : [a, b] extends [Map<infer ak, infer av>, Map<infer bk, infer bv>] ? Map<ExtractMostPreciseValue<ak, bk>, ExtractMostPreciseValue<av, bv>> : [a, b] extends [Set<infer av>, Set<infer bv>] ? Set<ExtractMostPreciseValue<av, bv>> : b extends __ ? a : b extends { | ||
valueKind: PatternType.Not; | ||
@@ -92,3 +92,3 @@ value: infer b1; | ||
declare type ObjectExtractMostPreciseValue<a, b> = b extends a ? b : a extends b ? a : ExcludeIfContainsNever<{ | ||
[k in keyof a]: k extends keyof b ? ExtractMostPreciseValue<a[k], b[k]> : a[k]; | ||
[k in keyof a]-?: k extends keyof b ? ExtractMostPreciseValue<a[k], b[k]> : a[k]; | ||
}>; | ||
@@ -95,0 +95,0 @@ declare type ValueOf<a> = a[keyof a]; |
{ | ||
"name": "ts-pattern", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Typescript pattern matching library", | ||
"main": "lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "clean": "rimraf lib", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18134