facebook / facebook/flow

Flow should be able to infer literal types of constant literal expressions (template literal constant folding)

Open
#7,499 1 comment 0 reactions 0 assignees View on GitHub
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`
```
screen shot 2019-02-21 at 1 51 46 pm

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.