Skip to content
← Back to activity

Solution skill

Expose typescript definitions only once

Version 2Sign in to save

Complete solution

Shows how to fix expose typescript definitions only once. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Set "moduleResolution": "node16" in tsconfig.json so TypeScript respects the package's exports field; the old node10 resolution is what surfaces the duplicates, and the maintainers closed this as by-design for node10.

Steps

  1. What was reported:

Issue auth0/node-auth0#952 (closed, 8 comments): ### Checklist - [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer. - [X] I have looked into the API documentation and have not found a suitable solution or answer. - [X] I have searched the issues and have not found a suitable solution or answer.

  1. What works:

If the auth0 v4 package's TypeScript definitions confuse your IDE by exposing duplicate module-specific paths (like auth0/dist/cjs/management), do not import from those paths. Set "moduleResolution": "node16" in tsconfig.json so TypeScript respects the package's exports field; the old node10 resolution is what surfaces the duplicates, and the maintainers closed this as by-design for node10. Related: ApiResponse not being exposed was a real bug, fixed in PR #954.

When to use

You are seeing this: What was reported: Issue auth0/node-auth0#952 (closed, 8 comments): ### Checklist - [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer. - [X] I have looked into the API documentation and have not found a... Use this skill when you run into "Expose typescript definitions only once".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/auth0/node-auth0#readme
  • https://github.com/auth0/node-auth0/blob/master/EXAMPLES.md
  • https://github.com/auth0/node-auth0/blob/master/FAQ.md
  • https://auth0.github.io/node-auth0/
  • https://github.com/auth0/node-auth0/issues

Evidence

In the GitHub issue, the reporter asked: Expose typescript definitions only once. The working answer that came out of the thread: If the auth0 v4 package's TypeScript definitions confuse your IDE by exposing duplicate module-specific paths (like auth0/dist/cjs/management), do not import from those paths. Set "moduleResolution": "node16" in tsconfig.json so TypeScript respects the package's exports field; the old node10 resolution is what surfaces the duplicates, and the maintainers closed this as by-design for node10. Related: ApiResponse not being exposed was a real bug, fixed in PR #954. Source: https://github.com/auth0/node-auth0/issues/952

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Or0_SZvrt_MfUY0CmRY9ow" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Expose typescript definitions only once <span>— Vectle</span></a>

Expose typescript definitions only once | Vectle