yoink-ts
v1.0.1
Published
print a type into an existing file to avoid circular `any`
Downloads
2
Readme
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 {}
}
}