Skip to content

Commit

Permalink
fix: false positive error with withDefaults + "strictNullChecks": false
Browse files Browse the repository at this point in the history
close #1187
  • Loading branch information
johnsoncodehk committed Apr 16, 2022
1 parent 4bf5d2b commit 2ec92f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vue-code-gen/src/generators/script.ts
Expand Up @@ -269,7 +269,8 @@ export function generate(
);

if (scriptSetupRanges?.withDefaultsArg) {
codeGen.addText(`const __VLS_withDefaultsArg = (`);
// fix https://github.com/johnsoncodehk/volar/issues/1187
codeGen.addText(`const __VLS_withDefaultsArg = (<T>(t: T) => t)(`);
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.withDefaultsArg.start, scriptSetupRanges.withDefaultsArg.end);
codeGen.addText(`);\n`);
}
Expand Down

0 comments on commit 2ec92f0

Please sign in to comment.