From e23a41200f703af88a0b3d0dd1c74139c4155640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Gonz=C3=A1lez=20V=C3=A1zquez?= Date: Tue, 5 Mar 2024 18:46:46 +0100 Subject: [PATCH] chore(typings): Fix typings for noColor check --- deno.json | 2 +- rubiks.ts | 16 +++++++++++++--- tsconfig.json | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/deno.json b/deno.json index df72a51..82d3f21 100644 --- a/deno.json +++ b/deno.json @@ -1,5 +1,5 @@ { "name": "@rubiks/rubiks", - "version": "1.2.1", + "version": "1.2.2", "exports": "./mod.ts" } diff --git a/rubiks.ts b/rubiks.ts index bd4d1a1..ec7c400 100644 --- a/rubiks.ts +++ b/rubiks.ts @@ -9,11 +9,21 @@ import { } from "./levels.ts"; import { type Modifier } from "./modifiers.ts"; +export interface Rubiks { + format: string; + level: string; +} + +interface Global { + process?: { env: Record } + Deno?: { noColor: boolean } +} + /** * Class that represents a rubiks logger, each instance has it's own settings and data. * @class */ -export class Rubiks { +export class Rubiks implements Rubiks { /** The format string that will end up being used for logging. */ format: string = "%s"; @@ -42,8 +52,8 @@ export class Rubiks { } constructor() { - const nc: string | undefined = globalThis.process?.env?.NO_COLOR; - if ((nc === undefined || nc === "") && !globalThis.Deno?.noColor) return; + const nc = (globalThis as Global).process?.env?.NO_COLOR; + if ((nc === undefined || nc === "") && !(globalThis as Global).Deno?.noColor) return; this.noColor = true; } diff --git a/tsconfig.json b/tsconfig.json index 249a427..b892a24 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,9 @@ "compilerOptions": { "target": "ESNext", "module": "ESNext", + "lib": [ + "ESNext" + ], "noEmit": true, "allowJs": true, "checkJs": true,