Skip to content

Commit

Permalink
refactor(language-core): destructure options
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 31, 2025
1 parent ed211ea commit 2ba3bb9
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions packages/language-core/lib/codegen/globalTypes.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import type { VueCompilerOptions } from '../types';
import { getSlotsPropertyName } from '../utils/shared';

export function getGlobalTypesFileName(options: VueCompilerOptions) {
export function getGlobalTypesFileName({
lib,
target,
checkUnknownProps,
checkUnknownEvents,
checkUnknownComponents,
}: VueCompilerOptions) {
return [
options.lib,
options.target,
options.checkUnknownProps,
options.checkUnknownEvents,
options.checkUnknownComponents,
lib,
target,
checkUnknownProps,
checkUnknownEvents,
checkUnknownComponents,
].map(v => {
if (typeof v === 'boolean') {
return v ? 1 : 0;
Expand All @@ -16,8 +22,13 @@ export function getGlobalTypesFileName(options: VueCompilerOptions) {
}).join('_') + '.d.ts';
}

export function generateGlobalTypes(options: VueCompilerOptions) {
const { lib, target, checkUnknownProps, checkUnknownEvents, checkUnknownComponents } = options;
export function generateGlobalTypes({
lib,
target,
checkUnknownProps,
checkUnknownEvents,
checkUnknownComponents,
}: VueCompilerOptions) {
const fnPropsType = `(K extends { $props: infer Props } ? Props : any)${checkUnknownProps ? '' : ' & Record<string, unknown>'}`;
let text = ``;
if (target < 3.5) {
Expand Down

0 comments on commit 2ba3bb9

Please sign in to comment.