Skip to content

feat(semantic): add TS2670 error for global scope augmentation without declare modifier#16746

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/12-11-feat_semantic_add_ts_2670_error_for_global_scope_augmentation_without_declare_modifier
Dec 11, 2025
Merged

feat(semantic): add TS2670 error for global scope augmentation without declare modifier#16746
graphite-app[bot] merged 1 commit intomainfrom
c/12-11-feat_semantic_add_ts_2670_error_for_global_scope_augmentation_without_declare_modifier

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Dec 11, 2025

Report error when global { } is used without declare modifier and not in an already ambient context (like .d.ts files or inside declare module blocks).

Discovered while working on #16743

🤖 generated with help from Claude Opus 4.5

@github-actions github-actions bot added the A-semantic Area - Semantic label Dec 11, 2025
Copy link
Contributor Author

camc314 commented Dec 11, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Dec 11, 2025
@camc314 camc314 force-pushed the c/12-11-feat_semantic_add_ts_2670_error_for_global_scope_augmentation_without_declare_modifier branch from b3969c4 to e177d94 Compare December 11, 2025 11:53
@camc314 camc314 marked this pull request as ready for review December 11, 2025 11:53
@camc314 camc314 requested a review from Dunqing as a code owner December 11, 2025 11:53
Copilot AI review requested due to automatic review settings December 11, 2025 11:53
@camc314 camc314 changed the title feat(semantic): add TS(2670) error for global scope augmentation without declare modifier feat(semantic): add TS2670 error for global scope augmentation without declare modifier Dec 11, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds semantic checking for TypeScript's TS(2670) error, which requires global scope augmentations to have the declare modifier unless they're already in an ambient context (like .d.ts files or inside declare module blocks). The check prevents incorrect usage of global { } blocks without the proper declare keyword.

Key Changes

  • Adds new TypeScript semantic check for global scope augmentations requiring declare modifier
  • Updates test coverage snapshot showing one additional negative test case now passing (moduleAugmentationGlobal6_1.ts)

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_semantic/src/checker/typescript.rs Implements the TS(2670) diagnostic check by adding validation logic to check_ts_global_declaration
tasks/coverage/snapshots/parser_typescript.snap Updates test coverage metrics and removes moduleAugmentationGlobal6_1.ts from expected failures, showing the error is now properly detected

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 11, 2025

CodSpeed Performance Report

Merging #16746 will not alter performance

Comparing c/12-11-feat_semantic_add_ts_2670_error_for_global_scope_augmentation_without_declare_modifier (e177d94) with main (3ffe342)1

Summary

✅ 42 untouched
⏩ 3 skipped2

Footnotes

  1. No successful run was found on main (6432aff) during the generation of this report, so 3ffe342 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 11, 2025

Merge activity

…t declare modifier (#16746)

Report error when `global { }` is used without `declare` modifier and not in an already ambient context (like .d.ts files or inside `declare module` blocks).

Discovered while working on #16743

🤖 generated with help from Claude Opus 4.5
@graphite-app graphite-app bot force-pushed the c/12-11-feat_semantic_add_ts_2670_error_for_global_scope_augmentation_without_declare_modifier branch from e177d94 to 083e081 Compare December 11, 2025 13:27
@graphite-app graphite-app bot merged commit 083e081 into main Dec 11, 2025
20 checks passed
@graphite-app graphite-app bot deleted the c/12-11-feat_semantic_add_ts_2670_error_for_global_scope_augmentation_without_declare_modifier branch December 11, 2025 13:34
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-semantic Area - Semantic C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants