From 33288bc92401c9bcd9c724cad2507f89376c7917 Mon Sep 17 00:00:00 2001 From: John Favret <64748847+johnfav03@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:29:30 -0500 Subject: [PATCH 1/9] error testing --- src/compiler/checker.ts | 3 +++ src/compiler/diagnosticMessages.json | 4 ++++ tests/cases/compiler/stringComp.ts | 0 3 files changed, 7 insertions(+) create mode 100644 tests/cases/compiler/stringComp.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 75be36474222f..0829187cbe166 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -40405,6 +40405,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === SyntaxKind.ThisKeyword)); return state; } + else if (isStringLiteral(node.left) && isStringLiteral(node.right) && operator !== SyntaxKind.EqualsToken) { + error(node, Diagnostics.Comparison_of_string_literals_is_not_allowed); + } return state; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0e60926c93d50..892a774c71ee2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -8519,5 +8519,9 @@ "'{0}' is not a valid meta-property for keyword 'import'. Did you mean 'meta' or 'defer'?": { "category": "Error", "code": 18061 + }, + "Comparison of string literals is not allowed.": { + "category": "Error", + "code": 18062 } } diff --git a/tests/cases/compiler/stringComp.ts b/tests/cases/compiler/stringComp.ts new file mode 100644 index 0000000000000..e69de29bb2d1d From 22f5cbb7e3a10653bcce7b04adeb5f15848d3cf6 Mon Sep 17 00:00:00 2001 From: John Favret <64748847+johnfav03@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:31:20 -0500 Subject: [PATCH 2/9] added test --- tests/cases/compiler/StringComp.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/cases/compiler/StringComp.ts diff --git a/tests/cases/compiler/StringComp.ts b/tests/cases/compiler/StringComp.ts new file mode 100644 index 0000000000000..b0de87196ff6a --- /dev/null +++ b/tests/cases/compiler/StringComp.ts @@ -0,0 +1,3 @@ +if ("bar" <= "foo") { + console.log("Really?") +} \ No newline at end of file From be85cc21b333d59dd1a2e43b948f090603026949 Mon Sep 17 00:00:00 2001 From: John Favret <64748847+johnfav03@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:34:08 -0500 Subject: [PATCH 3/9] accepted baseline --- tests/baselines/reference/stringComp.js | 6 ++++++ tests/baselines/reference/stringComp.symbols | 4 ++++ tests/baselines/reference/stringComp.types | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 tests/baselines/reference/stringComp.js create mode 100644 tests/baselines/reference/stringComp.symbols create mode 100644 tests/baselines/reference/stringComp.types diff --git a/tests/baselines/reference/stringComp.js b/tests/baselines/reference/stringComp.js new file mode 100644 index 0000000000000..f636152889758 --- /dev/null +++ b/tests/baselines/reference/stringComp.js @@ -0,0 +1,6 @@ +//// [tests/cases/compiler/stringComp.ts] //// + +//// [stringComp.ts] + + +//// [stringComp.js] diff --git a/tests/baselines/reference/stringComp.symbols b/tests/baselines/reference/stringComp.symbols new file mode 100644 index 0000000000000..5b2186d07237d --- /dev/null +++ b/tests/baselines/reference/stringComp.symbols @@ -0,0 +1,4 @@ +//// [tests/cases/compiler/stringComp.ts] //// + +=== stringComp.ts === + diff --git a/tests/baselines/reference/stringComp.types b/tests/baselines/reference/stringComp.types new file mode 100644 index 0000000000000..5b2186d07237d --- /dev/null +++ b/tests/baselines/reference/stringComp.types @@ -0,0 +1,4 @@ +//// [tests/cases/compiler/stringComp.ts] //// + +=== stringComp.ts === + From fbbf48ff2b151931f8873bec8bf6481645c9264a Mon Sep 17 00:00:00 2001 From: John Favret <64748847+johnfav03@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:41:36 -0500 Subject: [PATCH 4/9] updated logic location --- src/compiler/checker.ts | 3 +++ src/compiler/diagnosticMessages.json | 2 +- tests/cases/compiler/stringComp.ts | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0829187cbe166..a216f2dffe094 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -40792,6 +40792,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (checkForDisallowedESSymbolOperand(operator)) { leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left)); rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right)); + if (leftType.flags === TypeFlags.String && rightType.flags === TypeFlags.String) { + error(errorNode, Diagnostics.Cannot_compare_strings); + } reportOperatorErrorUnless((left, right) => { if (isTypeAny(left) || isTypeAny(right)) { return true; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 892a774c71ee2..4e2ef2c651fd9 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -8520,7 +8520,7 @@ "category": "Error", "code": 18061 }, - "Comparison of string literals is not allowed.": { + "Cannot compare strings": { "category": "Error", "code": 18062 } diff --git a/tests/cases/compiler/stringComp.ts b/tests/cases/compiler/stringComp.ts index e69de29bb2d1d..b0de87196ff6a 100644 --- a/tests/cases/compiler/stringComp.ts +++ b/tests/cases/compiler/stringComp.ts @@ -0,0 +1,3 @@ +if ("bar" <= "foo") { + console.log("Really?") +} \ No newline at end of file From 52706a7b3f108a89219f35975072f48e7a71e039 Mon Sep 17 00:00:00 2001 From: John Favret <64748847+johnfav03@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:45:42 -0500 Subject: [PATCH 5/9] removed old logic --- src/compiler/checker.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a216f2dffe094..d9efc284f1b88 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -40405,9 +40405,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === SyntaxKind.ThisKeyword)); return state; } - else if (isStringLiteral(node.left) && isStringLiteral(node.right) && operator !== SyntaxKind.EqualsToken) { - error(node, Diagnostics.Comparison_of_string_literals_is_not_allowed); - } return state; } From 87bad8744a9afd1be3aa577b4e8c4251e7e26387 Mon Sep 17 00:00:00 2001 From: John Favret <64748847+johnfav03@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:52:50 -0500 Subject: [PATCH 6/9] removed extraneous file --- tests/cases/compiler/StringComp.ts | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 tests/cases/compiler/StringComp.ts diff --git a/tests/cases/compiler/StringComp.ts b/tests/cases/compiler/StringComp.ts deleted file mode 100644 index b0de87196ff6a..0000000000000 --- a/tests/cases/compiler/StringComp.ts +++ /dev/null @@ -1,3 +0,0 @@ -if ("bar" <= "foo") { - console.log("Really?") -} \ No newline at end of file From b323f6a53322f847ab58e064413d4bc90fa0d385 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 09:14:47 -0700 Subject: [PATCH 7/9] Bump github/codeql-action from 3.29.1 to 3.29.2 in the github-actions group (#62006) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/scorecard.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0d81accede3e3..e39a653c32846 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1 + uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 with: config-file: ./.github/codeql/codeql-configuration.yml # Override language selection by uncommenting this and choosing your languages @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below). - name: Autobuild - uses: github/codeql-action/autobuild@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1 + uses: github/codeql-action/autobuild@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -70,4 +70,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1 + uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 9d588a44e6d0b..3e5870899e885 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -55,6 +55,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: 'Upload to code-scanning' - uses: github/codeql-action/upload-sarif@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1 + uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 with: sarif_file: results.sarif From e0291e3f1df770f0d750ca37c5cc16b5b5ead81c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 09:49:31 -0700 Subject: [PATCH 8/9] Bump the github-actions group with 2 updates (#62252) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- .github/workflows/codeql.yml | 6 +++--- .github/workflows/scorecard.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 952cb7cba6c12..0321ba0d95c58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -207,7 +207,7 @@ jobs: node-version: 'lts/*' - run: npm ci - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: path: ~/.cache/dprint key: ${{ runner.os }}-dprint-${{ hashFiles('package-lock.json', '.dprint.jsonc') }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e39a653c32846..7a6b5ebd481a7 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 + uses: github/codeql-action/init@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.5 with: config-file: ./.github/codeql/codeql-configuration.yml # Override language selection by uncommenting this and choosing your languages @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below). - name: Autobuild - uses: github/codeql-action/autobuild@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 + uses: github/codeql-action/autobuild@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.5 # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -70,4 +70,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 + uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.5 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 3e5870899e885..5ab36d6744f0d 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -55,6 +55,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: 'Upload to code-scanning' - uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 + uses: github/codeql-action/upload-sarif@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.5 with: sarif_file: results.sarif From af068ba44e11378353e6aeae6f6f376f8bb95952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Mon, 11 Aug 2025 21:16:40 +0100 Subject: [PATCH 9/9] Update Node.js core modules (#62201) --- src/compiler/utilities.ts | 8 +-- ...ngs-should-return-node-for-core-modules.js | 60 +++++-------------- 2 files changed, 17 insertions(+), 51 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 4687bb8796fad..91e050754019b 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -12026,7 +12026,7 @@ export function isSideEffectImport(node: Node): boolean { return !!ancestor && !ancestor.importClause; } -// require('module').builtinModules.filter(x => !x.startsWith('_')) +// require('module').builtinModules.filter(x => !x.match(/^(?:_|node:)/)) const unprefixedNodeCoreModulesList = [ "assert", "assert/strict", @@ -12069,7 +12069,6 @@ const unprefixedNodeCoreModulesList = [ "stream/web", "string_decoder", "sys", - "test/mock_loader", "timers", "timers/promises", "tls", @@ -12088,11 +12087,10 @@ const unprefixedNodeCoreModulesList = [ /** @internal */ export const unprefixedNodeCoreModules: Set = new Set(unprefixedNodeCoreModulesList); -// await fetch('https://nodejs.org/docs/latest/api/all.json').then(r => r.text()).then(t => -// new Set(t.match(/(?<=')node:.+?(?=')/g)) -// .difference(new Set(require('module').builtinModules.map(x => `node:${x}`)))) +// require('module').builtinModules.filter(x => x.startsWith('node:')) /** @internal */ export const exclusivelyPrefixedNodeCoreModules: Set = new Set([ + "node:quic", "node:sea", "node:sqlite", "node:test", diff --git a/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js b/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js index 702d77b80ff5d..f9e2abe23a7c9 100644 --- a/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js +++ b/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js @@ -1330,38 +1330,6 @@ TI:: [hh:mm:ss:mss] Finished typings discovery: ] } -ts.JsTyping.discoverTypings:: - { - "fileNames": [ - "/home/src/projects/project/app.js" - ], - "projectRootPath": "/home/src/projects/project", - "safeList": {}, - "packageNameToTypingLocation": {}, - "typeAcquisition": { - "enable": true - }, - "unresolvedImports": [ - "test/mock_loader", - "somename" - ], - "typesRegistry": {}, - "compilerOptions": {} - } -TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] -TI:: [hh:mm:ss:mss] Finished typings discovery: - { - "cachedTypingPaths": [], - "newTypingNames": [ - "node", - "somename" - ], - "filesToWatch": [ - "/home/src/projects/project/bower_components", - "/home/src/projects/project/node_modules" - ] - } - ts.JsTyping.discoverTypings:: { "fileNames": [ @@ -3102,7 +3070,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:test/mock_loader", + "node:timers", "somename" ], "typesRegistry": {}, @@ -3134,7 +3102,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:timers", + "node:timers/promises", "somename" ], "typesRegistry": {}, @@ -3166,7 +3134,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:timers/promises", + "node:tls", "somename" ], "typesRegistry": {}, @@ -3198,7 +3166,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:tls", + "node:trace_events", "somename" ], "typesRegistry": {}, @@ -3230,7 +3198,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:trace_events", + "node:tty", "somename" ], "typesRegistry": {}, @@ -3262,7 +3230,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:tty", + "node:url", "somename" ], "typesRegistry": {}, @@ -3294,7 +3262,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:url", + "node:util", "somename" ], "typesRegistry": {}, @@ -3326,7 +3294,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:util", + "node:util/types", "somename" ], "typesRegistry": {}, @@ -3358,7 +3326,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:util/types", + "node:v8", "somename" ], "typesRegistry": {}, @@ -3390,7 +3358,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:v8", + "node:vm", "somename" ], "typesRegistry": {}, @@ -3422,7 +3390,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:vm", + "node:wasi", "somename" ], "typesRegistry": {}, @@ -3454,7 +3422,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:wasi", + "node:worker_threads", "somename" ], "typesRegistry": {}, @@ -3486,7 +3454,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:worker_threads", + "node:zlib", "somename" ], "typesRegistry": {}, @@ -3518,7 +3486,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:zlib", + "node:quic", "somename" ], "typesRegistry": {},