mixpanel-node icon indicating copy to clipboard operation
mixpanel-node copied to clipboard

Type signature of `import_batch` (or `BatchCallback`) is incorrect

Open utdemir opened this issue 3 years ago • 0 comments

Currently, import_batch is typed like this:

type BatchCallback = (errors: [Error] | undefined) => any;

import_batch(eventNames: string[], options?: BatchOptions, callback?: BatchCallback): void;
import_batch(eventNames: string[], callback?: BatchCallback): void;
import_batch(events: Event[], callback?: BatchCallback): void;

However, we've observed the case where the callback we passed to import_batch returned null, which is not a subtype of [Error] | undefined. I do not yet know whether we ever get undefined, but the type of the return value should contain null.

(Also, I'm not sure about this one, but reading through the codebase I have a suspicion that BatchCallback takes another results parameter which is not present in the type definition above)

utdemir avatar Mar 14 '22 21:03 utdemir