You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
Are you running the latest SDK version?
Are you reporting to the correct repository (magic-sdk)?
π Description
I'm currently exploring how my team can integrate Magic into an existing web app which was using Node16 module resolution. I found that if I tried to import any @magic-ext/* packages then I would get an error with some variation on:
src/main.ts:15:18 - error TS7016: Could not find a declaration file for module '@magic-ext/oidc'. '/Users/bob/code/work/canvas/magic-module-import-reproduce/node_modules/.pnpm/@[email protected]/node_modules/@magic-ext/oidc/dist/es/index.mjs' implicitly has an 'any' type.
There are types at '/Users/bob/code/work/canvas/magic-module-import-reproduce/node_modules/@magic-ext/oidc/dist/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@magic-ext/oidc' library may need to update its package.json or typings.
15 import oidc from "@magic-ext/oidc"
~~~~~~~~~~~~~~~~~
replacing "@magic-ext/oidc" with the particular module being imported.
I think this is a pretty big deal - if we want Magic to be supported by modern web apps then we should be supporting more recent module resolution methods. I'm happy to make a PR for this.
I think I know how to solve this - we just need to add a types value to the exports object in package.json for the affected packages, i.e. copy the fix in #626
The text was updated successfully, but these errors were encountered:
rjwebb
changed the title
Cannot import @magic-ext/* packages when moduleResolution = "node16" in tsconfig.json
TypeScript cannot access types of @magic-ext/* packages when moduleResolution = "node16" in tsconfig.json
Nov 21, 2023
β Prerequisites
magic-sdk
)?π Description
I'm currently exploring how my team can integrate Magic into an existing web app which was using
Node16
module resolution. I found that if I tried to import any@magic-ext/*
packages then I would get an error with some variation on:replacing "@magic-ext/oidc" with the particular module being imported.
I think this is a pretty big deal - if we want Magic to be supported by modern web apps then we should be supporting more recent module resolution methods. I'm happy to make a PR for this.
𧩠Steps to Reproduce
Node16
orNodeNext
for the module and moduleResolution settings in tsconfig.json@magic-ext/*
You should see an error in tsc looking something like the quoted text in the description of this issue.
π» Code Sample
I've created a repo that provides a minimal example that triggers this error.
https://github.com/rjwebb/magic-module-import-reproduce
π Environment
magic-sdk
yarn
Solution?
I think I know how to solve this - we just need to add a
types
value to theexports
object inpackage.json
for the affected packages, i.e. copy the fix in #626The text was updated successfully, but these errors were encountered: