Commit bea18eb
fix(transformer): preserve accessor type annotation for emitDecoratorMetadata
`@dec accessor x: T` previously emitted `design:type = Object` regardless of
`T`. Lowering rewrites the accessor into a private storage field plus a
synthesized getter/setter pair and transfers the decorators to the getter,
but it dropped the type annotation. The metadata pass then read the synth
getter's empty `return_type` and fell through to `Object` for every typed
accessor field — including primitives the metadata serializer handles
correctly elsewhere.
Route `accessor.type_annotation` onto the synth getter's `return_type` so
the existing getter path serializes it as `design:type`. The synth setter
(no decorators, no metadata) keeps `None`. `Reflect.getMetadata("design:type", ...)`
now returns the correct constructor for `string` / `number` / `boolean` / etc.
Refs #21922 (bug 7).
Co-Authored-By: Claude <[email protected]>1 parent 5adca29 commit bea18eb
4 files changed
Lines changed: 107 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
359 | 361 | | |
360 | 362 | | |
361 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
362 | 368 | | |
363 | 369 | | |
364 | 370 | | |
| |||
426 | 432 | | |
427 | 433 | | |
428 | 434 | | |
| 435 | + | |
429 | 436 | | |
430 | 437 | | |
431 | 438 | | |
| |||
439 | 446 | | |
440 | 447 | | |
441 | 448 | | |
| 449 | + | |
442 | 450 | | |
443 | 451 | | |
444 | 452 | | |
| |||
467 | 475 | | |
468 | 476 | | |
469 | 477 | | |
| 478 | + | |
470 | 479 | | |
471 | 480 | | |
472 | 481 | | |
| |||
539 | 548 | | |
540 | 549 | | |
541 | 550 | | |
542 | | - | |
| 551 | + | |
543 | 552 | | |
544 | 553 | | |
545 | 554 | | |
| |||
549 | 558 | | |
550 | 559 | | |
551 | 560 | | |
552 | | - | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
553 | 568 | | |
554 | 569 | | |
555 | 570 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments