Repository navigation
Conversation
pranav256
force-pushed
the
fix/force-module-detection
branch
from
October 29, 2026 06:48
202280c to
d12d13c
Compare
pranav256
force-pushed
the
fix/force-module-detection
branch
from
October 29, 2026 07:34
d12d13c to
85724a1
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1611.
Summary
The document registry passes only the language target into source-file creation,
so TypeScript's compiler-option-aware external-module classification is missing.
With
moduleDetection: Force, otherwise unrelated files are therefore treatedas scripts sharing the global scope.
update paths via
CreateSourceFileOptions.behavior. Existing compiler-option invalidation also reparses cached files
correctly with the classification metadata.
Reproduction and regression coverage
Two forced-module files each containing
const a = 'a';currently produce twofalse TS2451 diagnostics, whereas native TypeScript produces none. Conversely,
an unimported interface from another file incorrectly becomes visible and hides
the TS2304 error native TypeScript reports.
Registry and project tests compare against native TypeScript and cover both
diagnostic directions, declaration globals, acquisition/update/keyed updates,
manipulation/reparsing, language-service diagnostics, retained node identity,
and warmed Legacy-to-Force / Force-to-Legacy option changes.
Validation
(
933 common + 84 bootstrap + 4390 ts-morph).git diff --check: pass.lockfiles have no changes.
An initial whole-workspace build exceeded the local timeout during declaration
generation. Subsequent canonical source compile/code checks and the complete
workspace test suite all completed successfully. A supplemental direct
tscrun reports the same 391 diagnostic-code counts on baseline and patched
ts-morph source; common/bootstrap direct checks pass.
AI assistance was used for investigation, implementation and regression tests.
The source changes, native TypeScript control cases, and validation evidence
were reviewed before submission.