Skip to content

Commit

Permalink
Make event returns always optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Derpius committed Aug 13, 2023
1 parent d06e029 commit ef0d96b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ function generateReturns(rets?: DocReturn[]): string {
}

// This can be refactored out once the overload rework on the language server is done
function generateInlineReturns(rets?: DocReturn[]): string {
function generateInlineReturns(rets?: DocReturn[], areAllOptional?: boolean): string {
if (rets === undefined) return "";
return (
": " +
rets
.map((ret) => {
const type = generateType(ret);
return type.toString() + (type.optional ? "?" : "");
return type.toString() + (areAllOptional || type.optional ? "?" : "");
})
.join(", ")
);
Expand Down Expand Up @@ -310,7 +310,7 @@ function generateClassAnnotations(
.join(", ");
}
callbackSig = `fun(${callbackSig})${generateInlineReturns(
event.return
event.return, true
)}`;

subOverloads += `\n---@overload fun(${
Expand Down

0 comments on commit ef0d96b

Please sign in to comment.