Skip to content

Conversation

alexdlm
Copy link
Contributor

@alexdlm alexdlm commented Aug 10, 2022

Before this PR

Flavored aliases are great but don't quite afford enough type safety in projects that require stricter typing to avoid accidental misuse, at the cost of requiring more intentional type assertions.

Hopefully the readme additions describe/justify the difference and tradeoff between flavorizing & branded.

After this PR

==COMMIT_MSG==
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented Aug 10, 2022

Generate changelog in changelog/@unreleased

Type
See change types. Select one:

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add brandedAliases option for strongly branded aliases

Check the box to generate changelog(s)

  • Generate changelog entry


const irDir = path.join(__dirname, "../../../../build/ir-test-cases");
const testCaseDir = path.join(__dirname, "resources/test-cases");
const brandedTestCaseDir = path.join(__dirname, "resources/branded-test-cases");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was torn on duplicating the test-cases again and having a whole other copy of these generated files for this generatorTest, but I think it's good to be clear and actually differentiate the flavored from branded.

It does make for some noise now in this PR though, at least you can skip over anything src/commands/generate/__tests__/resources/branded-test-cases/** (they're also the only added files)

Comment on lines -85 to +99
`\t${FLAVOR_TYPE_FIELD}?: "${definition.typeName.name}",`,
`\t${FLAVOR_PACKAGE_FIELD}?: "${definition.typeName.package}",`,
`\t${FLAVOR_TYPE_FIELD}${maybeOptional}: "${definition.typeName.name}",`,
`\t${FLAVOR_PACKAGE_FIELD}${maybeOptional}: "${definition.typeName.package}",`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only actual generator change

@alexdlm alexdlm marked this pull request as ready for review August 10, 2022 11:29
@alexdlm alexdlm requested review from mt-bt and p-szm August 10, 2022 11:29
Copy link

stale bot commented Jun 27, 2025

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

@stale stale bot added the stale label Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants