crisp-im / node-crisp-api

:zap: Crisp API Node Wrapper
https://docs.crisp.chat/guides/rest-api/
MIT License
99 stars 39 forks source link

Type definition is outdated and does not include services #40

Closed williamchong closed 1 year ago

williamchong commented 2 years ago

image Services like .website are not included in type and causes a ts error

baptistejamin commented 2 years ago

Hello!

We think it;'s just a lint error from typescript

williamchong commented 2 years ago

https://github.com/crisp-im/node-crisp-api/blob/master/types/crisp.d.ts

Your definition for Crisp does not include services like .website, If typescript does not see it in the type definition, it cause a compilation error, not lint error. image

It can be "mitigated" by disabling typescript error for every Crisp.website lines, but that would defeat the purpose of having a type definition

eliottvincent commented 2 years ago

Hey William!

No one at Crisp is doing any TypeScript, so we accept PRs on this.

alexblack commented 2 years ago

Hi, same issue here :(

aoloo commented 2 years ago

any movement on this? Seeing the same issue.

eliottvincent commented 2 years ago

Hey @aoloo , no movement, we're open to PRs.

frank505 commented 1 year ago

still not resolved :( for Typescript

eliottvincent commented 1 year ago

Hey @frank505 ! We're 100% open to PR's on this one.

valeriansaliou commented 1 year ago

We'd eagerly accept a PR doing the following: have a command to auto-gen TS definitions from JSDoc (which we 100% maintain), and a GH actions test to ensure all TS definitions are up-to-date, failing if not thus prompting devs to sync those definitions before committing.

valeriansaliou commented 1 year ago

All fixed in v7.4.1, and tested.

Note that exported services are using the any type, so resource method prototypes will not be checked in TypeScript. Although the base Crisp class is 100% defined and type-checked. This is for convenience on our side as we use pure-JS for our library, and would like to provide TypeScript support whilst not maintaining definition files ourselves (meaning, we auto-generate them from JSDoc).