I’m using the DocuSign Node.js package to create an envelope in my Next.js application. I have imported the necessary classes from DocuSign as:
import { ApiClient, EnvelopesApi, EnvelopeDefinition, TemplateRole } from 'docusign-esign';
But, it seems like I am unable to use the “EnvelopeDefinition” method. I have it as:
// Prepare the envelope details
const envelopeDefinition = new EnvelopeDefinition();
The issue I’m having is that I get the message; “'EnvelopeDefinition' only refers to a type, but is being used as a value here.” when try to initialize the envelope definition.
What am I doing wrong? Can someone please asssist?
Best answer by Sai.Dandamudi
Hello Team
The issue is likely due to how TypeScript handles type-only imports versus actual value imports.
const envelopeDefinition = { / initialize your envelope details here as an object / }; Or, may be as below:
This approach works as EnvelopeDefinition in DocuSign SDK might not be a JavaScript constructor. Instead, the SDK uses plain objects for configuration.
This approach works as EnvelopeDefinition in DocuSign SDK might not be a JavaScript constructor. Instead, the SDK uses plain objects for configuration.
Thank you for your response to me enquiry. I’ve managed to work around the issue by using the RESTAPI instead. I found that I was encountering numerous issues when I used the DocuSign SDK. I’ve implemented a similar structure as you’ve proposed in your solution and my application is now working as expected.
You can login or register as either a Docusign customer or developer. If you don’t already have a Docusign customer or developer account, you can create one for free when registering.
You can login or register as either a Docusign customer or developer. If you don’t already have a Docusign customer or developer account, you can create one for free when registering.