Skip to content

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Oct 11, 2025

Getter and setter methods should not have design:returntype metadata according to TypeScript's emitDecoratorMetadata behavior. They should only have design:type and design:paramtypes.

And design:type is different for the getter and setter:

Getter: design:type is the same as the return type of method.
Setter: design:type is the same as the type of the first parameter of the method

Copy link
Member Author

Dunqing commented Oct 11, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-bug Category - Bug labels Oct 11, 2025
@Dunqing Dunqing changed the title fix(transformer): skip design:returntype metadata for getter/setter methods fix(transformer/legacy-decorator): skip design:returntype metadata for getter/setter methods Oct 11, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 11, 2025

CodSpeed Performance Report

Merging #14495 will not alter performance

Comparing 10-11-fix_transformer_skip_design_returntype_metadata_for_getter_setter_methods (eae13e6) with main (bec7a7d)

Summary

✅ 33 untouched
⏩ 4 skipped1

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Dunqing Dunqing force-pushed the 10-11-fix_transformer_skip_design_returntype_metadata_for_getter_setter_methods branch 2 times, most recently from 82bc0f9 to 81cc96a Compare October 11, 2025 09:12
@Dunqing Dunqing changed the title fix(transformer/legacy-decorator): skip design:returntype metadata for getter/setter methods fix(transformer/legacy-decorator): correct generating metadata for getter/setter methods Oct 13, 2025
@Dunqing Dunqing marked this pull request as ready for review October 14, 2025 02:01
Copilot AI review requested due to automatic review settings October 14, 2025 02:01
Copy link
Contributor

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

This PR fixes the TypeScript decorator metadata generation for getter and setter methods to match TypeScript's emitDecoratorMetadata behavior. Getter and setter methods should not include design:returntype metadata, only design:type and design:paramtypes.

  • Fixed metadata generation to exclude design:returntype for getter/setter methods
  • Updated the method metadata stack to use optional expressions to handle varying metadata counts
  • Added test coverage for getter/setter method metadata behavior

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/oxc_transformer/src/decorator/legacy/metadata.rs Modified metadata generation logic to conditionally include return type metadata and updated data structures to support optional expressions
crates/oxc_transformer/src/decorator/legacy/mod.rs Updated metadata processing to handle optional expressions with flattening
tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/getter-setter-method/input.ts Added test input with decorated getter, setter, and regular method
tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/getter-setter-method/output.js Expected output showing correct metadata generation (no returntype for getter/setter)
tasks/transform_conformance/snapshots/oxc.snap.md Updated test results to reflect the new passing test

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Dunqing Dunqing force-pushed the 10-11-fix_transformer_skip_design_returntype_metadata_for_getter_setter_methods branch 2 times, most recently from 7ac6dc8 to 5ca03ef Compare October 15, 2025 09:42
@Dunqing Dunqing force-pushed the 10-11-fix_transformer_skip_design_returntype_metadata_for_getter_setter_methods branch 2 times, most recently from 45a037c to eae13e6 Compare October 17, 2025 02:06
@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Oct 22, 2025
Copy link
Member Author

Dunqing commented Oct 22, 2025

Merge activity

…tter/setter methods (#14495)

* Fixes: #14493

Getter and setter methods should not have `design:returntype` metadata according to TypeScript's `emitDecoratorMetadata` behavior. They should only have `design:type` and `design:paramtypes`.

**And `design:type` is different for the getter and setter:**

Getter: `design:type` is the same as the return type of method.
Setter: `design:type` is the same as the type of the first parameter of the method
@graphite-app graphite-app bot force-pushed the 10-11-fix_transformer_skip_design_returntype_metadata_for_getter_setter_methods branch from eae13e6 to 2bc1978 Compare October 22, 2025 08:57
@graphite-app graphite-app bot merged commit 2bc1978 into main Oct 22, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 10-11-fix_transformer_skip_design_returntype_metadata_for_getter_setter_methods branch October 22, 2025 09:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transformer: miscalculates design:returntype for getter properties

3 participants