From 50d10c10fb254573333245b04b8d129843f25bc1 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Fri, 27 Oct 2023 00:34:42 +0800 Subject: [PATCH] fix: add missing `__VLS_Prettify` type for `withDefaults()` (#3691) --- packages/language-core/src/generators/script.ts | 1 + packages/tsc/tests/__snapshots__/dts.spec.ts.snap | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/language-core/src/generators/script.ts b/packages/language-core/src/generators/script.ts index d3bc08318d..d12a704b5e 100644 --- a/packages/language-core/src/generators/script.ts +++ b/packages/language-core/src/generators/script.ts @@ -118,6 +118,7 @@ export function generate( default: D[K] }> : P[K] };\n`); + codes.push(`type __VLS_Prettify = { [K in keyof T]: T[K]; } & {};\n`); } if (usedHelperTypes.WithTemplateSlots) { codes.push( diff --git a/packages/tsc/tests/__snapshots__/dts.spec.ts.snap b/packages/tsc/tests/__snapshots__/dts.spec.ts.snap index 3b34d22a6f..d425810cef 100644 --- a/packages/tsc/tests/__snapshots__/dts.spec.ts.snap +++ b/packages/tsc/tests/__snapshots__/dts.spec.ts.snap @@ -196,6 +196,9 @@ type __VLS_WithDefaults = { default: D[K]; }> : P[K]; }; +type __VLS_Prettify = { + [K in keyof T]: T[K]; +} & {}; " `;