Skip to content

Commit

Permalink
fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Dec 10, 2023
1 parent e70de43 commit f063195
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ class Context {
* @returns {ep is ActionEndpoint}
*/
isActionEndpoint(ep) {
return ep && "action" in ep && ep.action != null;
// @ts-ignore
return ep?.action != null;
}

/**
Expand All @@ -232,7 +233,8 @@ class Context {
* @returns {ep is EventEndpoint}
*/
isEventEndpoint(ep) {
return ep && "event" in ep && ep.event != null;
// @ts-ignore
return ep?.event != null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/registry/event-catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class EventCatalog {
* @memberof EventCatalog
*/
callEventHandler(ctx) {
/* @ts-ignore */
// @ts-ignore
return ctx.endpoint.event.handler(ctx);
}

Expand Down
2 changes: 1 addition & 1 deletion src/transporters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class BaseTransporter {
}
}

if (packet.type === P.PACKET_EVENT && packet.target == null && "groups" in packet.payload) {
if (packet.type === P.PACKET_EVENT && packet.target == null && packet.payload.groups) {
const groups = /** @type {PacketEventPayload} */ (packet.payload).groups;
// If the packet contains groups, we don't send the packet to
// the targetted node, but we push them to the event group queues
Expand Down
9 changes: 5 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"compilerOptions": {
"lib": ["ES2023"],
"moduleResolution": "node",
"target": "ES2022",

"allowJs": true,
"strict": false,
"checkJs": true,
"declaration": true,
"skipLibCheck": false,
"declarationDir": "generated-types",
"outDir": "dist",
"target": "ES2022",
"moduleResolution": "node",
"noEmit": true,
"lib": ["ES2022"],
"resolveJsonModule": true
},
"include": ["types/extends.d.ts", "src/**/*.js"],
"include": ["types/extends.d.ts", "src/**/*.js", "src/**/*.d.ts"],
"exclude": ["node_modules", ".eslintrc.js", "prettier.config.js"]
}

0 comments on commit f063195

Please sign in to comment.