typesense / typesense-js

JavaScript / TypeScript client for Typesense
https://typesense.org/docs/api
Apache License 2.0
395 stars 74 forks source link

Typescript build errors #103

Open moarwick opened 2 years ago

moarwick commented 2 years ago

Description

We have a Typescript project, built using Webpack + ts-loader. In the client SPA, I've imported Typesense the traditional way import * as Typesense from 'typesense' which seems to work well (typings come through). The code builds and runs fine, but at build time I'm getting the following errors, so our CI/CD pipeline stops :(

ERROR in /app/node_modules/typesense/lib/Typesense/Documents.d.ts
2:12-13
[tsl] ERROR in /app/node_modules/typesense/lib/Typesense/Documents.d.ts(2,13)
      TS1005: '=' expected.
ts-loader-default_3ef1a0ebb55d0532

ERROR in /app/node_modules/typesense/lib/Typesense/Documents.d.ts
2:32-36
[tsl] ERROR in /app/node_modules/typesense/lib/Typesense/Documents.d.ts(2,33)
      TS1005: ';' expected.
ts-loader-default_3ef1a0ebb55d0532

Expected Behavior

Should transpile without errors. Is there a different way I should be importing the browser client?

Metadata

Typsense Version: "typesense": "^1.1.2" "@babel/runtime": "^7.16.7" <-- we aren't running Babel, is it needed?

OS: OSX BigSur 11.6

jasonbosco commented 2 years ago

@dcantu476 Any thoughts on this?

dcantu476 commented 2 years ago

@jasonbosco @moarwick

The first place I would check is to see what is different between the CI pipeline and your regular build steps. Maybe the CI pipeline is using a different version of typescript? Other than that, the formatting of the files is correct from what I can see.