vaquilina
vaquilina
DDeno
Created by vaquilina on 5/25/2025 in #help
Deno not recognizing default export from npm package 'unstorage' as a function
Hello everyone, I am attempting to set up unstorage with the Deno KV driver, as per https://unstorage.unjs.io/drivers/deno When I import the driver and attempt to call it, the LSP reports that denoKVdriver lacks a call signature, and type-checking also fails:
This expression is not callable.
Type 'typeof import("file:///home/vince/.cache/deno/npm/registry.npmjs.org/unstorage/1.16.0/drivers/deno-kv")' has no call signatures.deno-ts(2349)
This expression is not callable.
Type 'typeof import("file:///home/vince/.cache/deno/npm/registry.npmjs.org/unstorage/1.16.0/drivers/deno-kv")' has no call signatures.deno-ts(2349)
If I invoke denoKVdriver.default(), the LSP no longer reports the error, but type-checking still fails. Relevant d.ts:
import type { Kv } from "@deno/kv";
export interface DenoKvOptions {
base?: string;
path?: string;
openKv?: () => Promise<Deno.Kv | Kv>;
}
declare const _default: (opts: DenoKvOptions) => import("..").Driver<DenoKvOptions, Promise<Deno.Kv | Kv>>;
export default _default;
import type { Kv } from "@deno/kv";
export interface DenoKvOptions {
base?: string;
path?: string;
openKv?: () => Promise<Deno.Kv | Kv>;
}
declare const _default: (opts: DenoKvOptions) => import("..").Driver<DenoKvOptions, Promise<Deno.Kv | Kv>>;
export default _default;
Code:
import { createStorage } from 'unstorage';
import denoKVdriver from 'unstorage/drivers/deno-kv';

export const storage = createStorage({
driver: denoKVdriver({}),
});
import { createStorage } from 'unstorage';
import denoKVdriver from 'unstorage/drivers/deno-kv';

export const storage = createStorage({
driver: denoKVdriver({}),
});
deno.json for workspace member:
{
"tasks": {
"initdb": "deno run init_db.ts"
},
"imports": {
"sqlite": "https://deno.land/x/sqlite/mod.ts"
}
}
{
"tasks": {
"initdb": "deno run init_db.ts"
},
"imports": {
"sqlite": "https://deno.land/x/sqlite/mod.ts"
}
}
deno.json for workspace:
{
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"workspace": ["./authorizer", "./client", "./db", "./api"],
"unstable": ["temporal", "kv"],
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.13",
"unstorage": "npm:unstorage@^1.16.0"
}
}
{
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"workspace": ["./authorizer", "./client", "./db", "./api"],
"unstable": ["temporal", "kv"],
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.13",
"unstorage": "npm:unstorage@^1.16.0"
}
}
Is there a way to work around this?
7 replies