diff --git a/Shared.fsx b/Shared.fsx index 2bbf6e6ba..3224a3438 100644 --- a/Shared.fsx +++ b/Shared.fsx @@ -69,6 +69,7 @@ module JsonItems = | Indexer | SignatureOverload | TypeDef + | Extends override x.ToString() = (unionToString x).ToLower() let findItem (allItems: ItemsType.Root []) (itemName: string) (kind: ItemKind) otherFilter = diff --git a/TS.fsx b/TS.fsx index 5af30d637..1b1842940 100644 --- a/TS.fsx +++ b/TS.fsx @@ -381,8 +381,15 @@ let EmitNamedConstructors () = let EmitInterfaceDeclaration (i:Browser.Interface) = Pt.printl "interface %s" i.Name - match i.Extends::(List.ofArray i.Implements) with - | [""] | [] | ["Object"] -> () + let extendsFromSpec = + match i.Extends::(List.ofArray i.Implements) with + | [""] | [] | ["Object"] -> [] + | specExtends -> specExtends + let extendsFromJson = + JsonItems.getAddedItemsByInterfaceName ItemKind.Extends Flavor.All i.Name + |> Array.map (fun e -> e.BaseInterface.Value) |> List.ofArray + match List.concat [extendsFromSpec; extendsFromJson] with + | [] -> () | allExtends -> Pt.print " extends %s" (String.Join(", ", allExtends)) Pt.print " {" diff --git a/inputfiles/sample.json b/inputfiles/sample.json index 545c2224a..b1a22edd5 100644 --- a/inputfiles/sample.json +++ b/inputfiles/sample.json @@ -330,5 +330,10 @@ "kind": "typedef", "name": "IDBValidKey", "type": "number | string | Date | IDBArrayKey" + }, + { + "kind": "extends", + "baseInterface": "ParentNode", + "interface": "Document" } ]