-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Assigned { [key: string]: string; } | undefined is assumes that for any key there's an existing value
Steps to reproduce
The wrong type can be found in
| 'additionalData'?: { [key: string]: string; }; |
Actual behavior
NotificationRequestItem.additionalData field has a type that provides false information to the compiler. Accessing values from this field in TS results in string type instead of a string | undefined, as we have no guarantee that for any given key there will be a value, i.e., notificationItem.additionalData['fieldThatDoesNotExist'] will have type of string.
Expected behavior
To avoid the need to override the type manually or have manual not-nil checks, the assigned type could be
export class NotificationRequestItem {
'additionalData'?: { [key: string]: string | undefined; };or
export class NotificationRequestItem {
'additionalData'?: Record<string, string | undefined>;Code snippet or screenshots (if applicable)
No response
Adyen Node API Library version
28.1.0
Node.js version
20.19.4
NPM version
No response
Operating System
macOS
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working