Skip to content

v0.5.0

Compare
Choose a tag to compare
@github-actions github-actions released this 30 Sep 17:00
· 33 commits to main since this release
ad8ce08

Minor Changes

  • #44 101043b Thanks @Skye-31! - Feat: Inferred Types!

    Models no longer require you to specify a definition when you create them. Instead, you can just pass in an object and the model will infer the types for you. See the following example:

    import { Model, DataTypes } from "d1-orm";
    import type { Infer } from "d1-orm";
    
    const users = new Model(
    	{
    		tableName: "users",
    		D1Orm: MyD1OrmInstance,
    	},
    	{
    		name: DataTypes.STRING,
    		age: DataTypes.NUMBER,
    	}
    );
    
    type User = Infer<typeof users>;
    // type User = {
    // 	name: string,
    // 	age: number
    // }