Skip to content

Token transform#623

Open
mrginglymus wants to merge 2 commits intoterrazzoapp:mainfrom
mrginglymus:token-transform
Open

Token transform#623
mrginglymus wants to merge 2 commits intoterrazzoapp:mainfrom
mrginglymus:token-transform

Conversation

@mrginglymus
Copy link
Contributor

Changes

Reworking of #621

I realised that the default transformAlias does throw errors on undefined:

export function defaultAliasTransform(token: TokenNormalized) {
if (!token) {
throw new Error('Undefined token');
}

However, when a user-provided function is given, this assertion is lost.

Instead of having to update every transform, update the entrypoint to wrap any user-provided transformAlias with an assertion. This means we can burn a lot more !.

How to Review

How can a reviewer review your changes? What should be kept in mind for this review?

@changeset-bot
Copy link

changeset-bot bot commented Dec 17, 2025

⚠️ No Changeset found

Latest commit: e1b948d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

export function defaultAliasTransform(token: TokenNormalized) {
export function defaultAliasTransform(token: TokenNormalized | undefined) {
if (!token) {
throw new Error('Undefined token');
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 still isn't a huge improvement as we don't know what the token originally was...

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.

1 participant