Support .ts module imports in TypeSpec source files#10956
Draft
Copilot wants to merge 8 commits into
Draft
Conversation
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for importing TypeScript files from TypeSpec
Support Jun 10, 2026
.ts module imports in TypeSpec source files
Member
|
@copilot can we have one e2e test here also? |
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Contributor
Author
Added an e2e scenario coverage for this in |
commit: |
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.
TypeSpec imports currently recognize
.tsp,.js, and.mjs, which prevents directly importing TypeScript decorator modules. This change adds first-class.tsimport recognition so TypeSpec routes those imports through the existing JS module loading path.Compiler import classification
getSourceFileKindFromExtto classify.tsas"js"inpackages/compiler/src/core/source-file.ts.import "./decorators.ts";to flow through the same runtime import path as existing JS imports.Import checker coverage
.tsimport tests inpackages/compiler/test/checker/imports.test.ts, mirroring existing.jscoverage:.tsimport.tsimportCompiler e2e coverage
packages/compiler/test/e2e/scenarios/import-relative-ts/and wired it intopackages/compiler/test/e2e/scenarios/scenarios.e2e.ts../decorators.tscompiles successfully.Language docs
website/src/content/docs/docs/language-basics/imports.mdto list.tsas a supported explicit file extension for imports.