ts-pattern
Advanced tools
Comparing version 3.3.1 to 3.3.2
@@ -29,3 +29,3 @@ import { BuildMany } from './BuildMany'; | ||
export declare type DistributeMatchingUnions<a, p> = IsAny<a> extends true ? any : BuildMany<a, Distribute<FindUnionsMany<a, p>>>; | ||
export declare type FindUnionsMany<a, p, path extends PropertyKey[] = []> = UnionToTuple<(p extends any ? IsMatching<a, p> extends true ? FindUnions<a, p, path> : [] : never)[number]>; | ||
export declare type FindUnionsMany<a, p, path extends PropertyKey[] = []> = UnionToTuple<(p extends any ? IsMatching<a, p> extends true ? FindUnions<a, p, path> : [] : never) extends (infer T)[] ? T : never>; | ||
/** | ||
@@ -32,0 +32,0 @@ * The reason we don't look further down the tree with lists, |
@@ -22,8 +22,5 @@ export declare type ValueOf<a> = a extends any[] ? a[number] : a[keyof a]; | ||
export declare type IsUnion<a> = [a] extends [UnionToIntersection<a>] ? false : true; | ||
export declare type UnionToTuple<T> = UnionToIntersection<T extends any ? (t: T) => T : never> extends (_: any) => infer W ? [...UnionToTuple<Exclude<T, W>>, W] : []; | ||
export declare type UnionToTuple<T, output extends any[] = []> = UnionToIntersection<T extends any ? (t: T) => T : never> extends (_: any) => infer W ? UnionToTuple<Exclude<T, W>, [W, ...output]> : output; | ||
export declare type Cast<a, b> = a extends b ? a : never; | ||
export declare type Flatten<xs extends any[]> = xs extends readonly [ | ||
infer head, | ||
...infer tail | ||
] ? [...Cast<head, any[]>, ...Flatten<tail>] : []; | ||
export declare type Flatten<xs extends any[], output extends any[] = []> = xs extends readonly [infer head, ...infer tail] ? Flatten<tail, [...output, ...Cast<head, any[]>]> : output; | ||
export declare type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false; | ||
@@ -30,0 +27,0 @@ export declare type Expect<T extends true> = T; |
{ | ||
"name": "ts-pattern", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"description": " The exhaustive Pattern Matching library for TypeScript.", | ||
@@ -37,9 +37,9 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.23", | ||
"jest": "^27.0.3", | ||
"@types/jest": "^27.0.2", | ||
"jest": "^27.2.1", | ||
"prettier": "^2.2.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^27.0.1", | ||
"ts-jest": "^27.0.5", | ||
"typescript": "^4.4.2" | ||
} | ||
} |
@@ -36,3 +36,3 @@ <h1 align="center">ts-pattern</h1> | ||
Write **better** and **safer conditions**. Pattern matching lets you express complex conditions in a single, compact expression. Your code becomes **shorter** and **more readable**. Exhaustiveness checking ensures you havenβt forgotten **any possible cases**. | ||
Write **better** and **safer conditions**. Pattern matching lets you express complex conditions in a single, compact expression. Your code becomes **shorter** and **more readable**. Exhaustiveness checking ensures you havenβt forgotten **any possible case**. | ||
@@ -39,0 +39,0 @@ ## Features |
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
76598
860