Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql-drizzle build error #4125

Open
mfukushim opened this issue Dec 12, 2024 · 0 comments
Open

sql-drizzle build error #4125

mfukushim opened this issue Dec 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mfukushim
Copy link

What version of Effect is running?

3.11.5

What steps can reproduce the bug?

Hello, I am trying to build a small app using Effect and drizzle but I keep getting build errors. I tried to make a small app with Effect and drizzle but i get build errors.

A simple way to reproduce

  1. Build the basic app with “pnpm create effect-app@latest”.
  2. Replace the contents of src/Program.ts with effect git packages/sql-drizzle/examples/sqlite.ts
  3. "pnpm install @effect/sql @effect/sql-drizzle @effect/sql-sqlite-node drizzle-orm@0.31.4" to add missing packages
  4. pnpm run build
  5. I get the following TS2379 and TS2345 errors
src/Program.ts:28:20 - error TS2379: Argument of type 'SQLiteTableWithColumns<{ name: "users"; schema: undefined; columns: { id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType
: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; name: SQLiteColumn<...>; ...' is not assignable to parameter of type 'SQLiteTable<TableConfig>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
  The types of '_.config.columns' are incompatible between these types.
    Type '{ id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; name: SQLiteColumn<...>; }' is not assignable to type 'Record<string, SQLiteColumn<any, object>>'.
      Property 'id' is incompatible with index signature.
        Type 'SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumVa
lues: undefined; baseColumn: never; }, object>' is not assignable to type 'SQLiteColumn<any, object>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
          The types of 'table._.config.columns' are incompatible between these types.
            Type 'Record<string, import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sql
ite-core/columns/common", { with: { "resolution-mode": "import" } }).SQLiteColumn<any, object>>' is not assignable to type 'Record<string, import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/columns/common").SQLiteColumn<any, object>>'.
              'string' index signatures are incompatible.
                Type 'import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/co
lumns/common", { with: { "resolution-mode": "import" } }).SQLiteColumn<any, object>' is not assignable to type 'import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modu
les/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/columns/common").SQLiteColumn<any, object>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                  Property 'config' is protected but type 'Column<T, TRuntimeConfig, TTypeConfig>' is not a class derived from 'Column<T, TRuntimeConfig, TTypeConfig>'.

28   yield* db.delete(users)
                      ~~~~~

src/Program.ts:29:20 - error TS2379: Argument of type 'SQLiteTableWithColumns<{ name: "users"; schema: undefined; columns: { id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType
: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; name: SQLiteColumn<...>; ...' is not assignable to parameter of type 'SQLiteTable<TableConfig>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
  The types of '_.config.columns' are incompatible between these types.
    Type '{ id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; name: SQLiteColumn<...>; }' is not assignable to type 'Record<string, SQLiteColumn<any, object>>'.
      Property 'id' is incompatible with index signature.
        Type 'SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumVa
lues: undefined; baseColumn: never; }, object>' is not assignable to type 'SQLiteColumn<any, object>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
          The types of 'table._.config.columns' are incompatible between these types.
            Type 'Record<string, import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sql
ite-core/columns/common", { with: { "resolution-mode": "import" } }).SQLiteColumn<any, object>>' is not assignable to type 'Record<string, import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/columns/common").SQLiteColumn<any, object>>'.
              'string' index signatures are incompatible.
                Type 'import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/co
lumns/common", { with: { "resolution-mode": "import" } }).SQLiteColumn<any, object>' is not assignable to type 'import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modu
les/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/columns/common").SQLiteColumn<any, object>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                  Property 'config' is protected but type 'Column<T, TRuntimeConfig, TTypeConfig>' is not a class derived from 'Column<T, TRuntimeConfig, TTypeConfig>'.

29   yield* db.insert(users).values({ id: 1, name: "Alice" })
                      ~~~~~

src/Program.ts:30:43 - error TS2345: Argument of type 'SQLiteTableWithColumns<{ name: "users"; schema: undefined; columns: { id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType
: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; name: SQLiteColumn<..
.>; ...' is not assignable to parameter of type 'SQLiteTable<TableConfig> | SQL<unknown> | Subquery<string, Record<string, unknown>> | SQLiteViewBase<string, boolean, ColumnsSelection>'.
  Type 'SQLiteTableWithColumns<{ name: "users"; schema: undefined; columns: { id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: 
number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; name: SQLiteColumn<...>; ...' is not assignable to type 'SQLiteTable<TableConfig>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
    The types of '_.config.columns' are incompatible between these types.
      Type '{ id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; name: SQLiteColumn<...>; }' is not assignable to type 'Record<string, SQLiteColumn<any, object>>'.
        Property 'id' is incompatible with index signature.
          Type 'SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; enum
Values: undefined; baseColumn: never; }, object>' is not assignable to type 'SQLiteColumn<any, object>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
            The types of 'table._.config.columns' are incompatible between these types.
              Type 'Record<string, import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/s
qlite-core/columns/common", { with: { "resolution-mode": "import" } }).SQLiteColumn<any, object>>' is not assignable to type 'Record<string, import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/columns/common").SQLiteColumn<any, object>>'.
                'string' index signatures are incompatible.
                  Type 'import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_modules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/
columns/common", { with: { "resolution-mode": "import" } }).SQLiteColumn<any, object>' is not assignable to type 'import("D:/mfuku/Documents/projects/scratchProj/effect_sample2/node_mo
dules/.pnpm/drizzle-orm@0.31.4_better-sqlite3@11.7.0/node_modules/drizzle-orm/sqlite-core/columns/common").SQLiteColumn<any, object>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                    Property 'config' is protected but type 'Column<T, TRuntimeConfig, TTypeConfig>' is not a class derived from 'Column<T, TRuntimeConfig, TTypeConfig>'.

30   const results = yield* db.select().from(users)
                                             ~~~~~


Found 3 errors.

What is the expected behavior?

I found to build bellow setting

tsconfig.base.json

    "moduleResolution": "node",
    "module": "commonjs",

Is there a way to build without changing the settings? Is there any problem with this workaround?

What do you see instead?

No response

Additional information

No response

@mfukushim mfukushim added the bug Something isn't working label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant