console.log(deno.env('EXAMPLE'))
running with:
EXAMPLE=true deno --allow-env ./file.ts
is giving back "Cannot find name 'deno'."
import { env } from "deno";
console.log(env()["EXAMPLE"])
import { env } from 'deno';
yields
error: Uncaught URIError: relative import path "deno" not prefixed with / or ./ or ../ Imported from "file:///app/index.ts"
looks like deno fetch doesn't know to skip the deno import
The deno namespace has moved to the Deno global. Use Deno.env()
So:
const env = Deno.env();
console.log(env["EXAMPLE"]);
// or
console.log(Deno.env("EXAMPLE"));
Is there a way to get your editor to recognize the Deno global?

Use an editor plugin: https://deno.land/manual/getting_started/setup_your_environment#editors-and-ides
Ah. I was using a different Deno plugin (by "axetroy") which I'm pretty sure was linked from somewhere else in the docs, though I can't find the reference now. This new one worked, thanks.
Most helpful comment