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
> deno check main.ts
Check file:///var/home/chris/Projects/expedition-hono/main.ts
error: TS2345 [ERROR]: Argument of type 'import("file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14/build/esm/type/schema/schema.d.mts").TSchema' is not assignable to parameter of type 'import("file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14/build/cjs/type/schema/schema.d.ts").TSchema'.
Property '[Kind]' is missing in type 'import("file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14/build/esm/type/schema/schema.d.mts").TSchema' but required in type 'import("file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14/build/cjs/type/schema/schema.d.ts").TSchema'.
app.post('/route', tbValidator('json', schema), async (c) => {
~~~~~~
at file:///var/home/chris/Projects/expedition-hono/main.ts:9:40
'[Kind]' is declared here.
[Kind]: string;
~~~~~~
at file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14/build/cjs/type/schema/schema.d.ts:21:5
It's complaining that TSchema type is mismatched between esm and cjs imports.
Running with `--log-level=debug`, we can see where it breaks down :
DEBUG RS - deno_resolver::npm::managed:185 - Resolved package folder of @sinclair/[email protected] to /var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14
DEBUG RS - deno::tsc:870 - Resolved @sinclair/typebox from file:///var/home/chris/Projects/expedition-hono/main.ts to ("file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14/build/esm/index.d.mts", Some(".d.mts"))
...
DEBUG RS - deno_resolver::npm::managed:250 - Resolved @sinclair/typebox from file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@hono/typebox-validator/0.3.0/dist/esm/index.d.ts to /var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14
DEBUG RS - deno::tsc:870 - Resolved @sinclair/typebox from file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@hono/typebox-validator/0.3.0/dist/esm/index.d.ts to ("file:///var/home/chris/.cache/deno/npm/registry.npmjs.org/@sinclair/typebox/0.34.14/build/cjs/index.d.ts", Some(".d.ts"))
So we can see that the bare imports are importing the esm build, but the import from inside @hono/typebox-validator decided to import the cjs build. And since they both define their own symbol of Kind, the types end up mismatching.
I assume the expected behaviour here would be for @sinclair/typebox to resolve to the esm build in both cases, but I don't know the ins and outs of esm/cjs modules that well, so can't say whether it's an issue with the packages, deno's resolution logic, or just the way it is.
Version: Deno 2.1.6
Attempting to write a server using
hono
,@hono/typebox-validator
and@sinclair/typebox packages
all installed from npm:Results in the following error on compile:
It's complaining that TSchema type is mismatched between esm and cjs imports.
So we can see that the bare imports are importing the esm build, but the import from inside
@hono/typebox-validator
decided to import the cjs build. And since they both define their own symbol ofKind
, the types end up mismatching.I assume the expected behaviour here would be for @sinclair/typebox to resolve to the esm build in both cases, but I don't know the ins and outs of esm/cjs modules that well, so can't say whether it's an issue with the packages, deno's resolution logic, or just the way it is.
Have provided reproduction repo here: https://github.com/cfraz89/hono-typebox-deno-error-demo and attached a log of
deno check --log-level=debug main.ts
debug.log
The text was updated successfully, but these errors were encountered: