drizzle-team / drizzle-team/drizzle-orm
[BUG]: `drizzle-kit introspect` generates files that do not compile under Typescript `noUnusedLocals` and `noUnusedParameters`
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [X] 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.38.3
### What version of `drizzle-kit` are you using?
0.30.1
### Other packages
_No response_
### Describe the Bug
`drizzle-kit introspect` with a postgres database generates a schema file which fails to compile in a typescript environment with the following `tsconfig.json` compiler options set:
```
"noUnusedLocals": true,
"noUnusedParameters": true,
```
This generates errors such as the following:
```
.../src/lib/db/schema.ts:1:122
Error: 'AnyPgColumn' is declared but its value is never read.
import { pgTable, index, foreignKey, unique, pgPolicy, uuid, text, timestamp, check, integer, boolean, uniqueIndex, type AnyPgColumn, numeric, pgSchema, bigserial, varchar, jsonb, inet, date, real, bigint, smallint, json, primaryKey, pgView, pgEnum } from "drizzle-orm/pg-core"
import { sql } from "drizzle-orm"
.../src/lib/db/schema.ts:593:5
Error: 'table' is declared but its value is never read.
updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'date' }),
}, (table) => [
uniqueIndex("sso_providers_resource_id_idx").using("btree", sql`lower(resource_id)`),
.../src/lib/db/schema.ts:1113:5
Error: 'table' is declared but its value is never read.
description: text().notNull(),
}, (table) => [
pgPolicy("allow_all_select_access", { as: "permissive", for: "select", to: ["authenticated"], using: sql`true` }),
```
Contributor guide
Assessment
This issue has not been assessed yet.