diff --git a/lib/tunnelbroker/tunnelbroker-context.js b/lib/tunnelbroker/tunnelbroker-context.js --- a/lib/tunnelbroker/tunnelbroker-context.js +++ b/lib/tunnelbroker/tunnelbroker-context.js @@ -53,7 +53,7 @@ const listeners = React.useRef>(new Set()); const socket = React.useRef(null); const promises = React.useRef({}); - const heartbeatTimeoutID = React.useRef(); + const heartbeatTimeoutID = React.useRef(); const stopHeartbeatTimeout = React.useCallback(() => { if (heartbeatTimeoutID.current) { diff --git a/lib/types/tunnelbroker/connection-initialization-response-types.js b/lib/types/tunnelbroker/connection-initialization-response-types.js --- a/lib/types/tunnelbroker/connection-initialization-response-types.js +++ b/lib/types/tunnelbroker/connection-initialization-response-types.js @@ -5,13 +5,18 @@ import { tShape, tString } from '../../utils/validation-utils.js'; +type ConnectionInitializationSuccessStatus = { +type: 'Success' }; +type ConnectionInitializationErrorStatus = { +type: 'Error', +data: string }; export type ConnectionInitializationStatus = - | { +type: 'Success' } - | { +type: 'Error', +data: string }; + | ConnectionInitializationSuccessStatus + | ConnectionInitializationErrorStatus; const connectionInitializationStatusValidator = t.union([ - tShape({ type: tString('Success') }), - tShape({ type: tString('Error'), data: t.String }), + tShape({ type: tString('Success') }), + tShape({ + type: tString('Error'), + data: t.String, + }), ]); export type ConnectionInitializationResponse = { diff --git a/lib/types/tunnelbroker/message-to-device-request-status-types.js b/lib/types/tunnelbroker/message-to-device-request-status-types.js --- a/lib/types/tunnelbroker/message-to-device-request-status-types.js +++ b/lib/types/tunnelbroker/message-to-device-request-status-types.js @@ -15,17 +15,33 @@ error: t.String, }); +type MessageSentSuccessStatus = { +type: 'Success', +data: string }; +type MessageSentErrorStatus = { +type: 'Error', +data: Failure }; +type MessageSentInvalidRequestStatus = { +type: 'InvalidRequest' }; +type MessageSentSerializationErrorStatus = { + +type: 'SerializationError', + +data: string, +}; export type MessageSentStatus = - | { +type: 'Success', +data: string } - | { +type: 'Error', +data: Failure } - | { +type: 'InvalidRequest' } - | { +type: 'SerializationError', +data: string }; + | MessageSentSuccessStatus + | MessageSentErrorStatus + | MessageSentInvalidRequestStatus + | MessageSentSerializationErrorStatus; const messageSentStatusValidator = t.union([ - tShape({ type: tString('Success'), data: t.String }), - tShape({ type: tString('Error'), data: failureValidator }), - tShape({ type: tString('InvalidRequest') }), - tShape({ type: tString('SerializationError'), data: t.String }), + tShape({ + type: tString('Success'), + data: t.String, + }), + tShape({ + type: tString('Error'), + data: failureValidator, + }), + tShape({ type: tString('InvalidRequest') }), + tShape({ + type: tString('SerializationError'), + data: t.String, + }), ]); export type MessageToDeviceRequestStatus = {