From 0898a622eb7deff24331f5f9bef093abcc70e768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Mon, 9 Dec 2024 15:55:05 -0500 Subject: [PATCH] fix(typing): augment node types (kinda) do some finagling to shut typescript up about "staging" being an invalid value for `process.env.NODE_ENV` --- index.d.ts | 1 + nuxt.config.ts | 9 +++++++-- tsconfig.json | 18 +++++++++++++++++- typings/node-ext.d.ts | 7 +++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 index.d.ts create mode 100644 typings/node-ext.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..0ee47e7 --- /dev/null +++ b/index.d.ts @@ -0,0 +1 @@ +/// diff --git a/nuxt.config.ts b/nuxt.config.ts index ae2917d..388d66f 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,9 +1,10 @@ // https://nuxt.com/docs/api/configuration/nuxt-config import { IUser } from "@models/user"; -import { render } from "vue"; import { rc } from "./lib/server/constants"; import { defineNuxtConfig } from "nuxt/config"; import { fileURLToPath } from "url"; +import { StorageMounts } from "nitropack"; +import { uri } from "./lib/dbconfig"; const cac = { isr: true, @@ -141,7 +142,11 @@ export default defineNuxtConfig({ runtimeConfig: rc, typescript: { tsConfig: { - exclude: ["./.nuxt/types/auth.d.ts"], + exclude: ["./.nuxt/types/auth.d.ts", "../**/node_modules/next/**/*.d.ts"], + compilerOptions: { + typeRoots: ["typings/**/*.d.ts"], + types: ["typings/node-ext.d.ts"], + }, }, }, imports: { diff --git a/tsconfig.json b/tsconfig.json index 5968bd0..302d0bd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,22 @@ "noImplicitThis": false, "verbatimModuleSyntax": false, "forceConsistentCasingInFileNames": false, - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "types": [ + "./typings/fuck-you.ts", + "./typings/*.d.ts" + ], + "typeRoots": [ + "typings/**/*.d.ts", + "typings" + ] }, + "exclude": [ + "**/node_modules/next/**/*.d.ts" + ], + "include": [ + "typings/**/*.d.ts", + "typings/node-ext.d.ts", + "nuxt.config.ts" + ] } diff --git a/typings/node-ext.d.ts b/typings/node-ext.d.ts new file mode 100644 index 0000000..3bb9c88 --- /dev/null +++ b/typings/node-ext.d.ts @@ -0,0 +1,7 @@ +declare global { + namespace NodeJS { + interface ProcessEnv { + NODE_ENV: ("development" | "staging" | "production" | "test") & (string & {}); + } + } +}