Skip to content

fix: replace DOM globals and with inline types in models.ts#1323

Open
amitsingh05667 wants to merge 1 commit intomasterfrom
SDK-8563
Open

fix: replace DOM globals and with inline types in models.ts#1323
amitsingh05667 wants to merge 1 commit intomasterfrom
SDK-8563

Conversation

@amitsingh05667
Copy link
Copy Markdown
Member

Summary

  • src/lib/models.ts used RequestInfo and RequestCredentials as global types without importing them
  • These globals come from lib.dom.d.ts (browser library) which is not available in all TypeScript environments
  • Users building Node.js backends with "lib": ["es2022"] (no "dom") hit 6 TypeScript compilation errors
  • Replaced DOM global aliases with their inline equivalents — structurally identical, no breaking changes

Problem

When a user sets "lib": ["es2022"] in their tsconfig.json, TypeScript does not load DOM types.
RequestInfo and RequestCredentials are DOM globals - they don't exist in this environment, causing compilation to fail.

node_modules/auth0/dist/cjs/lib/models.d.ts:6:36 - error TS2552: Cannot find name 'RequestInfo'.
node_modules/auth0/dist/cjs/lib/models.d.ts:60:19 - error TS2304: Cannot find name 'RequestCredentials'.
Found 6 errors in the same file.

Fixes #1081

Changes

src/lib/models.ts

  • Replaced URL | RequestInfostring | URL | Request (5 occurrences)
  • Replaced RequestCredentials"include" | "omit" | "same-origin"

src/lib/runtime.ts

  • Replaced URL | RequestInfostring | URL | Request in fetch method signature

@amitsingh05667 amitsingh05667 requested a review from a team as a code owner April 13, 2026 07:54
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.42%. Comparing base (97a4419) to head (accf18b).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1323   +/-   ##
=======================================
  Coverage   89.42%   89.42%           
=======================================
  Files         384      384           
  Lines       18246    18246           
  Branches     9047     9047           
=======================================
  Hits        16316    16316           
  Misses       1926     1926           
  Partials        4        4           
Flag Coverage Δ
alltests 89.42% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/lib/models.ts 100.00% <ø> (ø)
src/lib/runtime.ts 81.98% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot compile TypeScript project without "dom" library support

1 participant