Skip to content

Commit

Permalink
type
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Nov 28, 2022
1 parent 7ec3ba3 commit 4205441
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/babel-helper-compilation-targets/src/debug.ts
Expand Up @@ -12,7 +12,7 @@ export function getInclusionReasons(
targetVersions: Targets,
list: { [key: string]: Targets },
) {
const minVersions = list[item] || ({} as Targets);
const minVersions = list[item] || {};

return (Object.keys(targetVersions) as Target[]).reduce((result, env) => {
const minVersion = getLowestImplementedVersion(minVersions, env);
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-helper-compilation-targets/src/index.ts
Expand Up @@ -46,7 +46,7 @@ function validateTargetNames(targets: Targets): TargetsTuple {
}
}

return targets as any;
return targets;
}

export function isBrowsersQueryValid(browsers: unknown): boolean {
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-helper-compilation-targets/src/pretty.ts
Expand Up @@ -7,9 +7,9 @@ export function prettifyVersion(version: string) {
return version;
}

const parts = [semver.major(version)];
const minor = semver.minor(version);
const patch = semver.patch(version);
const { major, minor, patch } = semver.parse(version);

const parts = [major];

if (minor || patch) {
parts.push(minor);
Expand Down
6 changes: 2 additions & 4 deletions packages/babel-helper-compilation-targets/src/types.d.ts
Expand Up @@ -17,10 +17,8 @@ export type Targets = {
[target in Target]?: string;
};

export type TargetsTuple = {
[target in Exclude<Target, "node">]: string;
} & {
node: string | true;
export type TargetsTuple = Omit<Targets, "node"> & {
node?: string | true;
};

export type Browsers = string | ReadonlyArray<string>;
Expand Down

0 comments on commit 4205441

Please sign in to comment.