Skip to content

Commit e35de42

Browse files
committed
fix: prevent NoInfer from showing up in display types
1 parent 514057f commit e35de42

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/patterns.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ export type infer<pattern> = InvertPattern<NoInfer<pattern>, unknown>;
107107
* type Narrowed = P.narrow<Input, typeof Pattern>
108108
* // ^? ['a', 'a' | 'b']
109109
*/
110-
export type narrow<input, pattern extends Pattern<any>> = NoInfer<
111-
ExtractPreciseValue<input, InvertPattern<pattern, input>>
110+
export type narrow<input, pattern extends Pattern<any>> = ExtractPreciseValue<
111+
input,
112+
InvertPattern<pattern, input>
112113
>;
113114

114115
function chainable<pattern extends Matcher<any, any, any, any, any>>(

src/types/FindSelected.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ export type FindSelected<i, p> =
166166
// This happens if the provided pattern didn't extend Pattern<i>,
167167
// Because the type checker falls back on the general `Pattern<i>` type
168168
// in this case.
169-
NoInfer<Equal<p, Pattern<i>> extends true ? i : Selections<i, p>>;
169+
Equal<p, Pattern<i>> extends true ? i : Selections<i, p>;

0 commit comments

Comments
 (0)