Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ts): add flattenSubclassesToUnion param #78

Merged
merged 1 commit into from
Nov 24, 2023
Merged

Conversation

mttrbrts
Copy link
Member

@mttrbrts mttrbrts commented Nov 24, 2023

Some client applications have a preference for union types over inheritance and subclasses (even inside TypeScript).

This change introduces a new parameter that lets the client application control which variant to use when generating TypeScript from Concerto.

Changes

  • Adds flattenSubclassesToUnion parameter to the TypeScriptVisitor. The existing behaviour is still the default

For example, when flattenSubclassesToUnion = true, we generate the following code

export interface IDecorator extends IConcept {
   name: string;
   arguments?: DecoratorLiteralUnion[];
   location?: IRange;
}

instead of the default

export interface IDecorator extends IConcept {
   name: string;
   arguments?: IDecoratorLiteral[];
   location?: IRange;
}

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

@coveralls
Copy link

Coverage Status

coverage: 98.886% (-0.02%) from 98.91%
when pulling 97640fc on mr-flattensubclasses
into e38396e on main.

@mttrbrts mttrbrts requested a review from a team November 24, 2023 10:56
@mttrbrts mttrbrts self-assigned this Nov 24, 2023
@mttrbrts mttrbrts added this to the v3.x milestone Nov 24, 2023
@mttrbrts mttrbrts marked this pull request as ready for review November 24, 2023 11:00
Copy link
Contributor

@dselman dselman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@mttrbrts mttrbrts merged commit af903c3 into main Nov 24, 2023
11 checks passed
@mttrbrts mttrbrts deleted the mr-flattensubclasses branch November 24, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants