Repository navigation
fix: keep class features and using native where Node.js runs them - #819
Merged
Merged
Conversation
Class fields, #private members and static blocks are now lowered only when the emitted class has to differ from the source ([[Set]] field semantics or legacy decorators). `using` / `await using` are lowered only when the running Node.js is older than 24. Closes #808 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01J7Bsyf8U45ySQyKDX1bAU3
Brooooooklyn
marked this pull request as ready for review
October 10, 2026 03:21
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e029959edc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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.
Requested by Brooklyn · project thread
Closes #808
Before: class fields,
#privatemembers and static blocks were always lowered (_defineProperty,WeakMaps, helper imports), andusing/await usingwere always lowered tousingCtx, on every Node.js version.Function.prototype.toString(), stack traces and the debugger saw the lowered class.After: class features reach Node.js as written unless the class has to differ from the source, which means
[[Set]]field semantics (useDefineForClassFields: false) orexperimentalDecorators.usingis lowered only when the running Node.js is older than 24. Most scripts now import no helpers at all.How:
transform_programsetsclass_properties/class_static_blockfromset_public_class_fields || legacy_decorators, as the issue proposes. Amodule_exportshook readsEnv::get_node_version()once when the addon loads and stores whetherusingis native. If the version can't be read (for example a WASI host without the call, orcargo test),usingstays lowered.One visible change: with native fields, a field initializer that reads a TypeScript parameter property (
b = this.a; constructor(public a) {}) now runs before the parameter is assigned. That is exactly whattscemits for ES2022+ with[[Define]], andtscreports it as TS2729.Tests:
class-fields.spec.tschecks that class features stay native by default and withuseDefineForClassFields: true, that they are still lowered withuseDefineForClassFields: falseorexperimentalDecorators, and thatusingis native exactly on Node.js ≥ 24.helper-imports.spec.tsfixtures now setexperimentalDecorators, so they still emit a helper on every Node.js version. The bare-directory and poisoned-copy rows gained that tsconfig too, because without it they would pass without loading any helper.cargo clippy -D warnings,cargo test,vp checkandpnpm testpass locally on Node.js 22.22 and 24.21.🤖 Generated with Claude Code
https://claude.ai/code/session_01J7Bsyf8U45ySQyKDX1bAU3
Generated by Claude Code