Skip to content

Commit

Permalink
fix(ts): wrong @ts-ignore usage
Browse files Browse the repository at this point in the history
  • Loading branch information
VaiTon committed Oct 31, 2024
1 parent 550f096 commit 4c10755
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class OpenFoodFacts {
*/
constructor(
fetch: typeof global.fetch,
options: OpenFoodFactsOptions = { country: "world" }
options: OpenFoodFactsOptions = { country: "world" },
) {
this.baseUrl = `https://${options.country}.openfoodfacts.org`;
this.fetch = fetch;
Expand All @@ -69,10 +69,10 @@ export class OpenFoodFacts {

private async getTaxoEntry<T extends TaxoNode>(
taxo: string,
entry: string
entry: string,
): Promise<T> {
const res = await fetch(
`${this.baseUrl}/api/v2/taxonomy?tagtype=${taxo}&tags=${entry}`
`${this.baseUrl}/api/v2/taxonomy?tagtype=${taxo}&tags=${entry}`,
);

return (await res.json()) as T;
Expand Down Expand Up @@ -140,7 +140,7 @@ export class OpenFoodFacts {
async performOCR(
barcode: string,
photoId: string,
ocrEngine: "google_cloud_vision" = "google_cloud_vision"
ocrEngine: "google_cloud_vision" = "google_cloud_vision",
): Promise<{ status?: number } | undefined> {
const res = await this.rawv2.GET("/cgi/ingredients.pl", {
params: {
Expand All @@ -159,7 +159,6 @@ export class OpenFoodFacts {
async getProductImages(barcode: string): Promise<string[] | null> {
const res = await this.rawv2.GET("/api/v2/product/{barcode}", {
params: {
// @ts-expect-error query is not parsed correctly
query: {
fields: "images",
},
Expand All @@ -179,7 +178,7 @@ export class OpenFoodFacts {

async search(
fields?: string,
sortBy?: componentsv2["parameters"]["sort_by"]
sortBy?: componentsv2["parameters"]["sort_by"],
): Promise<SearchResultV2 | undefined> {
const res = await this.rawv2.GET("/api/v2/search", {
params: { query: { fields, sort_by: sortBy } },
Expand Down

0 comments on commit 4c10755

Please sign in to comment.