Skip to content

Commit

Permalink
Chore: Model constructor, stricter types
Browse files Browse the repository at this point in the history
  • Loading branch information
Skye-31 committed Sep 17, 2022
1 parent 72da2bb commit 3843df1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/spotty-mangos-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"d1-orm": patch
---

Chore: Make Model#constructor#columns use the provided type of the model, rather than any keys
2 changes: 1 addition & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Model<T extends object> {
D1Orm: D1Orm;
tableName: string;
},
columns: Record<string, ModelColumn>
columns: Record<Extract<keyof T, string>, ModelColumn>
) {
this.#D1Orm = options.D1Orm;
this.tableName = options.tableName;
Expand Down

0 comments on commit 3843df1

Please sign in to comment.