From e35de42e9485192fcdfebec5b8c34d617075e2b7 Mon Sep 17 00:00:00 2001 From: gvergnaud Date: Sun, 15 Dec 2024 12:38:30 -0500 Subject: [PATCH] fix: prevent NoInfer from showing up in display types --- src/patterns.ts | 5 +++-- src/types/FindSelected.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/patterns.ts b/src/patterns.ts index 9f04b2e3..0daa17d2 100644 --- a/src/patterns.ts +++ b/src/patterns.ts @@ -107,8 +107,9 @@ export type infer = InvertPattern, unknown>; * type Narrowed = P.narrow * // ^? ['a', 'a' | 'b'] */ -export type narrow> = NoInfer< - ExtractPreciseValue> +export type narrow> = ExtractPreciseValue< + input, + InvertPattern >; function chainable>( diff --git a/src/types/FindSelected.ts b/src/types/FindSelected.ts index 67603554..c2ac5b92 100644 --- a/src/types/FindSelected.ts +++ b/src/types/FindSelected.ts @@ -166,4 +166,4 @@ export type FindSelected = // This happens if the provided pattern didn't extend Pattern, // Because the type checker falls back on the general `Pattern` type // in this case. - NoInfer> extends true ? i : Selections>; + Equal> extends true ? i : Selections;