Closed ChristianSiegert closed 1 year ago
Sheesh Just spent 20 mins on this. Thank you for the temp fix
If you don't want to do the node flag, you can just import them from a cdn:
// @deno-types="https://esm.sh/@planetscale/database/dist/index.d.ts"
I have a related problem, but don't know how to solve it. This is my full issue description: https://github.com/codemonument/deno_audio_logbook/issues/3
The Reason that my Constructor Config can't be found, is, that when I import kysely-planetscale
via:
"kysely-planetscale": "https://esm.sh/v110/kysely-planetscale@1.3.0?external=kysely&deps=@planetscale/database@1.5.0",
its PlanetScaleDialect Config
extends Config
from
import { Config, Field } from 'https://esm.sh/v110/@planetscale/database@1.5.0/X-ZS9reXNlbHk/dist/index.d.js~.d.ts';
But this url has exactly the problem with the url you both describe.
Now, I use kysely together with kysely-planetscale like this:
const db: Kysely<DbSchema> = new Kysely<DbSchema>({
dialect: new PlanetScaleDialect({
host: secrets.get("DATABASE_HOST"),
username: secrets.get("DATABASE_USERNAME"),
password: secrets.get("DATABASE_PASSWORD"),
}),
=> So, the wrong url is generated by esm.sh, based on the wrong package.json, inside the kysely-planetscale package, where PlanetScaleDialect comes from.
How do I tell it to use these deno types like you specified them, @wesbos ?
any
Not useful, but at least get's rid of the error:
const db: Kysely<DbSchema> = new Kysely<DbSchema>({
dialect: new PlanetScaleDialect({
host: secrets.get("DATABASE_HOST"),
username: secrets.get("DATABASE_USERNAME"),
password: secrets.get("DATABASE_PASSWORD"),
} as any),
kysely-planetscale
(not tried)I think, one might be able to fix this problem by vendoring kysely-planetscale
and replacing the typing in the import.
But I would rather much avoid vendoring if possible, so I'll leave it with as any
for now.
Added a PR for this absolutely tiny fix, hope this gets approved soon! https://github.com/planetscale/database-js/pull/93
@mattrobenolt Thanks for closing this so quickly! Can you tell me when the next patch release arrives on npm?
@bjesuiter We are working on it now.
Edit: Just kidding, it is already up now.
Thank you, it works flawlessly! 😍
Hi, I’m using the @planetscale/database npm package in a TypeScript project (using Deno). It works but I had trouble getting the type definitions to work. package.json specifies
dist/index.d.js
as types file but this file does not exist. It should bedist/index.d.ts
. Can you please fix the path in your package.json?For the record, here is my PoC with working types:
Then run
deno run --allow-net --node-modules-dir main.ts
Environment: