humbertaco
humbertaco4mo ago

Hi there, I think there is a tiny

Hi there, I think there is a tiny problem with the types defined in the CallbackHandler constructor (see attached screenshot). If the root parameter is specified, it must be different than undefined. However, the current configuration of types allows for the following situation:
new CallbackHandler({root: undefined, enabled: true});
new CallbackHandler({root: undefined, enabled: true});
The code above won't make the compiler complain, but if we run the code an exception will throw because the constructor of the CallbackHandler is trying to access root.client since the key root is in the object, although it is undefined.
No description
2 Replies
hassiebp
hassiebp4mo ago
Thanks for the report, @humbertaco ! We have added a backlog task to narrow the types here. Background: Since all keys in KeyParams are optional, having { root: undefined } is interpreted as a valid value for that side of the type union.
humbertaco
humbertaco4mo ago
Hi @hassiebp, thanks for looking into this! Indeed, that is the thing. It would be nice however to refine a bit the types so that situation is either better handled in the constructor of the CallbackHandler, or flagged by the compiler as an error.