Repository navigation
Fix #19666: Check for symbol types in template expressions - #22251
Mohamed Hegazy (mhegazy) merged 3 commits into
Conversation
| @@ -0,0 +1,8 @@ | |||
| // Fix #19666 | |||
|
|
|||
| let symbol!: symbol; | |||
There was a problem hiding this comment.
I'm not huge on the test file name here, but it's fine. Can you add a case where you have a value of type symbol | number (or something in a union)?
There was a problem hiding this comment.
Will do. I'm open to changing the name. Perhaps templateStringWithSymbolExpressionErrors.ts ?
|
I think you should just leave the type of the string literal to be a string; the type of the expression itself isn't observed otherwise. The only time we are concerned with the expression type is a tagged template. Which reminds me! Can you add a test with the following contents? 😄 // taggedTemplateStringWithSymbolExpression01.ts
declare function foo(template: any, val: symbol): number;
let x!: symbol;
let result: number = foo `${x}`;Ideally, the test output won't have any errors. |
|
Update: Daniel Rosenwasser (@DanielRosenwasser)
To consider: |
|
ping Daniel Rosenwasser (@DanielRosenwasser) (just incase this got lost under a pile somewhere) |
Fixes #19666
Check for symbol types in template expressions:
The following cases were already handled (but have been added to the tests):
This PR does not deal with tagged templates.
Question: Should the type of the checked expression be
anywhen encountering an error?Mohamed Hegazy (@mhegazy)