Last active
January 12, 2020 15:11
-
-
Save yunghoy/71d7768d4170e78a3dff7a09c3a313e5 to your computer and use it in GitHub Desktop.
Revisions
-
yunghoy revised this gist
Jan 12, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ From the codes I wrote 3 years ago. Find code from my cloud storage. }; console.log(JSON.stringify(test2)); interface KeyValue3 { // Actually, key field in the definition of type is not that important. [a: string]: string; } const test3: KeyValue3 = { -
yunghoy renamed this gist
Jan 12, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
yunghoy created this gist
Jan 12, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ From the codes I wrote 3 years ago. Find code from my cloud storage. interface KeyValue1 { [key: string]: string[]; } const test1: KeyValue1 = { "key1": ["value1"], "key2": ["value2"], }; console.log(JSON.stringify(test1)); interface KeyValue2 { [key: string]: string; } const test2: KeyValue2 = { "key1": "value1", "key2": "value2", }; console.log(JSON.stringify(test2)); interface KeyValue3 { [a: string]: string; } const test3: KeyValue3 = { "key1": "value1", "key2": "value2", }; console.log(JSON.stringify(test3)); interface KeyValue4 { [key: number]: string; } const test4: KeyValue4 = { 1: "value1", 2: "value2", }; console.log(JSON.stringify(test4)); const test11: KeyValue1[] = [ { "key1": ["value1"], "key2": ["value2"], }, { "key3": ["value3"], "key4": ["value4"], } ]; console.log(JSON.stringify(test11));