Skip to content

Commit

Permalink
feat: enabled `experimentalImplicitWrapComponentOptionsWithDefineComp…
Browse files Browse the repository at this point in the history
…onent` by default for `lang="js"`

close #1298
  • Loading branch information
johnsoncodehk committed May 15, 2022
1 parent ef8a061 commit 7d257ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Expand Up @@ -17,7 +17,11 @@
"markdownDescription": "https://github.com/johnsoncodehk/volar/pull/351"
},
"experimentalImplicitWrapComponentOptionsWithDefineComponent": {
"type": "boolean",
"enum": [
true,
false,
"onlyJs"
],
"markdownDescription": "Implicit wrap object literal component options export with `defineComponent()`."
},
"experimentalTemplateCompilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-typescript/src/types.ts
Expand Up @@ -12,7 +12,7 @@ export interface ITemplateScriptData {

export interface VueCompilerOptions {
experimentalCompatMode?: 2 | 3;
experimentalImplicitWrapComponentOptionsWithDefineComponent?: boolean;
experimentalImplicitWrapComponentOptionsWithDefineComponent?: boolean | 'onlyJs';
experimentalTemplateCompilerOptions?: any;
experimentalTemplateCompilerOptionsRequirePath?: string;
experimentalDisableTemplateSupport?: boolean;
Expand Down
4 changes: 3 additions & 1 deletion packages/vue-typescript/src/use/useSfcScriptGen.ts
Expand Up @@ -46,7 +46,9 @@ export function useSfcScriptGen<T extends 'template' | 'script'>(
return bindTexts;
},
getVueLibraryName(compilerOptions.experimentalCompatMode === 2),
!!compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent,
(compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent ?? 'onlyJs') === 'onlyJs'
? lang.value === 'js' || lang.value === 'jsx'
: !!compilerOptions.experimentalImplicitWrapComponentOptionsWithDefineComponent,
)
);
const file = computed(() => {
Expand Down

0 comments on commit 7d257ed

Please sign in to comment.