1.0.1 • Published 7 months ago

yoink-ts v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

This would have been just a ReturnType<typeof myFunction>, but I needed to declaration merge the inferred result with process.env which was used inside of the function, resulting in any.

// env.mjs
const env = required({
  SOME_ENV_VAR: process.env.SOME_ENV_VAR,
});
// types.d.ts
import { env } from "./env.mjs";

interface Env {
  SOME_ENV_VAR: string;
}
declare global {
  namespace NodeJS {
    interface ProcessEnv extends Env {}
  }
}
1.0.1

7 months ago

1.0.0

7 months ago