Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update TS 5.0.2 #15502

Merged
merged 2 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
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
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
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
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
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
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
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
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
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
Expand Up @@ -3699,7 +3699,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
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
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
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