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
however when I create a .d.ts file, the type of Status will not be the same. This is caused by the incorrect declare const in the declaration file that changes the numeric string keys to a number.
typeStatus=404
π Expected behavior
Given the example source code, the type for Status when referring to the declaration file will be the same as in the source code.
typeStatus="404"
Note: this issue does not reproduce if the numeric string key used in the object is not a variable.
constSTATUS={"404": "not found"}asconst;typeStatus=keyoftypeofSTATUS;// type Status = "404"// the result will be the same for both the source file and the type declaration file
The text was updated successfully, but these errors were encountered:
π Search Terms
numeric string key object
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/MYewdgzgLgBAygFQIIIKpxgXhgbwFAyEwDaARACwAM5pAugFwylgiwBmIArmACal4BfGAEMIMUJCgBuPHigBPAA4BTeFGFROY7AGtl8kGxgKVh+MjRwgA
π» Code
π Actual behavior
the type of
Status
will be the following.however when I create a .d.ts file, the type of
Status
will not be the same. This is caused by the incorrectdeclare const
in the declaration file that changes the numeric string keys to a number.π Expected behavior
Given the example source code, the type for
Status
when referring to the declaration file will be the same as in the source code.Note: this issue does not reproduce if the numeric string key used in the object is not a variable.
The text was updated successfully, but these errors were encountered: