Skip to content

Releases: rocicorp/logger

Typed loggers

17 Apr 12:10
@arv arv

Choose a tag to compare

Loggers can now have type parameters

This allows specializing what parameters debug, info, warn and error
can take.

For example:

type MyLogContext = LogContext<[string, number]>;

Would only allow error to be called with a [string, number].

declare const lc: MyLogContext;
lc.error?.('foo', 42); // ok
lc.error?.('foo', 'bar'); // error
lc.error?.('foo'); // error
lc.error?.(); // error