Describe the bug you found in AsyncAPI Docs.
What changes are you proposing?
I propose adding a netlify/edge-functions/deno.json configuration file to properly set up the Deno environment for edge functions.
This change will:
- Configure the TypeScript compiler for the
netlify/edge-functions/ directory.
- Recognize Deno-specific globals (like
Deno.env) and imports.
- Eliminate false positive TypeScript errors in the IDE.
Why do we need this improvement?
The netlify/edge-functions/ directory runs on the Deno runtime, but the project defaults to a Node.js environment.
The Problem:
Currently, when a developer opens a file like serve-definitions.ts, the IDE reports numerous "Critical" errors that are actually false positives:
- Missing Modules:
Cannot find module 'https://...' (Node doesn't support URL imports).
- Unknown Globals:
Cannot find name 'Deno' (TypeScript expects Node types).
This creates a "broken window" effect where valid code appears to be incorrect, potentially confusing new contributors who might question their local setup.
How will this change help?
This change significantly improves the DX:
- Clean Workspace: Removes distracting error indicators, allowing developers to focus on actual issues.
- Faster Onboarding: Contributors can trust that the absence of errors indicates the code is valid.
- Better Type Safety: Formatting and linting will function correctly for Deno-specific syntax.
Screenshots
Current State (IDE Errors):
Opening netlify/edge-functions/serve-definitions.ts currently displays errors such as:
// Error: Cannot find module 'https://edge.netlify.com/v1/index.ts' or its corresponding type declarations.
import type { Context } from "https://edge.netlify.com/v1/index.ts";
export default async (request: Request, context: Context) => {
// Error: Cannot find name 'Deno'.
const GITHUB_TOKEN = Deno.env.get("GITHUB_TOKEN_NR");
// ...
}
How could it be implemented/designed?
Implementation Plan:
Create a netlify/edge-functions/deno.json with the following configuration:
{
"compilerOptions": {
"lib": ["deno.window"],
"types": [
"https://edge.netlify.com/v1/index.ts"
]
}
}
This instructs the editor to treat this specific directory as a Deno environment.
I have verified this fix locally. I am ready to implement this immediately upon approval.
Breaking changes
No
Have you checked for similar open issues?
Have you read the Contributing Guidelines?
Attach any resources that can help us understand the issue.
Code of Conduct
Are you willing to work on this issue ?
Yes I am willing to submit a PR!
Describe the bug you found in AsyncAPI Docs.
What changes are you proposing?
I propose adding a
netlify/edge-functions/deno.jsonconfiguration file to properly set up the Deno environment for edge functions.This change will:
netlify/edge-functions/directory.Deno.env) and imports.Why do we need this improvement?
The
netlify/edge-functions/directory runs on the Deno runtime, but the project defaults to a Node.js environment.The Problem:
Currently, when a developer opens a file like
serve-definitions.ts, the IDE reports numerous "Critical" errors that are actually false positives:Cannot find module 'https://...'(Node doesn't support URL imports).Cannot find name 'Deno'(TypeScript expects Node types).This creates a "broken window" effect where valid code appears to be incorrect, potentially confusing new contributors who might question their local setup.
How will this change help?
This change significantly improves the DX:
Screenshots
Current State (IDE Errors):
Opening
netlify/edge-functions/serve-definitions.tscurrently displays errors such as:How could it be implemented/designed?
Implementation Plan:
Create a
netlify/edge-functions/deno.jsonwith the following configuration:{ "compilerOptions": { "lib": ["deno.window"], "types": [ "https://edge.netlify.com/v1/index.ts" ] } }This instructs the editor to treat this specific directory as a Deno environment.
I have verified this fix locally. I am ready to implement this immediately upon approval.
Breaking changes
No
Have you checked for similar open issues?
Have you read the Contributing Guidelines?
Attach any resources that can help us understand the issue.
Code of Conduct
Are you willing to work on this issue ?
Yes I am willing to submit a PR!