I prefer here to accept Generics instead of using any:
// User can defined its own Generics
// TypeScript also accepts default types, but this requires certain version to support this IIRC.
export interface Config<T = {}, U = {}> {
ctx?: T;
data?: U;
}
Big thanks to the TypeScript rewrite. Stumbled upon the interface and thinking that this can be improved to leverage the power of the language.
https://github.com/wilk/microjob/blob/ed9bf9ed158514b6c24ca0e3500338b512fb5bab/src/interfaces.ts#L1-L4
I prefer here to accept Generics instead of using
any
: