You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript's supported decorators as experimental for a while, but version 5.0 supports ECMAScript stage 3 decorators. For a while I've been wondering how to use a class decorator to build a subclass. Not having the type information is annoying.
Hm, a better name for this might be MergeClass, as we can hit this without decorators. Also, because there's already Merge and Class types in type-fest.
ajvincent
changed the title
Add a type for decorated classes
Add a type for merging classes
Apr 9, 2023
TypeScript's documentation for class decorators makes one thing clear, at the very end of the section: any new class fields you define are not available after the decorator returns.
TypeScript's supported decorators as experimental for a while, but version 5.0 supports ECMAScript stage 3 decorators. For a while I've been wondering how to use a class decorator to build a subclass. Not having the type information is annoying.
I have a minimal fix, though.
https://github.com/ajvincent/es-membrane/blob/master/_01_stage_utilities/source/DecoratedClass.mts
With a simple test:
https://github.com/ajvincent/es-membrane/blob/master/_01_stage_utilities/spec/DecoratedClass.mts
I'm still working through the function code, but the
DecoratedClass
type works pretty well.Upvote & Fund
The text was updated successfully, but these errors were encountered: