Skip to content

Commit 43fbd92

Browse files
authored
fix: uses appropriate typings for property read/write request payloads (#78)
This PR fixes a mistyping affecting read/write request payloads. For some reason, the payloads of events modelling read/write requests had been defined separately and independently of the payload actually returned by the .decode() function of the service handler matching the incoming request. See src/lib/client.ts@530 for the parser invocation See src/lib/client.ts@557 for triggering of service request events I need this to surface the `priority` value at the typings level, so that I may use it to address bacnet-js/device#32 .
1 parent a331f17 commit 43fbd92

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

src/lib/EventTypes.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import {
2828
BACNetObjectID,
2929
BACNetPropertyID,
3030
BACNetAppData,
31+
WritePropertyRequest,
32+
ReadPropertyRequest,
3133
} from './types'
3234

3335
export type Constructor<T = object> = new (...args: any[]) => T
@@ -74,22 +76,12 @@ export interface BaseEventContent {
7476

7577
// These more specific interfaces help TypeScript provide better IntelliSense
7678
export interface ReadPropertyContent extends BaseEventContent {
77-
payload: {
78-
objectId: BACNetObjectID
79-
property: BACNetPropertyID
80-
}
79+
payload: ReadPropertyRequest
8180
address?: string
8281
}
8382

8483
export interface WritePropertyContent extends BaseEventContent {
85-
payload: {
86-
objectId: BACNetObjectID
87-
property?: BACNetPropertyID
88-
value?: {
89-
property?: BACNetPropertyID
90-
value?: BACNetAppData | BACNetAppData[]
91-
}
92-
}
84+
payload: WritePropertyRequest
9385
}
9486

9587
export interface ReadPropertyMultipleContent extends BaseEventContent {

0 commit comments

Comments
 (0)