#community-help

Resolving Typesense Error in Netlify Deployment

TLDR Bryan encountered a Typesense error during a Netlify deployment. Jason and Damian determined the problem lay with array signatures and executed a fix. Bryan confirmed this resolved the issue.

Powered by Struct AI
+12
raised_hands1
10
22mo
Solved
Join the chat
Nov 11, 2021 (22 months ago)
Bryan
Photo of md5-a9ef046fd3e87da2ab35f526146a2d03
Bryan
01:41 PM
Hi,
I am running into a TS error in Typesense that is stopping my builds on a Netlify deployment
ERROR in /opt/build/repo/node_modules/typesense/lib/Typesense/Overrides.d.ts(14,17):
Cannot find name 'id'.
  12 |         }
  13 |     ];
> 14 |     excludes?: [id: string];
     |                 ^
  15 | }
  16 | export interface OverridesRetrieveSchema {
  17 |     overrides: OverrideSchema[];
Version: typescript 3.8.3

Typescript is not my strength but possible solutions that both allow for local building without error are
interface excludeId {
    id: string
}
excludes?: [excludeId];

OR 

excludes?: Array<string>;

Happy to create a PR if this looks viable.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:19 PM
Damian Any thoughts on this ^
Damian
Photo of md5-bae2dd117ba2dd0626429c37e3d31153
Damian
06:17 PM
It just depends on what the actual signature is.

If it's an array of strings, then string[] or Array&lt;string&gt; will do. If it's an array of objects, with an id param that is a string, then something like [{id: string }] will work.

I wouldn't create an excludeId interface since its already so abstract, though something like ItemIdentifier or OverrideIdentifier could work and you could use it on both the includes and excludes. Either way, its a small pr
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:38 PM
It's an array of objects like this:

{
  "id": "customize-apple",
  "excludes": [
    {
      "id": "287"
    }
  ],
  "includes": [
    {
      "id": "422",
      "position": 1
    },
    {
      "id": "54",
      "position": 2
    }
  ],
  "rule": {
    "match": "exact",
    "query": "apple"
  }
}
Bryan
Photo of md5-a9ef046fd3e87da2ab35f526146a2d03
Bryan
09:37 PM
Hey Jason and Damian Thanks for looking at this. Looks like you all are working out what you want to do. Let me know if you need anything from me.
Damian
Photo of md5-bae2dd117ba2dd0626429c37e3d31153
Damian
09:44 PM
I'll put something out in a PR for you to look at.
+11
10:20
Damian
10:20 PM
Jason PR is ready for your review.
Nov 12, 2021 (22 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:28 AM
Thanks Damian!

Bryan I've published this under 1.0.3-1. Could you give it a shot now?
Bryan
Photo of md5-a9ef046fd3e87da2ab35f526146a2d03
Bryan
01:54 PM
Jason Damian That works 8:51:55 AM: Finished processing build request

Thanks so much for the assistance.
+11
Damian
Photo of md5-bae2dd117ba2dd0626429c37e3d31153
Damian
02:13 PM
Glad I was able to help!
raised_hands1