Support TypeScript 7.1 API - #1704
Conversation
|
@copilot update ts-loader/.github/workflows/push.yml Line 52 in 53082fb ts-loader/.github/workflows/push.yml Line 84 in 53082fb We expect execution-tests to pass after this change |
Updated in |
|
@copilot great work! We would like the following to succeed:
Remember backwards compatibility is not required - feel free to make changes |
Verified on |
|
@copilot we have explictly removed the historic typescript version from dependencies and moved to use 7.1 directly. This has broken compilation. Please fix it. You will likely need to use new APIs in TypeScript 7 to achieve this. No cheating. |
Updated in |
|
@copilot make |
Addressed in |
…ub.com/TypeStrong/ts-loader into copilot/implement-new-tsgo-api-support
…by testing Isolated and reverted each individually against real Windows CI (full suite where the change had broad reach, targeted tests otherwise) - all three passed without the change, confirming they were never load-bearing: - bumpMtimes in the comparison-test harness: added chasing a watchpack mtime-equality theory for dependencyErrors that turned out wrong; the actual fix was in getDirectResolvedImports (already in place). - ensureSyntheticConfigForFile's files-array path normalization: added before the real fix (syntheticConfigContents' store-side key normalization, which remains); the API evidently normalizes each files-array entry internally regardless of separator style. - registerTypeScriptDependencies' getConfigFileNames loop normalization: added speculatively alongside the confirmed addDependency fix in the same edit; never independently exercised by any actual failure. Full local suite (50/50) and full Windows CI suite (50/50) still pass with all three removed.
|
Custom transformers and transpile support in the API can be tracked here: microsoft/TypeScript#63875 |
|
Add support for transpile directly now this PR has landed: microsoft/typescript-go#4849 (comment) courtesy of @andrewbranch - expected in nightlies soon |
|
3b5af16 added support for microsoft/typescript-go#4849. Very smooth initial migration. Claude picked up a potential issue which I have reported here: microsoft/typescript-go#4849 (comment) Windows comparison tests are failing right now - fixing. |
api.transpileModule/transpileDeclaration build their own virtual
filesystem from `fileName` verbatim rather than resolving it through a
Project, so an OS-native (backslash) path panics on Windows ("mixed
posix and windows paths") and also breaks diagnostic location lookup
(the echoed diagnostic.fileName no longer matches the OS-native
apiFileName used as the lookup key).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
api.transpileDeclaration builds its own throwaway virtual filesystem
from `fileName` verbatim rather than resolving it through a Project,
and panics on Windows ("mixed posix and windows paths") given any
absolute path there - OS-native or forward-slash-normalized alike.
Stripping the OS-native configFilePath from compilerOptions and
falling back a rootDir were both tried first and, per the Windows
test probe workflow, neither stopped the panic.
The actual fix: pass transpileDeclaration a bare basename instead of
any absolute path at all. Unlike transpileModule (which needs
fileName's real directory for e.g. rootDir-containment diagnostics
like TS6059, and keeps its own absolute, forward-slash path),
transpileDeclaration doesn't need real directory context - its own
diagnostics (isolatedDeclarations violations) are purely syntactic,
and any real rootDir violation for the same file is already caught by
transpileModule's own call on it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
a2ad345 to
7f1cbd5
Compare
This PR migrates ts-loader to fully support and integrate with the TypeScript 7.1+ Native API (powered by the tsgo engine). Ignore the ESLint failures - TypeScript ESLint also doesn't yet support TS 7. It'll come!
The implementation has moved past the initial hybrid/experimental design to route core operations through the native typescript/unstable/sync architecture by default. Historical TypeScript version dependencies have been removed in favour of direct 7.1 alignment.
🚀 What Changed
📦 Integration Details
🧪 Verification Status