This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree 3 files changed +27
-14
lines changed
main/java/com/google/javascript/cl2dts
test/java/com/google/javascript/cl2dts
3 files changed +27
-14
lines changed Original file line number Diff line number Diff line change @@ -633,19 +633,24 @@ public Void caseTemplatizedType(TemplatizedType type) {
633
633
emit ("[]" );
634
634
return null ;
635
635
}
636
- // Arguments<?> and NodeList<?> in es3 externs are correspondinly
637
- // IArguments and NodeList interfaces (not-parametrized) in lib.d.ts.
638
- // New* are temporary work-arounds for upstream externs.
639
- // TODO(rado): upgrade closure compiler and remove them.
640
- if (type .getDisplayName ().equals ("Arguments" ) ||
641
- type .getDisplayName ().equals ("NewArguments" )) {
642
- emit ("IArguments" );
643
- return null ;
644
- }
645
- if (type .getDisplayName ().equals ("NodeList" ) ||
646
- type .getDisplayName ().equals ("NewNodeList" )) {
647
- emit ("NodeList" );
648
- return null ;
636
+ switch (type .getDisplayName ()) {
637
+ // Arguments<?> and NodeList<?> in es3 externs are correspondinly
638
+ // IArguments and NodeList interfaces (not-parametrized) in lib.d.ts.
639
+ // New* are temporary work-arounds for upstream externs.
640
+ // TODO(rado): upgrade closure compiler and remove them.
641
+ case "Arguments" :
642
+ case "NewArguments" :{
643
+ emit ("IArguments" );
644
+ return null ;
645
+ }
646
+ case "NodeList" :
647
+ case "NewNodeList" : {
648
+ emit ("NodeList" );
649
+ return null ;
650
+ }
651
+ case "IThenable" : {
652
+ templateTypeName = "PromiseLike" ;
653
+ }
649
654
}
650
655
Iterator <JSType > it = type .getTemplateTypes ().iterator ();
651
656
if (typeRegistry .getNativeType (OBJECT_TYPE ).equals (referencedType )) {
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ declare namespace ಠ_ಠ.cl2dts_internal.typesWithExterns {
16
16
var c : NodeList | IArguments | { length : number } ;
17
17
function id ( x : NodeList | IArguments | { length : number } ) : NodeList | IArguments | { length : number } ;
18
18
function topLevelFunction ( ...a : any [ ] ) : any ;
19
+ interface ExtendsIThenable extends PromiseLike < any > {
20
+ }
19
21
}
20
22
declare module 'goog:typesWithExterns' {
21
23
import alias = ಠ_ಠ . cl2dts_internal . typesWithExterns ;
Original file line number Diff line number Diff line change @@ -92,4 +92,10 @@ typesWithExterns.id = function(x) { return x; }
92
92
/**
93
93
* @type {!Function }
94
94
*/
95
- typesWithExterns . topLevelFunction = function ( ) { } ;
95
+ typesWithExterns . topLevelFunction = function ( ) { } ;
96
+
97
+ /**
98
+ * @interface
99
+ * @extends {IThenable }
100
+ */
101
+ typesWithExterns . ExtendsIThenable = function ( ) { } ;
You can’t perform that action at this time.
0 commit comments