denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.76k stars 5.21k forks source link

`deno publish` to jsr does not resolve `@deno-types="..."` #24076

Open Milly opened 2 months ago

Milly commented 2 months ago

Version: Deno 1.43.6

I published Project A to jsr, which internally references an npm library and DefinitelyTyped.

Definition of Project A:

// -- deno.jsonc
{
  // ...
  "imports": {
    "@sinonjs/fake-timers": "npm:@sinonjs/fake-timers@^11.2.2",
    "@types/sinonjs__fake-timers": "npm:@types/sinonjs__fake-timers@^8.1.5"
  }
}

// -- internal.ts
// @deno-types="@types/sinonjs__fake-timers"
import { install } from "@sinonjs/fake-timers";
// ...

When I referenced this from another Project B, deno check started failing with the following error:

error: Failed resolving types. Relative import path "@types/sinonjs__fake-timers" not prefixed with / or ./ or ../ and not in import map from "https://jsr.io/..."

The internal.ts file of Project A is published to jsr as follows:

// @deno-types="@types/sinonjs__fake-timers"
import { install } from "npm:@sinonjs/fake-timers@^11.2.2";

The import ... from "..." statements are rewritten according to imports in deno.jsonc. However, nothing is done for @deno-types="...".

yazan-abdalrahman commented 2 months ago

@Milly Hello, could you clarify how I may re-produce the issue?

Milly commented 2 months ago

@yazan-abdalrahman Is there a way to get a dry-run result of the publish command? I have no way to test it other than publishing a bunch of junk packages to jsr...