diff --git a/examples/node-better-sqlite3/src/db/query_sql.ts b/examples/node-better-sqlite3/src/db/query_sql.ts index 8996855..b605d23 100644 --- a/examples/node-better-sqlite3/src/db/query_sql.ts +++ b/examples/node-better-sqlite3/src/db/query_sql.ts @@ -7,13 +7,13 @@ SELECT id, name, bio FROM authors WHERE id = ? LIMIT 1`; export interface GetAuthorArgs { - id: any; + id: number; } export interface GetAuthorRow { - id: any; - name: any; - bio: any | null; + id: number; + name: string; + bio: string | null; } export async function getAuthor(database: Database, args: GetAuthorArgs): Promise { @@ -30,9 +30,9 @@ SELECT id, name, bio FROM authors ORDER BY name`; export interface ListAuthorsRow { - id: any; - name: any; - bio: any | null; + id: number; + name: string; + bio: string | null; } export async function listAuthors(database: Database): Promise { @@ -49,8 +49,8 @@ INSERT INTO authors ( )`; export interface CreateAuthorArgs { - name: any; - bio: any | null; + name: string; + bio: string | null; } export async function createAuthor(database: Database, args: CreateAuthorArgs): Promise { @@ -63,7 +63,7 @@ DELETE FROM authors WHERE id = ?`; export interface DeleteAuthorArgs { - id: any; + id: number; } export async function deleteAuthor(database: Database, args: DeleteAuthorArgs): Promise { diff --git a/src/drivers/better-sqlite3.ts b/src/drivers/better-sqlite3.ts index c6210e8..e42770d 100644 --- a/src/drivers/better-sqlite3.ts +++ b/src/drivers/better-sqlite3.ts @@ -55,7 +55,7 @@ export class Driver { } let typ: TypeNode = factory.createKeywordTypeNode(SyntaxKind.AnyKeyword); - switch (column.type.name) { + switch (column.type.name.toLowerCase()) { case "int": case "integer": case "tinyint": @@ -89,6 +89,11 @@ export class Driver { typ = factory.createKeywordTypeNode(SyntaxKind.BooleanKeyword); break; } + case "text": + case "varchar": { + typ = factory.createKeywordTypeNode(SyntaxKind.StringKeyword); + break; + } case "date": case "datetime": case "timestamp": {