fix(typing): augment node types (kinda)

do some finagling to shut typescript up about "staging" being an invalid value for `process.env.NODE_ENV`
This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2024-12-09 15:55:05 -05:00
parent f447c0f88f
commit 0898a622eb
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C
4 changed files with 32 additions and 3 deletions

1
index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="typings/node-ext.d.ts">

View File

@ -1,9 +1,10 @@
// https://nuxt.com/docs/api/configuration/nuxt-config // https://nuxt.com/docs/api/configuration/nuxt-config
import { IUser } from "@models/user"; import { IUser } from "@models/user";
import { render } from "vue";
import { rc } from "./lib/server/constants"; import { rc } from "./lib/server/constants";
import { defineNuxtConfig } from "nuxt/config"; import { defineNuxtConfig } from "nuxt/config";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { StorageMounts } from "nitropack";
import { uri } from "./lib/dbconfig";
const cac = { const cac = {
isr: true, isr: true,
@ -141,7 +142,11 @@ export default defineNuxtConfig({
runtimeConfig: rc, runtimeConfig: rc,
typescript: { typescript: {
tsConfig: { 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: { imports: {

View File

@ -8,6 +8,22 @@
"noImplicitThis": false, "noImplicitThis": false,
"verbatimModuleSyntax": false, "verbatimModuleSyntax": false,
"forceConsistentCasingInFileNames": 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"
]
} }

7
typings/node-ext.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
declare global {
namespace NodeJS {
interface ProcessEnv {
NODE_ENV: ("development" | "staging" | "production" | "test") & (string & {});
}
}
}