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

Add brandedAliases option for strongly branded aliases #225

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

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

@@ -106,6 +106,7 @@ export { integrationSecond };

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants