Skip to content

Fix #187: support TypeScript v6 and let test features work.#188

Open
samchon wants to merge 6 commits intononara:masterfrom
samchon:master
Open

Fix #187: support TypeScript v6 and let test features work.#188
samchon wants to merge 6 commits intononara:masterfrom
samchon:master

Conversation

@samchon
Copy link
Copy Markdown
Contributor

@samchon samchon commented Mar 24, 2026

This pull request adds support for TypeScript 6.x, including proper handling of modules that are now thin wrappers and do not require independent patching. It also improves compatibility with Node.js 22.12+ native ESM support, updates TypeScript dependencies, and makes several adjustments to TypeScript and test configurations to suppress deprecation warnings and ensure correct root directories.

TypeScript 6.x Support and Module Patching:

  • Added logic to detect and skip patching of "thin wrapper" modules (like tsserverlibrary.js and tsserver.js) in TypeScript 6+, since they delegate to typescript.js and don't need independent patching (TsModule.isPatchable). [1] [2] [3]
  • Updated the check and patch actions to report and skip these non-patchable modules, providing clear log messages to users. [1] [2]

ESM and Node.js Compatibility:

  • Enhanced ESM module loading to use Node.js's native require for ESM modules on Node 22.12+ and fall back to the esm package only when necessary. [1] [2]
  • Updated test expectations to account for native ESM support in newer Node.js versions.

Dependency and Configuration Updates:

  • Updated TypeScript dependency to ~6.0.2 in package.json.
  • Added "ignoreDeprecations": "6.0" to various tsconfig.json files to suppress deprecation warnings for TypeScript 6.x. [1] [2] [3] [4]
  • Ensured correct rootDir and types settings in tsconfig.json files for both source and test projects. [1] [2] [3] [4] [5]

Plugin and Registration Improvements:

  • Adjusted plugin registration to set ignoreDeprecations automatically for TypeScript 6+. [1] [2]

These changes collectively improve compatibility with the latest TypeScript and Node.js versions, streamline module patching, and reduce noise from deprecation warnings.

Copilot AI review requested due to automatic review settings March 24, 2026 06:34
Copy link
Copy Markdown

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

Adds TypeScript 6.x compatibility across the patching pipeline and test harness, including new logic to skip patching TS6 “thin wrapper” modules and improved ESM loading behavior for newer Node runtimes.

Changes:

  • Update TypeScript dependency to ~6.0.2 and adjust tsconfig settings (incl. ignoreDeprecations: "6.0" and rootDir/types fixes).
  • Introduce “non-patchable” module detection (TS 6+) and wire it into check/patch flows with user-facing logs.
  • Improve ESM loading behavior and update webpack ESM test expectations based on Node version.

Reviewed changes

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

Show a summary per file
File Description
yarn.lock Updates lockfile for TypeScript 6.0.2.
package.json Bumps TypeScript dependency to ~6.0.2.
tsconfig.base.json Adds ignoreDeprecations: "6.0" to suppress TS6 warnings.
test/tsconfig.json Adds types: ["jest","node"] to stabilize test typing.
test/tests/webpack.test.ts Adjusts ESM/no-esm-package test behavior for Node 22.12+.
test/assets/projects/webpack/tsconfig.json Adds ignoreDeprecations: "6.0" for TS6 test project noise reduction.
test/assets/projects/path-mapping/tsconfig.plugin.json Sets rootDir to align emitted paths with includes.
test/assets/projects/path-mapping/tsconfig.json Adds ignoreDeprecations: "6.0" for TS6 compatibility.
test/assets/projects/package-config/tsconfig.json Sets rootDir to align emitted paths with includes.
projects/patch/tsconfig.json Sets rootDir and ignoreDeprecations for TS6 builds.
projects/patch/src/plugin/register-plugin.ts Automatically sets ignoreDeprecations for TS6+ when registering ts-node.
projects/patch/src/plugin/esm-intercept.ts Attempts native ESM require first, falls back to esm package.
projects/core/tsconfig.json Adds Node types for core build typing consistency.
projects/core/src/module/ts-module.ts Adds TsModule.isPatchable() + TS6 non-patchable module list.
projects/core/src/actions/patch.ts Skips patching non-patchable modules with logging.
projects/core/src/actions/check.ts Reports non-patchable modules and skips patch checks for them.

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

Copy link
Copy Markdown
Contributor Author

@samchon samchon left a comment

Choose a reason for hiding this comment

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

@nonara I have done my best to work with Claude Code.

On my local machine, yarn test passes every time, but it fails for several test cases in GitHub Actions. This is happening on the master branch as well, and I am not sure how to resolve this.

I have preemptively applied this to typia as well, and it works well. Please finalize and publish this - samchon/typia#1804

Copy link
Copy Markdown

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

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


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

Comment on lines +35 to +36
- name: Clean yarn cache
run: yarn cache clean
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

yarn cache clean is run before the test step, but the test harness spins up fixture projects and runs yarn --check-cache ... installs (see test/src/project.ts). Cleaning the cache here removes the warm cache and forces network downloads during tests, increasing CI time and adding avoidable flakiness. If the goal is to free disk space, consider moving cache cleanup after tests, or restoring dependency caching (e.g. via actions/cache) instead of clearing it mid-job.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

@samchon samchon left a comment

Choose a reason for hiding this comment

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

Also tested samchon/nestia#1442, and no problem.

@nonara
Copy link
Copy Markdown
Owner

nonara commented Mar 27, 2026

Thanks @samchon. If there are failures, I'll need to check them out, but I'm sure we can get it passing.

Appreciate the hard work. Will try to review Sunday.

Copy link
Copy Markdown
Contributor Author

@samchon samchon left a comment

Choose a reason for hiding this comment

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

Thank you. As TypeScript team is saying they will start keeping the semver, it would be the last version on both ts-patch and typia. Let's see again in golang ecosystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants