Skip to content

Commit

Permalink
fix: sfc default type should be any to support vue-class-component
Browse files Browse the repository at this point in the history
close #412
  • Loading branch information
johnsoncodehk committed Aug 24, 2021
1 parent 5e8e9f0 commit 2705ddb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/vscode-vue-languageservice/src/generators/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,28 @@ export function generate(

const codeGen = createCodeGen<SourceMaps.TsMappingData>();
const teleports: SourceMaps.Mapping<SourceMaps.TeleportMappingData>[] = [];
const shouldAddExportDefault = lsType === 'script' && (!script || !!scriptSetup);
const shouldAddExportDefault = lsType === 'script' && !!scriptSetup;
const overlapMapRanges: SourceMaps.Range[] = [];

writeScriptSrc();
writeScript();
writeScriptSetup();

if (lsType === 'script' && !script && !scriptSetup) {
codeGen.addCode(
'export default {} as any',
{
start: 0,
end: 0,
},
SourceMaps.Mode.Expand,
{
vueTag: 'sfc',
capabilities: {},
},
);
}

if (lsType === 'template' || shouldAddExportDefault)
writeExportComponent();

Expand Down

0 comments on commit 2705ddb

Please sign in to comment.