Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant find type .mts file #28167

Open
bartlomieju opened this issue Feb 18, 2025 · 1 comment
Open

Cant find type .mts file #28167

bartlomieju opened this issue Feb 18, 2025 · 1 comment

Comments

@bartlomieju
Copy link
Member

Discussed in #28163

Originally posted by emilbillberg February 18, 2025
Hi,

I am trying to run deno test with a file that imports minio-js package 8.0.4 but I get following error indicating it cannot find a type file:

error: Uncaught Error: Unable to load /Users/<username>/Library/Caches/deno/npm/registry.npmjs.org/minio/8.0.4/types/esm/minio.d.ts: No such file or directory (os error 2)
    at Object.getSourceFile (ext:deno_tsc/99_main_compiler.js:621:28)
    at findSourceFileWorker (ext:deno_tsc/00_typescript.js:126789:23)
    at findSourceFile (ext:deno_tsc/00_typescript.js:126705:20)
    at processImportedModules (ext:deno_tsc/00_typescript.js:127105:11)
    at findSourceFileWorker (ext:deno_tsc/00_typescript.js:126854:7)
    at findSourceFile (ext:deno_tsc/00_typescript.js:126705:20)
    at processImportedModules (ext:deno_tsc/00_typescript.js:127105:11)
    at findSourceFileWorker (ext:deno_tsc/00_typescript.js:126854:7)
    at findSourceFile (ext:deno_tsc/00_typescript.js:126705:20)
    at processImportedModules (ext:deno_tsc/00_typescript.js:127105:11)

How do I fix this? I can see there are some type files in another directory:

ls /Users/<username>/Library/Caches/deno/npm/registry.npmjs.org/minio/8.0.4/dist/esm/   
AssumeRoleProvider.d.mts	IamAwsProvider.d.mts		internal			signing.d.mts
AssumeRoleProvider.mjs		IamAwsProvider.mjs		minio.d.mts			signing.mjs
CredentialProvider.d.mts	errors.d.mts			minio.mjs			transformers.mjs
CredentialProvider.mjs		errors.mjs			notification.d.mts		xml-parsers.mjs
Credentials.d.mts		helpers.d.mts			notification.mjs
Credentials.mjs			helpers.mjs			promisify.mjs
```</div>
@dsherret
Copy link
Member

dsherret commented Feb 18, 2025

It looks like a bug in the package. They don't ship types in the types folder: https://www.npmjs.com/package/minio?activeTab=code

But the export condition has types like so:

 "exports": {
    ".": {
      "require": "./dist/main/minio.js",
      "types": "./types/esm/minio.d.ts",
      "default": "./dist/esm/minio.mjs"
    },
    "./dist/main/internal/*": null,
    "./dist/main/*": {
      "require": "./dist/main/*",
      "default": null
    },
    "./dist/esm/internal/*": null,
    "./dist/esm/*": {
      "import": "./dist/esm/*",
      "default": null
    },
    "./package.json": "./package.json"
  }

#27188 would change this to be a diagnostic, but maybe typescript resolution falls back to the non-types export condition if it fails and we should investigate if this works with plain tsc.

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

No branches or pull requests

2 participants