const newToken = await db .selectFrom("tokens") .selectAll() .where("id", "=", token.insertId) .$narrowType<Token>() .executeTakeFirst();
import { ColumnType, Generated, Selectable } from "kysely";import { TokenType } from "./lib/token";export interface Database { tokens: TokenType;}export interface TokenTable { id: Generated<Number>; secret: string; description: string; type: TokenType; created_at: ColumnType<Date, string | undefined, never>;}export type Token = Selectable<TokenTable>;
export enum TokenType { ADMIN, SERVER, CLIENT,}
TS2345: Argument of type "id" is not assignable to parameter of type ReferenceExpression<Database, "tokens">