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
5.3 const type parameter const like array readonly
🕗 Version & Regression Information
EDIT: replace my unintuitive attempt at indicating a range of versions for clarity - This changed between versions 5.0.4, 5.1.6, 5.2.2 and 5.3.3, 5.4.0-dev.20240129
newBehavior is able to infer t as ["foo"] on 5.3+.
🙂 Expected behavior
I would expect newBehavior to infer t as string[] as it did on previous versions and a readonly modifier must be used to infer ["foo"] (well, technically, readonly ["foo"]), as is mentioned is required on the pull request and announcement that introduced this feature.
Additional information about the issue
I'm curious if this is expected behavior and can be relied upon in future versions. Thanks!
The text was updated successfully, but these errors were encountered:
Thank you for the quick reply and apologies for the duplicate issue. Feeling silly my search terms didn't find #57107, removing "5.3" from the search terms finds it🤦.
🔎 Search Terms
5.3 const type parameter const like array readonly
🕗 Version & Regression Information
EDIT: replace my unintuitive attempt at indicating a range of versions for clarity
- This changed between versions 5.0.4, 5.1.6, 5.2.2 and 5.3.3, 5.4.0-dev.20240129⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.3.3#code/MYewdgzgLgBADgJwKYDcCWICuEBCSAWAhuiAjALwwA8oksAKjEgB5RJgAmEMyhH4AGwCeMaAjRgA5gG0AugD4AFFABcMegEoK8mFADcAKFrRdSaAAVkJbBXhWM2PERIJF0gEQAzECHeyNhgD0gTChMAB6APwGRuAmYEgA7k7EGGSUNHEMTKzsXKJQ4lJySqrqWuQ6+rF0ptAAckm2CckEqaRuXj5+AQbBYRGRQA
💻 Code
🙁 Actual behavior
newBehavior
is able to infert
as["foo"]
on 5.3+.🙂 Expected behavior
I would expect
newBehavior
to infert
asstring[]
as it did on previous versions and areadonly
modifier must be used to infer["foo"]
(well, technically,readonly ["foo"]
), as is mentioned is required on the pull request and announcement that introduced this feature.Additional information about the issue
I'm curious if this is expected behavior and can be relied upon in future versions. Thanks!
The text was updated successfully, but these errors were encountered: