Flow should be able to infer literal types of constant literal expressions (template literal constant folding)
Open
feature request
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Flow version: 0.93
## Expected behavior
Flow typing should work
.
## Actual behavior
It does not work.
Here is link to [playground](https://flow.org/try/#0PTAEAEDMBsHsHcBQiAuBPADgU1AIQIYAmA5jgLygDkAzgMawCuKloAPlQEZGmXLragAkvQB2oCjXpMW7SYxQBZAJbVqSkcRmduWLZS4ksy1es3IAbvgBOoJaIBcQ0QG4L10AdKOCh8VTrylK6IdrBiFAAGACQA3p5YAL7GahoRiEA)
```
// @flow
type Badge = 'scout' | 'badge'
type Icon = 'scout' | 'scoutMissing' | 'badge' | 'badgeMissing'
var icon: Icon;
var badge: Badge = 'scout';
icon = `${badge}Missing`
```

Contributor guide
Assessment
This issue has not been assessed yet.