Skip to content

Commit 24166ba

Browse files
committed
refactor(language-core): destructure options
1 parent 07a1baa commit 24166ba

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

Diff for: packages/language-core/lib/codegen/globalTypes.ts

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import type { VueCompilerOptions } from '../types';
22
import { getSlotsPropertyName } from '../utils/shared';
33

4-
export function getGlobalTypesFileName(options: VueCompilerOptions) {
4+
export function getGlobalTypesFileName({
5+
lib,
6+
target,
7+
checkUnknownProps,
8+
checkUnknownEvents,
9+
checkUnknownComponents,
10+
}: VueCompilerOptions) {
511
return [
6-
options.lib,
7-
options.target,
8-
options.checkUnknownProps,
9-
options.checkUnknownEvents,
10-
options.checkUnknownComponents,
12+
lib,
13+
target,
14+
checkUnknownProps,
15+
checkUnknownEvents,
16+
checkUnknownComponents,
1117
].map(v => {
1218
if (typeof v === 'boolean') {
1319
return v ? 1 : 0;
@@ -16,8 +22,13 @@ export function getGlobalTypesFileName(options: VueCompilerOptions) {
1622
}).join('_') + '.d.ts';
1723
}
1824

19-
export function generateGlobalTypes(options: VueCompilerOptions) {
20-
const { lib, target, checkUnknownProps, checkUnknownEvents, checkUnknownComponents } = options;
25+
export function generateGlobalTypes({
26+
lib,
27+
target,
28+
checkUnknownProps,
29+
checkUnknownEvents,
30+
checkUnknownComponents,
31+
}: VueCompilerOptions) {
2132
const fnPropsType = `(K extends { $props: infer Props } ? Props : any)${checkUnknownProps ? '' : ' & Record<string, unknown>'}`;
2233
let text = ``;
2334
if (target < 3.5) {

0 commit comments

Comments
 (0)