Skip to content

Commit

Permalink
chore: Update TS 5.0.2 (#15502)
Browse files Browse the repository at this point in the history
* update

* prettier
  • Loading branch information
liuxingbaoyu committed Mar 20, 2023
1 parent 1584512 commit 032203e
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 88 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@types/node": "^18.11.7",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"babel-plugin-transform-charcodes": "^0.2.0",
"c8": "^7.12.0",
"chalk": "^5.0.0",
Expand All @@ -64,7 +64,7 @@
"jest-worker": "^29.0.1",
"lint-staged": "^13.0.3",
"mergeiterator": "^1.4.4",
"prettier": "^2.7.1",
"prettier": "^2.8.5",
"rollup": "^2.78.0",
"rollup-plugin-dts": "^5.0.0",
"rollup-plugin-polyfill-node": "^0.10.2",
Expand All @@ -73,7 +73,7 @@
"shelljs": "^0.8.5",
"test262-stream": "^1.4.0",
"through2": "^4.0.0",
"typescript": "~5.0.0-beta"
"typescript": "^5.0.2"
},
"workspaces": [
"codemods/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-core/src/config/files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type indexType = typeof import("./index");

// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of index-browser, since this file may be replaced at bundle time with index-browser.
({} as any as indexBrowserType as indexType);
({}) as any as indexBrowserType as indexType;

export { findPackageData } from "./package";

Expand Down
6 changes: 3 additions & 3 deletions packages/babel-core/src/config/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ChainFormatter = {

type PrintableConfig = {
content: OptionsAndDescriptors;
type: typeof ChainFormatter[keyof typeof ChainFormatter];
type: (typeof ChainFormatter)[keyof typeof ChainFormatter];
callerName: string | undefined | null;
filepath: string | undefined | null;
index: number | undefined | null;
Expand All @@ -24,7 +24,7 @@ type PrintableConfig = {

const Formatter = {
title(
type: typeof ChainFormatter[keyof typeof ChainFormatter],
type: (typeof ChainFormatter)[keyof typeof ChainFormatter],
callerName?: string | null,
filepath?: string | null,
): string {
Expand Down Expand Up @@ -98,7 +98,7 @@ export class ConfigPrinter {
_stack: Array<PrintableConfig> = [];
configure(
enabled: boolean,
type: typeof ChainFormatter[keyof typeof ChainFormatter],
type: (typeof ChainFormatter)[keyof typeof ChainFormatter],
{
callerName,
filepath,
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-core/src/config/resolve-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type nodeType = typeof import("./resolve-targets");

// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of index-browser, since this file may be replaced at bundle time with index-browser.
({} as any as browserType as nodeType);
({}) as any as browserType as nodeType;

import type { ValidatedOptions } from "./validation/options";
import path from "path";
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-core/src/config/validation/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const knownAssumptions = [
"skipForOfIteratorClosing",
"superIsCallableConstructor",
] as const;
export type AssumptionName = typeof knownAssumptions[number];
export type AssumptionName = (typeof knownAssumptions)[number];
export const assumptionsNames = new Set(knownAssumptions);

function getSource(loc: NestingPath): OptionsSource {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-core/src/transform-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type transformFileType = typeof import("./transform-file");
// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of transform-file-browser, since this file may be replaced at bundle time with
// transform-file-browser.
({} as any as transformFileBrowserType as transformFileType);
({}) as any as transformFileBrowserType as transformFileType;

const transformFileRunner = gensync(function* (
filename: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-helper-compilation-targets/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function isUnreleasedVersion(

export function getLowestUnreleased(a: string, b: string, env: Target): string {
const unreleasedLabel:
| typeof unreleasedLabels[keyof typeof unreleasedLabels]
| (typeof unreleasedLabels)[keyof typeof unreleasedLabels]
| undefined =
// @ts-expect-error unreleasedLabel is undefined when env is not safari
unreleasedLabels[env];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const FEATURES = Object.freeze({
export const featuresKey = "@babel/plugin-regexp-features/featuresKey";
export const runtimeKey = "@babel/plugin-regexp-features/runtimeKey";

type FeatureType = typeof FEATURES[keyof typeof FEATURES];
type FeatureType = (typeof FEATURES)[keyof typeof FEATURES];

export function enableFeature(features: number, feature: FeatureType): number {
return features | feature;
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-parser/src/parser/lval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export default abstract class LValParser extends NodeUtils {
parseBindingList(
this: Parser,
close: TokenType,
closeCharCode: typeof charCodes[keyof typeof charCodes],
closeCharCode: (typeof charCodes)[keyof typeof charCodes],
flags: ParseBindingListFlags,
): Array<Pattern | TSParameterProperty> {
const allowEmpty = flags & ParseBindingListFlags.ALLOW_EMPTY;
Expand Down Expand Up @@ -723,7 +723,7 @@ export default abstract class LValParser extends NodeUtils {
}

checkCommaAfterRest(
close: typeof charCodes[keyof typeof charCodes],
close: (typeof charCodes)[keyof typeof charCodes],
): boolean {
if (!this.match(tt.comma)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/plugins/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3743,7 +3743,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
}

checkCommaAfterRest(
close: typeof charCodes[keyof typeof charCodes],
close: (typeof charCodes)[keyof typeof charCodes],
): boolean {
if (
this.state.isAmbientContext &&
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-syntax-pipeline-operator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const documentationURL =
"https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator";

export interface Options {
proposal: typeof PIPELINE_PROPOSALS[number];
topicToken?: typeof TOPIC_TOKENS[number];
proposal: (typeof PIPELINE_PROPOSALS)[number];
topicToken?: (typeof TOPIC_TOKENS)[number];
}

export default declare((api, { proposal, topicToken }: Options) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-preset-env/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import type { Targets, InputTargets } from "@babel/helper-compilation-targets";

// Options
// Use explicit modules to prevent typo errors.
export type ModuleOption = typeof ModulesOption[keyof typeof ModulesOption];
export type ModuleOption = (typeof ModulesOption)[keyof typeof ModulesOption];
export type BuiltInsOption =
typeof UseBuiltInsOption[keyof typeof UseBuiltInsOption];
(typeof UseBuiltInsOption)[keyof typeof UseBuiltInsOption];

type CorejsVersion = 2 | 3 | string;

Expand Down
4 changes: 2 additions & 2 deletions packages/babel-traverse/src/path/evaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import type * as t from "@babel/types";
const VALID_CALLEES = ["String", "Number", "Math"] as const;
const INVALID_METHODS = ["random"] as const;

function isValidCallee(val: string): val is typeof VALID_CALLEES[number] {
function isValidCallee(val: string): val is (typeof VALID_CALLEES)[number] {
return VALID_CALLEES.includes(
// @ts-expect-error val is a string
val,
);
}

function isInvalidMethod(val: string): val is typeof INVALID_METHODS[number] {
function isInvalidMethod(val: string): val is (typeof INVALID_METHODS)[number] {
return INVALID_METHODS.includes(
// @ts-expect-error val is a string
val,
Expand Down
Loading

0 comments on commit 032203e

Please sign in to comment.