From 8dfbd5ce98f4e5a924d58d387a00479c2717cba2 Mon Sep 17 00:00:00 2001 From: Yuriy Nemtsov Date: Sat, 23 Oct 2021 14:51:41 -0400 Subject: [PATCH] add TS types --- package.json | 1 + types.d.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 types.d.ts diff --git a/package.json b/package.json index 4bd9081..a5cda1d 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "url": "git://github.com/dowjones/namespaced-console-logger.git" }, "main": "lib/index", + "types": "types.d.ts", "author": "nemtsov@gmail.com", "license": "MIT", "scripts": { diff --git a/types.d.ts b/types.d.ts new file mode 100644 index 0000000..8ed112a --- /dev/null +++ b/types.d.ts @@ -0,0 +1,18 @@ +declare module "namespaced-console-logger" { + export type Logger = { + info(...args: string[]): void; + warn(...args: string[]): void; + error(...args: string[]): void; + }; + + export type Loggers = { + get(namespace: string): Logger; + }; + + export default function createLoggers( + level: "info" | "warn" | "error", + template: string, + templateDefaults: { [key: string]: string | (() => string) } + ): Loggers; +} +