Skip to content

Commit e4c6284

Browse files
Bashamegasaschanaz
andauthored
Feature: Extend for mixins (#2096)
Co-authored-by: saschanaz <[email protected]>
1 parent bb3a20b commit e4c6284

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

inputfiles/overridingTypes.jsonc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
}
2020
}
2121
},
22-
"ChildNode": {
23-
"extends": "Node"
24-
},
25-
"ParentNode": {
26-
"extends": "Node"
27-
},
2822
"Animatable": {
2923
"methods": {
3024
"method": {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// ChildNode and ParentNode are actually defined as mixins, but because of their names they have historically been used as a sub-interface of Node.
2+
interface-mixin ChildNode extends=Node
3+
interface-mixin ParentNode extends=Node

src/build/patches.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@ function handleMixin(node: Node): DeepPartial<Interface> {
9292
}
9393
}
9494

95-
return {
95+
const result = {
9696
name,
9797
events: { event },
9898
properties: { property },
9999
} as DeepPartial<Interface>;
100+
if (node.properties.extends) {
101+
result.extends = node.properties.extends as string;
102+
}
103+
return result;
100104
}
101105

102106
/**

0 commit comments

Comments
 (0)