Literals in return positions are widened despite being typed using const
type variables
#56858
Labels
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
π Search Terms
literal widening const type variable primitive
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.0-dev.20231223#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXwxAGcMAeMPE+AFQD4AKWAcwC556BKeAXlpo7bUAUEIqoqcIsggYAjDwLEM9Tjz4BtAOSIcOTQF0OQgPTH45+AD0A-KMoZ4k6RgBMCwiRVde8AAY6cABIAbwBZKAwACwA6GChUYBwAW04AX18jUwsrWzEJYmcAZnclLzV4bV1NTLMLGxEgA
π» Code
π Actual behavior
result3
is inferred asstring
π Expected behavior
result3
should be inferred as"foo"
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: