File tree Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -4948,24 +4948,27 @@ namespace ts {
49484948 }
49494949
49504950 function getTypeListId(types: Type[]) {
4951+ let result = "";
49514952 if (types) {
4952- switch (types.length) {
4953- case 1:
4954- return "" + types[0].id;
4955- case 2:
4956- return types[0].id + "," + types[1].id;
4957- default:
4958- let result = "";
4959- for (let i = 0; i < types.length; i++) {
4960- if (i > 0) {
4961- result += ",";
4962- }
4963- result += types[i].id;
4964- }
4965- return result;
4953+ const length = types.length;
4954+ let i = 0;
4955+ while (i < length) {
4956+ const startId = types[i].id;
4957+ let count = 1;
4958+ while (i + count < length && types[i + count].id === startId + count) {
4959+ count++;
4960+ }
4961+ if (result.length) {
4962+ result += ",";
4963+ }
4964+ result += startId;
4965+ if (count > 1) {
4966+ result += ":" + count;
4967+ }
4968+ i += count;
49664969 }
49674970 }
4968- return "" ;
4971+ return result ;
49694972 }
49704973
49714974 // This function is used to propagate certain flags when creating new object type references and union types.
You can’t perform that action at this time.
0 commit comments