nemmind1
nemmind12w ago

Deno check fail

Hi, I'm trying to use the effect packages with deno, most of them are working, but the sql-drizzle package don't:
{
"imports": {
"@effect/sql-drizzle": "npm:@effect/sql-drizzle@^0.34.3",
"drizzle-orm": "npm:drizzle-orm@^0.43.1",
"effect": "npm:effect@^3.15.2"
}
}
{
"imports": {
"@effect/sql-drizzle": "npm:@effect/sql-drizzle@^0.34.3",
"drizzle-orm": "npm:drizzle-orm@^0.43.1",
"effect": "npm:effect@^3.15.2"
}
}
import { Effect } from 'effect'
import { integer, sqliteTable } from 'drizzle-orm/sqlite-core'
import { SqliteDrizzle } from "@effect/sql-drizzle/Sqlite"

const myTable = sqliteTable('foobar', {
id: integer().primaryKey(),
})

Effect.gen(function* () {
const db = yield* SqliteDrizzle
db.select().from(myTable) // This fails
})
import { Effect } from 'effect'
import { integer, sqliteTable } from 'drizzle-orm/sqlite-core'
import { SqliteDrizzle } from "@effect/sql-drizzle/Sqlite"

const myTable = sqliteTable('foobar', {
id: integer().primaryKey(),
})

Effect.gen(function* () {
const db = yield* SqliteDrizzle
db.select().from(myTable) // This fails
})
This is the error message: once it references the common.d.ts another the common.d.cts file of the same package and it does not know they are the same.
Type 'import("file:///home/XXX/.cache/deno/npm/registry.npmjs.org/drizzle-orm/0.43.1/sqlite-core/columns/common.d.ts").SQLiteColumn<any, {}, {}>' is not assignable to type 'import("file:///home/XXX/.cache/deno/npm/registry.npmjs.org/drizzle-orm/0.43.1/sqlite-core/columns/common.d.cts").SQLiteColumn<any, {}, {}>'.
Property 'config' is protected but type 'Column<T, TRuntimeConfig, TTypeConfig>' is not a class derived from 'Column<T, TRuntimeConfig, TTypeConfig>'.
db.select().from(myTable)
Type 'import("file:///home/XXX/.cache/deno/npm/registry.npmjs.org/drizzle-orm/0.43.1/sqlite-core/columns/common.d.ts").SQLiteColumn<any, {}, {}>' is not assignable to type 'import("file:///home/XXX/.cache/deno/npm/registry.npmjs.org/drizzle-orm/0.43.1/sqlite-core/columns/common.d.cts").SQLiteColumn<any, {}, {}>'.
Property 'config' is protected but type 'Column<T, TRuntimeConfig, TTypeConfig>' is not a class derived from 'Column<T, TRuntimeConfig, TTypeConfig>'.
db.select().from(myTable)
This works with node+typescript. Please help me find out is this a deno bug, or an effect bug. Thanks!
4 Replies
dsherret
dsherret2w ago
I get the same error with TypeScript from an .mts file
No description
dsherret
dsherret2w ago
compiler options:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "nodenext",
"strict": true
}
}
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "nodenext",
"strict": true
}
}
sorry, my internet went out. A very terrible workaround is this:
import { Effect } from 'effect'
import { integer, sqliteTable } from 'drizzle-orm/sqlite-core';
import type { sqliteTable as sqliteTableType } from 'drizzle-orm/sqlite-core' with {
"resolution-mode": "require"
};
import { SqliteDrizzle } from "@effect/sql-drizzle/Sqlite"

const myTable = (sqliteTable as any as typeof sqliteTableType)('foobar', {
id: integer().primaryKey(),
})

Effect.gen(function* () {
const db = yield* SqliteDrizzle
db.select().from(myTable) // This fails
});
import { Effect } from 'effect'
import { integer, sqliteTable } from 'drizzle-orm/sqlite-core';
import type { sqliteTable as sqliteTableType } from 'drizzle-orm/sqlite-core' with {
"resolution-mode": "require"
};
import { SqliteDrizzle } from "@effect/sql-drizzle/Sqlite"

const myTable = (sqliteTable as any as typeof sqliteTableType)('foobar', {
id: integer().primaryKey(),
})

Effect.gen(function* () {
const db = yield* SqliteDrizzle
db.select().from(myTable) // This fails
});
But actually, this seems to work in regular TypeScript, but not in Deno. I'm going to look into what's going on here
dsherret
dsherret2w ago
I opened https://github.com/denoland/deno/issues/29410 for that. Will look at it later
GitHub
Deno can't handle importing types of an npm package with different ...
Given the following... import { integer, sqliteTable } from &#39;drizzle-orm/sqlite-core&#39;; import type { sqliteTable as sqliteTableType } from &#39;drizzle-orm/sqlite-core&#39; with { &quot;res...
nemmind1
nemmind1OP2w ago
Thank you very much!

Did you find this page helpful?