From 07f3ca61ce94a3f43dcf8bad080cc2becb6733f7 Mon Sep 17 00:00:00 2001 From: "Jorge S. Cuesta" Date: Thu, 30 Jan 2025 16:53:14 -0400 Subject: [PATCH] Add `@ts-ignore` to suppress TypeScript error in model template The added `@ts-ignore` directive resolves a TypeScript error when calling `store.getByField` in the generated model template. This mostly to achieve a quick fix which should not be the final solution. The root problem is that Entity and BaseEntity does not allow other types than string for id, so the Compact and CompactEntity are an Omit from Entity with an override of the id field. --- packages/cli/src/template/model.ts.ejs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/src/template/model.ts.ejs b/packages/cli/src/template/model.ts.ejs index fb730b093b..e63d13083a 100644 --- a/packages/cli/src/template/model.ts.ejs +++ b/packages/cli/src/template/model.ts.ejs @@ -68,6 +68,7 @@ export class <%= props.className %> implements CompatEntity { } } <% } else { %>static async getBy<%=helper.upperFirst(field.name) %>(<%=field.name %>: <%=field.type %>, options: GetOptionsProps>): Promise<<%=props.className %>[]> { + // @ts-ignore const records = await store.getByFieldProps>('<%=props.entityName %>', '<%=field.name %>', <%=field.name %>, options); return records.map(record => this.create(record as unknown as <%= props.className %>Props)); }