fix: improve types for callback-related config (#135)

* fix: allow partial callbacks in config types

* fix: allow non-async callback functions in config types

* fix: specify type of monitor argument in callback type

* fix: use generics type for env argument in callback type
This commit is contained in:
keito authored and GitHub committed 2025-08-07 18:47:19 +08:00
1 parent 7156fd83f2
commit 5769a52f0c
2 files changed
+16 -14

No files matched your search

+3 -3
View File
@@ -179,7 +179,7 @@ const Worker = {
}
console.log('Calling config onStatusChange callback...')
await workerConfig.callbacks?.onStatusChange(
await workerConfig.callbacks?.onStatusChange?.(
env,
monitor,
true,
@@ -250,7 +250,7 @@ const Worker = {
if (monitorStatusChanged) {
console.log('Calling config onStatusChange callback...')
await workerConfig.callbacks?.onStatusChange(
await workerConfig.callbacks?.onStatusChange?.(
env,
monitor,
false,
@@ -266,7 +266,7 @@ const Worker = {
try {
console.log('Calling config onIncident callback...')
await workerConfig.callbacks?.onIncident(
await workerConfig.callbacks?.onIncident?.(
env,
monitor,
currentIncident.start[0],