Skip to content

Commit

Permalink
fix: prefer defineComponent -> Vue.extend
Browse files Browse the repository at this point in the history
close #1584
  • Loading branch information
johnsoncodehk committed Aug 6, 2022
1 parent b2efb24 commit 412e985
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/vue-language-core/src/plugins/vue-typescript-scripts.ts
Expand Up @@ -26,27 +26,27 @@ export default function (
let shimComponentOptionsMode: 'defineComponent' | 'Vue.extend' | false = false;

if (
(compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent ?? 'onlyJs') === 'onlyJs'
(compilerOptions.experimentalImplicitWrapComponentOptionsWithVue2Extend ?? 'onlyJs') === 'onlyJs'
? lang.value === 'js' || lang.value === 'jsx'
: !!compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent
: !!compilerOptions.experimentalImplicitWrapComponentOptionsWithVue2Extend
) {
shimComponentOptionsMode = 'defineComponent';
shimComponentOptionsMode = 'Vue.extend';
}
if (
(compilerOptions.experimentalImplicitWrapComponentOptionsWithVue2Extend ?? 'onlyJs') === 'onlyJs'
(compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent ?? 'onlyJs') === 'onlyJs'
? lang.value === 'js' || lang.value === 'jsx'
: !!compilerOptions.experimentalImplicitWrapComponentOptionsWithVue2Extend
: !!compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent
) {
shimComponentOptionsMode = 'Vue.extend';
shimComponentOptionsMode = 'defineComponent';
}

// true override 'onlyJs'
if (compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent === true) {
shimComponentOptionsMode = 'defineComponent';
}
if (compilerOptions.experimentalImplicitWrapComponentOptionsWithVue2Extend === true) {
shimComponentOptionsMode = 'Vue.extend';
}
if (compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent === true) {
shimComponentOptionsMode = 'defineComponent';
}

const codeGen = genScript(
i === 0 ? 'script' : 'template',
Expand Down

0 comments on commit 412e985

Please sign in to comment.