Type alias Infer<T>

Infer<T>: InferFromColumns<T["columns"]>

Infer is a utility type that allows you to infer the type of a model from the columns.

Type Parameters

Example

import { Model, DataTypes } from "d1-orm";
import type { Infer } from "d1-orm";

const users = new Model(
{
tableName: "users",
D1Orm: MyD1OrmInstance,
},
{
name: {
type: DataTypes.STRING
},
age: {
type: DataTypes.NUMBER
},
}
);

type User = Infer<typeof users>;
//type User = {
//name: string,
//age: number
//}

Generated using TypeDoc