Skip to content

Commit d119c3f

Browse files
committed
Merge branch 'main' into module-node20
2 parents c947be2 + efe07a0 commit d119c3f

File tree

221 files changed

+6401
-2190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+6401
-2190
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: CodeQL Configuration
22

3-
paths:
4-
- src
5-
- scripts
6-
- Herebyfile.mjs
73
paths-ignore:
84
- src/lib
5+
- tests

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ jobs:
9090
run: npm test -- --no-lint --coverage
9191

9292
- name: Upload coverage artifact
93-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
93+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
9494
with:
9595
name: coverage
9696
path: coverage
9797

98-
- uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
98+
- uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
9999
with:
100100
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
101101
disable_search: true
@@ -334,7 +334,7 @@ jobs:
334334
335335
- name: Upload baseline diff artifact
336336
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
337-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
337+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
338338
with:
339339
name: fix_baselines.patch
340340
path: fix_baselines.patch

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
49+
uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
5050
with:
5151
config-file: ./.github/codeql/codeql-configuration.yml
5252
# Override language selection by uncommenting this and choosing your languages
@@ -56,7 +56,7 @@ jobs:
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below).
5858
- name: Autobuild
59-
uses: github/codeql-action/autobuild@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
59+
uses: github/codeql-action/autobuild@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
6060

6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -70,4 +70,4 @@ jobs:
7070
# make release
7171

7272
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
73+
uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1

.github/workflows/release-branch-artifact.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
npm pack ./
4545
mv typescript-*.tgz typescript.tgz
4646
- name: Upload built tarfile
47-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
47+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
4848
with:
4949
name: tgz
5050
path: typescript.tgz

.github/workflows/scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ jobs:
4747
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
4848
# format to the repository Actions tab.
4949
- name: 'Upload artifact'
50-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
50+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
5151
with:
5252
name: SARIF file
5353
path: results.sarif
5454
retention-days: 5
5555

5656
# Upload the results to GitHub's code scanning dashboard.
5757
- name: 'Upload to code-scanning'
58-
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
58+
uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
5959
with:
6060
sarif_file: results.sarif

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# TypeScript
33

4-
[![GitHub Actions CI](https://github.com/microsoft/TypeScript/workflows/CI/badge.svg)](https://github.com/microsoft/TypeScript/actions?query=workflow%3ACI)
4+
[![CI](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml)
55
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
66
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
77
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript)

azure-pipelines.release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ resources:
1010
name: 1ESPipelineTemplates/1ESPipelineTemplates
1111
ref: refs/tags/release
1212

13+
variables:
14+
Codeql.InitParameters: '--codescanning-config=$(Build.SourcesDirectory)/.github/codeql/codeql-configuration.yml'
15+
1316
extends:
1417
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
1518
parameters:

src/compiler/_namespaces/ts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export * from "../transformer.js";
6161
export * from "../emitter.js";
6262
export * from "../watchUtilities.js";
6363
export * from "../program.js";
64+
export * from "../programDiagnostics.js";
6465
export * from "../builderStatePublic.js";
6566
export * from "../builderState.js";
6667
export * from "../builder.js";

src/compiler/binder.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,9 +1318,11 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
13181318
case SyntaxKind.ExclamationEqualsToken:
13191319
case SyntaxKind.EqualsEqualsEqualsToken:
13201320
case SyntaxKind.ExclamationEqualsEqualsToken:
1321-
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
1322-
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) ||
1323-
(isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
1321+
const left = skipParentheses(expr.left);
1322+
const right = skipParentheses(expr.right);
1323+
return isNarrowableOperand(left) || isNarrowableOperand(right) ||
1324+
isNarrowingTypeofOperands(right, left) || isNarrowingTypeofOperands(left, right) ||
1325+
(isBooleanLiteral(right) && isNarrowingExpression(left) || isBooleanLiteral(left) && isNarrowingExpression(right));
13241326
case SyntaxKind.InstanceOfKeyword:
13251327
return isNarrowableOperand(expr.left);
13261328
case SyntaxKind.InKeyword:
@@ -1534,13 +1536,16 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
15341536
function bindForStatement(node: ForStatement): void {
15351537
const preLoopLabel = setContinueTarget(node, createLoopLabel());
15361538
const preBodyLabel = createBranchLabel();
1539+
const preIncrementorLabel = createBranchLabel();
15371540
const postLoopLabel = createBranchLabel();
15381541
bind(node.initializer);
15391542
addAntecedent(preLoopLabel, currentFlow);
15401543
currentFlow = preLoopLabel;
15411544
bindCondition(node.condition, preBodyLabel, postLoopLabel);
15421545
currentFlow = finishFlowLabel(preBodyLabel);
1543-
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
1546+
bindIterativeStatement(node.statement, postLoopLabel, preIncrementorLabel);
1547+
addAntecedent(preIncrementorLabel, currentFlow);
1548+
currentFlow = finishFlowLabel(preIncrementorLabel);
15441549
bind(node.incrementor);
15451550
addAntecedent(preLoopLabel, currentFlow);
15461551
currentFlow = finishFlowLabel(postLoopLabel);

src/compiler/checker.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
18241824
getNumberLiteralType,
18251825
getBigIntType: () => bigintType,
18261826
getBigIntLiteralType,
1827+
getUnknownType: () => unknownType,
18271828
createPromiseType,
18281829
createArrayType,
18291830
getElementTypeOfArrayType,
@@ -6267,7 +6268,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
62676268
return true;
62686269
}
62696270
if (requiresAddingUndefined && annotationType) {
6270-
annotationType = getOptionalType(annotationType, !isParameter(node));
6271+
annotationType = addOptionality(annotationType, !isParameter(node));
62716272
}
62726273
return !!annotationType && typeNodeIsEquivalentToType(node, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type);
62736274
},
@@ -16683,6 +16684,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1668316684
case "Number":
1668416685
checkNoTypeArguments(node);
1668516686
return numberType;
16687+
case "BigInt":
16688+
checkNoTypeArguments(node);
16689+
return bigintType;
1668616690
case "Boolean":
1668716691
checkNoTypeArguments(node);
1668816692
return booleanType;
@@ -27181,7 +27185,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2718127185
return target.kind === SyntaxKind.SuperKeyword;
2718227186
case SyntaxKind.NonNullExpression:
2718327187
case SyntaxKind.ParenthesizedExpression:
27184-
return isMatchingReference((source as NonNullExpression | ParenthesizedExpression).expression, target);
27188+
case SyntaxKind.SatisfiesExpression:
27189+
return isMatchingReference((source as NonNullExpression | ParenthesizedExpression | SatisfiesExpression).expression, target);
2718527190
case SyntaxKind.PropertyAccessExpression:
2718627191
case SyntaxKind.ElementAccessExpression:
2718727192
const sourcePropertyName = getAccessedPropertyName(source as AccessExpression);
@@ -29533,7 +29538,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2953329538
return narrowTypeByCallExpression(type, expr as CallExpression, assumeTrue);
2953429539
case SyntaxKind.ParenthesizedExpression:
2953529540
case SyntaxKind.NonNullExpression:
29536-
return narrowType(type, (expr as ParenthesizedExpression | NonNullExpression).expression, assumeTrue);
29541+
case SyntaxKind.SatisfiesExpression:
29542+
return narrowType(type, (expr as ParenthesizedExpression | NonNullExpression | SatisfiesExpression).expression, assumeTrue);
2953729543
case SyntaxKind.BinaryExpression:
2953829544
return narrowTypeByBinaryExpression(type, expr as BinaryExpression, assumeTrue);
2953929545
case SyntaxKind.PrefixUnaryExpression:

0 commit comments

Comments
 (0)