Skip to content

Commit fd87960

Browse files
committed
Support removing enums
1 parent c91b223 commit fd87960

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

inputfiles/patches/html.kdl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ interface NavigationPrecommitController exposed=Window {
2323
interface NavigationTransition {
2424
property committed exposed=Window
2525
}
26+
27+
removals {
28+
enum ValueType
29+
}

inputfiles/removedTypes.jsonc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
}
1212
}
1313
},
14-
"enums": {
15-
"enum": {
16-
"ValueType": null
17-
}
18-
},
1914
"interfaces": {
2015
"interface": {
2116
"Clipboard": {

src/build/patches.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function optionalNestedMember<T>(prop: string, object: object, output: T) {
8989
* Converts parsed KDL Document nodes to match the [types](types.d.ts).
9090
*/
9191
function convertKDLNodes(nodes: Node[]): DeepPartial<WebIdl> {
92-
const enums: Record<string, Enum> = {};
92+
const enums: Record<string, Partial<Enum>> = {};
9393
const mixin: Record<string, DeepPartial<Interface>> = {};
9494
const interfaces: Record<string, DeepPartial<Interface>> = {};
9595
const dictionary: Record<string, DeepPartial<Dictionary>> = {};
@@ -134,7 +134,7 @@ function convertKDLNodes(nodes: Node[]): DeepPartial<WebIdl> {
134134
* @param node The enum node to handle.
135135
* @param enums The record of enums to update.
136136
*/
137-
function handleEnum(node: Node): Enum {
137+
function handleEnum(node: Node): Partial<Enum> {
138138
const name = string(node.properties?.name || node.values[0]);
139139
const values: string[] = [];
140140

@@ -144,7 +144,7 @@ function handleEnum(node: Node): Enum {
144144

145145
return {
146146
name,
147-
value: values,
147+
...(values.length > 0 ? { value: values } : {}),
148148
...optionalMember(
149149
"legacyNamespace",
150150
"string",

0 commit comments

Comments
 (0)