False recursive reference

Anyone know how I can get past this false positive claiming I'm recursively referencing process.env in its base type? Since the value is just being used to compute the base type, not in the actual base type, this should be okay.

import { type } from "arktype";

const env = type({
  ...(process.env.NODE_ENV === "production" && {
    DATABASE_URL: 'string'
  }),
});

export const assertEnv = () => env.assert(process.env);

type Env = typeof env.infer;
declare global {
  namespace NodeJS {
    interface ProcessEnv extends Env {}
  }
}
Was this page helpful?