MakeTypes icon indicating copy to clipboard operation
MakeTypes copied to clipboard

Is there a way to convert string type as strict type?

Open dotennin opened this issue 6 years ago • 1 comments

e.g. before

[
  {
    "ScriptId": "1",
    "ScriptCode": "NWRESTRN",
  },
  {
    "ScriptId": "2",
    "ScriptCode": "REPHSRESHP",
  }
]

after

Interface Script {
    ScriptId: '1' | '2',
    ScriptCode: 'NWRESTRN' | 'REPHSRESHP'
}

dotennin avatar Dec 12 '19 06:12 dotennin

Wouldn't that call for the need for an additional argument? ie: enums=ScriptCode,ScriptId

robgorham avatar Feb 07 '20 21:02 robgorham