Skip to content

Can't use nullable strings in template literal #2918

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

Open
mattjohnsonpint opened this issue May 13, 2025 · 0 comments
Open

Can't use nullable strings in template literal #2918

mattjohnsonpint opened this issue May 13, 2025 · 0 comments
Labels

Comments

@mattjohnsonpint
Copy link
Contributor

Bug description

Template literal strings can interpolate most scalar value types, including strings, numbers, booleans, etc.

However, trying to use a nullable string in a template literal currently leads to a compiler error.

Steps to reproduce

const x: string | null = "abc";  
const s = `test: '${x}'`
ERROR TS2685: The 'this' types of each signature are incompatible.
     :
   2 │ const s = `test: '${x}'`
     │                     ~
     └─ in assembly/index.ts(3,23)
     :
 644 │ toString(): String {
     │ ~~~~~~~~~~~~~~~~~~
     └─ in ~lib/string.ts(644,3)

AssemblyScript version

v0.27.36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant