You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Identify implicit symbol to string coercion errors #19666
When down emitting, the string literal is emitted as the last line, so the run-time behaviour is consistent between ES6 and down emitted code, but in both cases, TypeScript could identify them at errors at design time and prevent implicit coercion.
Expected behavior:
That TypeScript would error on the last two lines, replicating the run-time error, thereby statically identifying the error.
I had no idea that some of these were errors. The second to last line being an error freaks me out... I definitely would value the compiler's help here.
Aluan Haddad (@aluanhaddad) yeah, we had been using string literals for explicit implicit coercion (if that is a thing) and were about to do it for a symbol, but double checked at run-time and realised that it didn't work!
Activity
aluanhaddad commentedon Nov 2, 2017
I had no idea that some of these were errors. The second to last line being an error freaks me out... I definitely would value the compiler's help here.
kitsonk commentedon Nov 3, 2017
Aluan Haddad (@aluanhaddad) yeah, we had been using string literals for explicit implicit coercion (if that is a thing) and were about to do it for a symbol, but double checked at run-time and realised that it didn't work!
DanielRosenwasser commentedon Nov 3, 2017
The same behavior would be expected for BigInt as well, so there's that to consider.
mhegazy commentedon Nov 6, 2017
looks like an error indeed. we should flag this while checking
mhegazy commentedon Nov 6, 2017
To be specific, nothing else changes, only symbols for now; we will handle other builtin types like BigInt as they come.
mhegazy commentedon Nov 6, 2017
PRs are welcomed.
Merge pull request #22251 from jack-williams/jack-williams/no-implici…