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

[BUG]: sqlite column definition typescript argument mismatch #3571

Open
1 task done
luroc opened this issue Nov 16, 2024 · 0 comments
Open
1 task done

[BUG]: sqlite column definition typescript argument mismatch #3571

luroc opened this issue Nov 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@luroc
Copy link

luroc commented Nov 16, 2024

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.33.0

What version of drizzle-kit are you using?

0.22.8

Other packages

Describe the Bug

While defining sqlite columns using your examples in the documentation

import { integer, sqliteTable } from "drizzle-orm/sqlite-core";

const contentFrame = sqliteTable('contentFrame', {
	id: integer({ mode: 'number' }).primaryKey({ autoIncrement: true })
});

typescript errors with typescript: Argument of type '{ mode: string; }' is not assignable to parameter of type 'string'. [2345].
Likewise npx drizzle-kit push errors with

npx drizzle-kit push                        
drizzle-kit: v0.22.8
drizzle-orm: v0.33.0                                     
                                                                                                                                   
_ZodError: [
  {                                                      
    "code": "invalid_type",                                                                                        
    "expected": "string",
    "received": "object",
    "path": [                                
      "tables",
      "table",                                                                                             
      "columns",                                                                                                   
      "[object Object]",    
      "name"                                                                                                       
    ],                                                                                                             
    "message": "Expected string, received object"                                                                  
  }                                                                                                                
]                                                                                                                      at get error [as error] (/XXX/node_modules/drizzle-kit/bin.cjs:5183:
28)                                                                                                                
    at _ZodObject.parse (/XXX/node_modules/drizzle-kit/bin.cjs:5263:22)     at prepareSQLitePush (/XXX/node_modules/drizzle-kit/bin.cjs:30542:41
)                                                                                                                      at async sqlitePush (/XXX/node_modules/drizzle-kit/bin.cjs:122578:26
)                                                                                                                      at async _Command.<anonymous> (/XXX/node_modules/drizzle-kit/bin.cjs
:129691:7) {                                                                                                       
  issues: [                                                                                                        
    {                       
      code: 'invalid_type',                              
      expected: 'string',   
      received: 'object',                                
      path: [Array],                                     
      message: 'Expected string, received object'        
    }                                                    
  ],                                                     
  addIssue: [Function (anonymous)],                     
  addIssues: [Function (anonymous)],                     
  errors: [                 
    {                                                    
      code: 'invalid_type',                                                                                        
      expected: 'string',                                
      received: 'object',
      path: [Array],                                     
      message: 'Expected string, received object'        
    }                       
  ]                                                                                                                
}   

better-sqlite3, monorepo, typescript v5.6.3, nodejs,
tsconfig.json:

{
	"extends": "./.svelte-kit/tsconfig.json",
	"compilerOptions": {
		"allowJs": true,
		"checkJs": true,
		"esModuleInterop": true,
		"forceConsistentCasingInFileNames": true,
		"resolveJsonModule": true,
		"skipLibCheck": true,
		"sourceMap": true,
		"strict": true,
		"moduleResolution": "bundler"
	}
	// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
	// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
	//
	// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
	// from the referenced tsconfig.json - TypeScript does not merge them in
}
@luroc luroc added the bug Something isn't working label Nov 16, 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