Skip to content

Commit d2ce62e

Browse files
committed
-
1 parent 8350852 commit d2ce62e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/build/patches.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,12 @@ function handleTypeParameters(value: Value) {
9696
* Converts parsed KDL Document nodes to match the [types](types.d.ts).
9797
*/
9898
function convertKDLNodes(nodes: Node[]): DeepPartial<WebIdl> {
99-
// Accept either Document or array of nodes
100-
const actualNodes: Node[] = Array.isArray(nodes)
101-
? nodes
102-
: nodes;
103-
10499
const enums: Record<string, Enum> = {};
105100
const mixin: Record<string, DeepPartial<Interface>> = {};
106101
const interfaces: Record<string, DeepPartial<Interface>> = {};
107102
const dictionary: Record<string, DeepPartial<Dictionary>> = {};
108103

109-
for (const node of actualNodes) {
104+
for (const node of nodes) {
110105
// Note: no "removals" handling here; caller is responsible for splitting
111106
const name = string(node.values[0]);
112107
switch (node.name) {
@@ -132,8 +127,8 @@ function convertKDLNodes(nodes: Node[]): DeepPartial<WebIdl> {
132127
...optionalMember("mixins.mixin", "object", mixin),
133128
...optionalMember("interfaces.interface", "object", interfaces),
134129
dictionaries: {
135-
dictionary
136-
}
130+
dictionary,
131+
},
137132
};
138133
}
139134

@@ -407,7 +402,7 @@ function sanitizeRemovals(obj: unknown): unknown {
407402
return result.length === 0 ? null : result;
408403
}
409404
if (obj && typeof obj === "object") {
410-
const newObj: { [key: string]: unknown } = {};
405+
const newObj: Record<string, unknown> = {};
411406
for (const [key, value] of Object.entries(obj)) {
412407
if (key !== "name") {
413408
const cleaned = sanitizeRemovals(value);

0 commit comments

Comments
 (0)