chore(tsconfig): include node types so Deno can resolve type information - #5538
chore(tsconfig): include node types so Deno can resolve type information#5538q404365631 wants to merge 2 commits into
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR adds explicit Node.js type definitions to the TypeScript configuration by specifying ChangesTypeScript Configuration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5538 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 931 931
Branches 180 180
=========================================
Hits 931 931 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tsconfig.json`:
- Around line 8-10: Root tsconfig.json adding "types": ["node"] doesn't satisfy
files under netlify/edge-functions that use Deno globals and URL imports; create
or update a Deno-scoped tsconfig for netlify/edge-functions that enables Deno
typings and appropriate module resolution so files like serve-definitions.ts
(uses Deno.env.get) and serve-definitions.test.ts (uses Deno.test) compile
correctly. Specifically, add a tsconfig (e.g., in netlify/edge-functions) that
includes "types": ["deno"], or the official Deno lib, and set
moduleResolution/isolatedModules options appropriate for Deno/URL imports so the
Deno globals and remote imports are recognized by TypeScript for that directory.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 244a5af0-bb50-4678-8203-816cd59bdc96
📒 Files selected for processing (1)
tsconfig.json
| "types": [ | ||
| "node" | ||
| ], |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether netlify/edge-functions has a dedicated Deno TS config
# and whether root tsconfig excludes netlify from compilation scope.
set -euo pipefail
echo "== Root tsconfig exclusion check =="
rg -n '"exclude"|"netlify"|"types"|\"moduleResolution\"' tsconfig.json -n -C2 || true
echo
echo "== Search for Deno config under netlify =="
fd -i 'deno\.json|deno\.jsonc|tsconfig\.json' netlify || true
echo
echo "== Search for Deno global or URL import usage in edge functions =="
rg -n --iglob '*.{ts,tsx,js,mjs,cjs}' '\bDeno\b|https://edge\.netlify\.com|from\s+["'\'']https?://' netlify || trueRepository: asyncapi/website
Length of output: 1925
Root tsconfig.json "types": ["node"] won’t fix netlify/edge-functions Deno/URL-import typing for #5087
netlify/edge-functions/serve-definitions.ts and netlify/edge-functions/tests/serve-definitions.test.ts use Deno globals (Deno.env.get, Deno.test) and import modules from https://.... Adding Node types in the root tsconfig.json is insufficient for this Deno environment; a Deno-aware TS config (scoped to netlify/edge-functions) is still needed to address #5087.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tsconfig.json` around lines 8 - 10, Root tsconfig.json adding "types":
["node"] doesn't satisfy files under netlify/edge-functions that use Deno
globals and URL imports; create or update a Deno-scoped tsconfig for
netlify/edge-functions that enables Deno typings and appropriate module
resolution so files like serve-definitions.ts (uses Deno.env.get) and
serve-definitions.test.ts (uses Deno.test) compile correctly. Specifically, add
a tsconfig (e.g., in netlify/edge-functions) that includes "types": ["deno"], or
the official Deno lib, and set moduleResolution/isolatedModules options
appropriate for Deno/URL imports so the Deno globals and remote imports are
recognized by TypeScript for that directory.
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5538--asyncapi-website.netlify.app/ |
|



What
Adds an explicit
"types": ["node"]entry totsconfig.json'scompilerOptionsso Deno (and any other runtime) can pull in thenodetype definitions fromnode_modules/@types/nodewhen type-checking.Why
package.jsonalready uses Deno for some tests (test:netlify=deno test ...), and per #5087 Deno is unable to resolve type information for this project becausetsconfig.jsonhad notypesfield. Withtypes: ["node"], Deno can read the typings from the existing@types/node(already a transitive dep) instead of falling back toany.Changes
tsconfig.json: Added"types": ["node"]tocompilerOptions.1 file changed, 4 insertions(+), 1 deletion(-).
Closes #5087
Summary by CodeRabbit