docusign-esign-node-client icon indicating copy to clipboard operation
docusign-esign-node-client copied to clipboard

Question. Typescript integration.

Open nlapshin opened this issue 3 years ago • 6 comments

I try to implement integration using typescript.

I installed "docusign-esign": "5.18.0" and "@types/docusign-esign": "5.6.2". I tried to use some feature and I was seeing some errors in import. For example, Property 'EnvelopeDefinition' does not exist on type 'typeof import("/home/nik/projects/my-project/node_modules/@types/docusign-esign/index")

Maybe, I do something in wrong way.

nlapshin avatar Sep 09 '22 13:09 nlapshin

@nlapshin Could you provide a bit more background on the exact steps you take to reproduce this error along with at what point exactly does this error occur at? If you have any images you could provide seeing it visually might help as well.

  • Koll DocuSign Developer Support

kollDocuSign avatar Sep 12 '22 17:09 kollDocuSign

Sorry for late answer.

For example, i installed docusign-esign and @types/docusign-esign package and tried to do something like code below:

import { EnvelopeDefinition } from 'docusign-esign';

const env = EnvelopeDefinition();

And I see error 'EnvelopeDefinition' only refers to a type, but is being used as a value here.ts

Because in @types/docusign-esign EnvelopeDefinition is inteface(not class)

nlapshin avatar Sep 19 '22 14:09 nlapshin

@nlapshin It might be worthwhile to start by using the quick start guide to see working examples and building from the quick start.

The Quick start guide is found here: https://developers.docusign.com/docs/esign-rest-api/quickstart/overview/ We also have a tool you can use where you select a language and use a drag and drop approach to building out sample code here: https://apirequestbuilder.docusign.com/

Both give working examples of creating envelopes via the API that should avoid the types of errors you are running into.

kollDocuSign avatar Sep 20 '22 16:09 kollDocuSign

@kollDocuSign Thanks for your answer. Unfortunately, there is no example typescript in the examples. I don't have problem usign pure Node.js, I have problems when I use Typescript(and declaration file from @types/docusign-esign).

I found similar problem in stackoverflow https://stackoverflow.com/questions/69429795/unable-to-find-docusign-models-in-typescript-code

nlapshin avatar Sep 27 '22 20:09 nlapshin

@kollDocuSign Also, I created simple repo where you can see problems with import some parts of docusign library(Document for example).

https://github.com/nlapshin/docusign-typescript-example/blob/main/src/index.ts

nlapshin avatar Sep 27 '22 20:09 nlapshin

@nlapshin After some internal outreach the input back was that the SDK doesn't define any types so typescript won’t be supported. A workaround might be to follow this article: https://medium.com/@steveruiz/using-a-javascript-library-without-type-declarations-in-a-typescript-project-3643490015f3

kollDocuSign avatar Sep 28 '22 19:09 kollDocuSign