typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

--experimentalDecorators and --emitDecoratorMetadata

Open weswigham opened this issue 2 weeks ago • 4 comments

This PR ports emit for --experimentalDecorators and --emitDecoratorMetadata, since many users of the former also enable the later (which isn't even supported with standardized decorators in strada, apparently).

This looks pretty solid from the baselines at this point, I've only noticed two things I still want to follow up on, or at least get someone else's opinion on:

  • The single sourcemap test'd diffs are still all outta line - there's just way more mappings. Something is probably missing a EFNoSourceMaps that should have it. Or it could just be class fields not being transformed yet. I'm unsure. (See sourceMapValidationDecorators.sourcemap.txt) Somewhere there's a nicer tool for viewing sourcemap diffs than our textual baselines, I just need to find it again...
  • There's a target: es5 test of a constructor reference to a decorated class within a static of that class - binding behavior here intentionally changes after es6, and the test is effectively targeting es6 now (thanks to the new minimum target), so it's probably fine, but I'm not wholly convinced.

Additionally, I haven't included the conditional lookup of the BigInt global in emit for targets < es2020 at present. I could add it back, I'm just not completely sure why it was needed in the first place, and with Symbol definitely no longer being maybe-conditional with min target es6, it was the only use of the conditional global type reference emit logic.

Most of the remaining diffs in the touched baselines that weren't outright deleted are just other unported emit features remaining in the diffs - class fields, mostly, and a little await.

Fixes #914

weswigham avatar Dec 11 '25 14:12 weswigham

The only other thing is to remove !!! emitDecoratorMetadata from program.go where we would have emitted an error on this option.

jakebailey avatar Dec 11 '25 19:12 jakebailey

Thank you for tackling this 🙏

tmm1 avatar Dec 11 '25 19:12 tmm1

  • Somewhere there's a nicer tool for viewing sourcemap diffs than our textual baselines, I just need to find it again...

Perhaps you're thinking of https://evanw.github.io/source-map-visualization

tmm1 avatar Dec 12 '25 00:12 tmm1

The only other thing is to remove !!! emitDecoratorMetadata from program.go where we would have emitted an error on this option.

AFAIK that's already gone, replaced with the error requiring emitDecoratorMetadata be specified alongside experimentalDecorators.

weswigham avatar Dec 12 '25 09:12 weswigham

Great news 🎉

jycouet avatar Dec 12 '25 18:12 jycouet

I am so happy to see this PR. I now know what to experiment this night. Thank you @weswigham and everyone involved for the work done.

mlarabi avatar Dec 15 '25 09:12 mlarabi