Skip to content

Commit aea1bf4

Browse files
committed
Types
1 parent e434e83 commit aea1bf4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/build/patches.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import type {
77
WebIdl,
88
Method,
99
Typed,
10+
Signature,
11+
Param,
1012
} from "./types.js";
1113
import { readdir, readFile } from "fs/promises";
1214
import { merge } from "./helpers.js";
@@ -147,7 +149,7 @@ function handleMixinandInterfaces(
147149

148150
const event: Event[] = [];
149151
const property: Record<string, Partial<Property>> = {};
150-
const method: Record<string, Partial<Method>> = {};
152+
const method: Record<string, DeepPartial<Method>> = {};
151153

152154
for (const child of node.children) {
153155
switch (child.name) {
@@ -235,11 +237,11 @@ function handleProperty(child: Node): Partial<Property> {
235237
* Handles a child node of type "method" and adds it to the method object.
236238
* @param child The child node to handle.
237239
*/
238-
function handleMethod(child: Node): Partial<Method> {
240+
function handleMethod(child: Node): DeepPartial<Method> {
239241
const name = string(child.values[0]);
240242

241243
let typeNode: Node | undefined;
242-
const params: { name: string; type?: string; overrideType?: string }[] = [];
244+
const params: Partial<Param>[] = [];
243245

244246
for (const c of child.children) {
245247
switch (c.name) {
@@ -267,14 +269,14 @@ function handleMethod(child: Node): Partial<Method> {
267269
}
268270
}
269271

270-
const signature: Method["signature"] = [
272+
const signature: DeepPartial<Signature>[] = [
271273
{
272274
param: params,
273275
...(typeNode
274276
? handleTyped(typeNode)
275277
: { type: string(child.properties?.returns) }),
276278
},
277-
] as Method["signature"];
279+
];
278280
return { name, signature };
279281
}
280282

0 commit comments

Comments
 (0)