File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ export type InterfaceIR = {
128128 extraBases ?: string [ ] ;
129129 // This is used to decide whether the class should be a Protocol or not.
130130 concrete ?: boolean ;
131+ jsobject ?: boolean ;
131132 // Control how numbers are rendered in the class. Normally they are rendered
132133 // as int | float, but sometimes we just want it to be written as int.
133134 // This is handled in an adhoc manner in adjustInterfaceIR.
@@ -1175,6 +1176,7 @@ export class Converter {
11751176 [ ] ,
11761177 typeParams ,
11771178 ) ;
1179+ concreteIR . jsobject = true ;
11781180 this . nameContext = undefined ;
11791181 return [ ifaceIR , concreteIR ] ;
11801182 }
@@ -1278,7 +1280,9 @@ export class Converter {
12781280 //
12791281 // Otherwise it's a global namespace object?
12801282 try {
1281- return this . membersDeclarationToIR ( name , typeNode , [ ] , [ ] ) ;
1283+ const res = this . membersDeclarationToIR ( name , typeNode , [ ] , [ ] ) ;
1284+ res . jsobject = true ;
1285+ return res ;
12821286 } catch ( e ) {
12831287 console . warn ( varDecl . getText ( ) ) ;
12841288 console . warn ( getNodeLocation ( varDecl ) ) ;
@@ -1326,6 +1330,7 @@ export class Converter {
13261330 [ ] ,
13271331 typeParams ,
13281332 ) ;
1333+ result . jsobject = true ;
13291334
13301335 this . ifaceTypeParamConstraints . clear ( ) ;
13311336
Original file line number Diff line number Diff line change @@ -67,10 +67,10 @@ function fixupClassBases(nameToCls: Map<string, InterfaceIR>): void {
6767 }
6868 }
6969 }
70- if ( cls . name . endsWith ( "_iface" ) && ! cls . concrete ) {
70+ if ( ! cls . jsobject && ! cls . concrete ) {
7171 cls . extraBases . push ( "Protocol" ) ;
7272 }
73- if ( ! cls . name . endsWith ( "_iface" ) ) {
73+ if ( cls . jsobject ) {
7474 cls . extraBases . push ( "_JsObject" ) ;
7575 }
7676 cls . bases . sort ( ( { name : a } , { name : b } ) => {
Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ describe("emit", () => {
472472 const res = emitFile ( "declare var a : boolean;" ) ;
473473 assert . strictEqual ( removeTypeIgnores ( res . at ( - 1 ) ! ) , "a: bool = ..." ) ;
474474 } ) ;
475- it ( "extends" , ( ) => {
475+ it ( "interface extends tests " , ( ) => {
476476 const res = emitFile ( `
477477 interface B {
478478 b: number;
You can’t perform that action at this time.
0 commit comments