Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions inputfiles/addedTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -340,27 +340,6 @@
"extends": "DOMRect",
"noInterfaceObject": true
},
/*
Keeping EventListener and EventListenerObject isn't the most elegant way to handle
the event listeners, but we need to keep the EventListener as an extendable interface
for libraries like angular.
*/
"EventListener": {
"name": "EventListener",
"noInterfaceObject": true,
"methods": {
"method": {
// This is a hack to add a call signature, but I think it's reasonable
// as it means we don't have to add a call signatures section to the
// emitter for this one case.
"callable": {
"overrideSignatures": [
"(evt: Event): void"
]
}
}
}
},
"EventListenerObject": {
"name": "EventListenerObject",
"noInterfaceObject": true,
Expand Down
6 changes: 6 additions & 0 deletions inputfiles/patches/forced-declare.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Keeping EventListener and EventListenerObject isn't the most elegant way to handle the event listeners, but we need to keep the EventListener as an extendable interface for libraries like angular.
interface EventListener noInterfaceObject=#true {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erm actually this is dom, let's put this in dom.kdl

method "" returns=void {
param evt type=Event
}
}
13 changes: 7 additions & 6 deletions src/build/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,18 @@ function handleMethod(child: Node): Partial<Method> {
}
}

if (!typeNode) {
throw new Error(`Method "${name}" is missing a return type`);
}

const signature: Method["signature"] = [
{
param: params,
...handleTyped(typeNode),
...(typeNode
? handleTyped(typeNode)
: { type: string(child.properties?.returns) }),
},
];
return { name, signature };
return {
...optionalMember("name", "string", name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should this be optionalMember?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to update it, done

signature,
};
}

/**
Expand Down