-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Current type for load function's cb is:
export type INodeStyleCallBack<SuccessArg> = (err: Error, result?: SuccessArg) => void;But the err can also be null to indicate that the callback has no errors. If trying to invoke the callback with null or undefined, typescript complains with:
Argument of type 'null' is not assignable to parameter of type 'Error'.ts(2345)
I think the type should be
export type INodeStyleCallBack<SuccessArg> = (err: Error | null, result?: SuccessArg) => void;See for example in node types package:
export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;Metadata
Metadata
Assignees
Labels
No labels