-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
How to tell flow that a dynamic string is just like a normal string #9253
Labels
bug
Typing: completeness
No false positives (type checker claims that there are some errors in the correct program)
Comments
tempalte_string
is the same as 'tempalte_string'
\
template_string\` is the same as
'template_string'`
\
template_string\` is the same as
'template_string'`template_string
is the same as 'template_string'
template_string
is the same as 'template_string'
\
template_string\``` is the same as
'template_string'`
\
template_string\``` is the same as
'template_string'` \
template_string\
is the same as 'template_string'
\
template_string\
is the same as 'template_string'
template_string
is the same as 'template_string'
template_string
is the same as 'template_string'
template_string
is the same as
'template_string'`
template_string
is the same as
'template_string'`template_string\
is the same as 'template_string'
template_string\
is the same as 'template_string'
This is a result of our contextual typing heuristics. For now, we only use specific syntactic patterns (e.g. only literal) to help pick one of the disjoint union. There might be something we can do better here, since TS is able to do that. |
A workaround could be setting the prop twice: e.g.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Typing: completeness
No false positives (type checker claims that there are some errors in the correct program)
Flow version: 0.259.1
Expected behavior
No error.
Actual behavior
Flow treats "dynamic" strings in a different way.
https://flow.org/try/#1N4Igxg9gdgZglgcxALlAIwIZoKYBsD6uEEAztvhgE6UYCe+JADpdhgCYowa5kA0I2KAFcAtiRQAXSkOz9sADwxgJ+NPTbYuQ3BMnTZA+Y2yU4IwRO4A6SFBIrGVDGM7c+h46fNRLuKxJIGWh8MeT0ZfhYlCStpHzNsFBAMIQkIEQwJODAQfiEyfBE4eWw2fDgofDBMsAALfAA3KjgsXGxxZC4eAw0G-GhcWn9aY3wWZldu-g1mbGqJUoBaCRHEzrcDEgBrbAk62kXhXFxJ923d-cPRHEpTgyEoMDaqZdW7vKgoOfaSKgOKpqmDA+d4gB5fMA-P6LCCMLLQbiLOoYCqgh6-GDYRYIXYLSgkRZkCR4jpddwPfJLZjpOBkO4AX34kA0SRWxgABAAFSiwkjsgC87IAJAAlVhsADyUEGAB5gAAdKDs5Xs6JwaAASTYyHZ9lMUAQvEVKvZ0G5Px1AAoqAgSKg2LTHHtalaAJQCgB87IaEDgbHp7v5Xp9fsV9K9AB9hWL2FLZQqlSq1Zq2AB+ZAhthGxPKs0sEh29mWwPB31sMMexWK2z2dkAQStjGQ3N5Je9ZYFRbbwHpVce0FryagWp1eoqCE7AAMAIyTvt1y0Jk1DrXZk15i2Lh1MGq1AOe9nAbdOurF3tQAPzxfGpPKdXD7XsgDkT5s0HmlpfrrXKo3BeQW6Oru+5Boex67meYauleS63vCD46k+05Pj+uZQOa-6ATuzogV6R5Ac6kEXq6uQgA0JgkPeSQNAADFYABMACsACcVjTiA9JAA
The text was updated successfully, but these errors were encountered: