held-env-copy-hold.ts:8:7 - error SC2014: a value held from process.env under a type other than the environment record (a string-keyed record of string | undefined) is not supported: the hold is a snapshot copy taken where it is created, so its reads would see the environment as it was then while Node reads the live environment

  7 | // a fixed-field annotation: tsc admits it through the index signature
  8 | const home: { HOME?: string } = process.env;
    |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9 | console.log(home.HOME);

  hint: hold process.env without changing its type (const env = process.env), read the live table directly (process.env.NAME), or copy the entries you need: const env = { ...process.env, NAME: value }

held-env-copy-hold.ts:12:7 - error SC2014: a value held from process.env under a type other than the environment record (a string-keyed record of string | undefined) is not supported: the hold is a snapshot copy taken where it is created, so its reads would see the environment as it was then while Node reads the live environment

  11 | // an `any` hold: no record shape to alias through
  12 | const anyEnv: any = process.env;
     |       ^~~~~~~~~~~~~~~~~~~~~~~~~
  13 | console.log(anyEnv.PATH);

  hint: hold process.env without changing its type (const env = process.env), read the live table directly (process.env.NAME), or copy the entries you need: const env = { ...process.env, NAME: value }

held-env-copy-hold.ts:17:5 - error SC2014: a reassigned binding that holds process.env is not supported: Node's binding holds the environment object until it is reassigned, while the hold here is a snapshot copy of the environment

  16 | // reassignment, the hold here is a copy
  17 | let held = process.env;
     |     ^~~~~~~~~~~~~~~~~~
  18 | held = { NAME: "replacement" };

  hint: hold process.env in a binding that is never reassigned (const env = process.env), or copy the entries you need: let env = { ...process.env }

held-env-copy-hold.ts:26:13 - error SC2014: comparing process.env or a value held from it by identity with another object is not supported: the value here is a snapshot copy of the environment, not the environment object

  25 | const other: Record<string, string | undefined> = {};
  26 | console.log(live === other);
     |             ^~~~~~~~~~~~~~
  27 | 

  hint: compare the entries you need (env.NAME === other.NAME), or compare two holds of process.env, which are the same object