Skip to content

Commit

Permalink
fix number return types
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Apr 12, 2024
1 parent e021b3b commit a427c7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/codegen/makeGetter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ describe("makeGetter", () => {
},
`<({ id: 1, value: "the_option_name", color: "red" } | { id: 2, value: "the_option_name_2", color: "blue" })>`,
],
[{ type: "number" }, `: number {`],
])("%s => `%s`", (field, expected) => {
expect(run(field)).toContain(expected);
});
Expand Down
4 changes: 4 additions & 0 deletions src/codegen/makeGetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ function getReturnType(field: FieldDefinition, tables: Table[]): string {
.join(" | ");
}

if (field.type === "number") {
return "number";
}

return makeFieldType(field);
}

Expand Down

0 comments on commit a427c7c

Please sign in to comment.