Remove the @spina decorator on abstract classes.

Review Request #13738 — Created April 16, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

BaseVisibilityActionView was decorated with @spina, which isn't
technically allowed.

@spina should only be applied to classes that can be instantiated. For
abstract classes, we either want to use the parent class's Spina
information or use spinaBaseClassExtends to define a new top-level
class.

It seems that, by and large, decorators can't be used with abstract
classes. When compiling, we get basically:

const foo = abstract class Foo {}

This is a syntax error in JavaScript.

The reason we didn't encounter this problem before is that Babel was
stripping out the abstract when it processed the TypeScript and
compiled to JavaScript. The TypeScript compiler leaves it in, in order
to try to wrap it in a decorator.

Going forward, we'll need to be careful not to decorate these classes.

Unit tests pass.

Verified that this no longer broke the build when compiled via
ESBuild and Storybook.

Summary ID
Remove the @spina decorator on abstract classes.
`BaseVisibilityActionView` was decorated with `@spina`, which isn't technically allowed. `@spina` should only be applied to classes that can be instantiated. For abstract classes, we either want to use the parent class's Spina information or use `spinaBaseClassExtends` to define a new top-level class. It seems that, by and large, decorators can't be used with abstract classes. When compiling, we get basically: ```javascript const foo = abstract class Foo {} ``` This is a syntax error in JavaScript. The reason we didn't encounter this problem before is that Babel was stripping out the `abstract` when it processed the TypeScript and compiled to JavaScript. The TypeScript compiler leaves it in, in order to try to wrap it in a decorator. Going forward, we'll need to be careful not to decorate these classes.
296fef514ad67a4b3332f7217b2f2db8d2d15226
david
  1. Ship It!
  2. 
      
maubin
  1. We should note this down somewhere in Spina.

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-7.x (36582ec)
Loading...