ts-pattern
Advanced tools
Comparing version
@@ -9,5 +9,5 @@ /** | ||
export declare const isObject: (value: unknown) => value is Object; | ||
export declare const isMatcher: (x: unknown) => x is Matcher<unknown, unknown, MatcherType, SelectionType, unknown>; | ||
export declare const isMatcher: (x: unknown) => x is Matcher<unknown, unknown, MatcherType, SelectionType>; | ||
export declare const matchPattern: (pattern: any, value: any, select: (key: string, value: unknown) => void) => boolean; | ||
export declare const getSelectionKeys: (pattern: any) => string[]; | ||
export declare const flatMap: <a, b>(xs: readonly a[], f: (v: a) => readonly b[]) => b[]; |
@@ -32,2 +32,2 @@ import { Pattern } from './types/Pattern.js'; | ||
*/ | ||
export declare function isMatching<const p extends Pattern<unknown>>(pattern: p, value: unknown): value is P.infer<p>; | ||
export declare function isMatching<const T, const P extends P.Pattern<NoInfer<T>>>(pattern: P, value: T): value is P.infer<P>; |
@@ -50,3 +50,3 @@ import * as symbols from './internals/symbols.js'; | ||
*/ | ||
export type infer<pattern extends Pattern<any>> = InvertPattern<pattern, unknown>; | ||
export type infer<pattern> = InvertPattern<NoInfer<pattern>, unknown>; | ||
/** | ||
@@ -53,0 +53,0 @@ * `P.narrow<Input, Pattern>` will narrow the input type to only keep |
@@ -60,3 +60,3 @@ import type * as symbols from '../internals/symbols.js'; | ||
*/ | ||
export type Pattern<a> = unknown extends a ? UnknownPattern : KnownPattern<a>; | ||
export type Pattern<a = unknown> = unknown extends a ? UnknownPattern : KnownPattern<a>; | ||
type KnownPattern<a> = KnownPatternInternal<a>; | ||
@@ -63,0 +63,0 @@ type KnownPatternInternal<a, objs = Exclude<a, Primitives | Map<any, any> | Set<any> | readonly any[]>, arrays = Extract<a, readonly any[]>, primitives = Extract<a, Primitives>> = primitives | PatternMatcher<a> | ([objs] extends [never] ? never : ObjectPattern<Readonly<MergeUnion<objs>>>) | ([arrays] extends [never] ? never : ArrayPattern<arrays>); |
{ | ||
"name": "ts-pattern", | ||
"version": "5.5.0", | ||
"version": "5.6.0", | ||
"description": " The exhaustive Pattern Matching library for TypeScript.", | ||
@@ -78,4 +78,4 @@ "type": "module", | ||
"ts-jest": "^29.1.2", | ||
"typescript": "^5.3.3" | ||
"typescript": "^5.7.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
417040
-0.01%