Skip to content

fix: allow using nullable strings in template literals #2928

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

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

CountBleck
Copy link
Member

Fixes #2918.

Changes proposed in this pull request:
⯈ Allow using nullable strings in template literals, by converting null to "null"

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@CountBleck CountBleck changed the title fix: WIP: allow using nullable strings in template literals fix: allow using nullable strings in template literals Jun 3, 2025
We basically compile nullable strings down to a ternary:
`expr ? expr.toString() : "null"`

Fixes AssemblyScript#2918.
@CountBleck CountBleck force-pushed the nullable-template-arg branch from 6cbc181 to 52b8b92 Compare June 3, 2025 16:31
@CountBleck CountBleck requested a review from HerrCai0907 June 3, 2025 16:31
@CountBleck CountBleck marked this pull request as ready for review June 3, 2025 16:31
@CountBleck CountBleck merged commit 4e5fe9c into AssemblyScript:main Jun 3, 2025
14 checks passed
@CountBleck CountBleck deleted the nullable-template-arg branch June 3, 2025 22:43
@CountBleck
Copy link
Member Author

Whoops, in my haste to check if I needed to rebase the PR, I forgot that nobody reviewed it yet...

@mattjohnsonpint
Copy link
Contributor

LGTM. 😅

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.

Can't use nullable strings in template literal
2 participants