I am using the DocuSign eSignature SDK in my TypeScript project, and I am encountering the following TypeScript errors when trying to access certain properties:
Property 'EnvelopeDefinition' does not exist on type 'typeof import("c:/Users/USER/Desktop/docusign/node_modules/@types/docusign-esign/index")'.ts(2339) Property 'Tabs' does not exist on type 'typeof import("c:/Users/USER/Desktop/docusign/node_modules/@types/docusign-esign/index")'.ts(2339) Here is the TypeScript function where these errors occur:
function makeEnvelope(name: string, email: string, company: string): docusign.EnvelopeDefinition {
const env = new docusign.EnvelopeDefinition(); // Error here
env.templateId = process.env.TEMPLATE_ID!;
const text = new docusign.Text();
text.tabLabel = "company_name";
text.value = company;
const tabs = new docusign.Tabs(); // Error here
tabs.textTabs = [text];
const signer1 = new docusign.TemplateRole();
signer1.email = email;
signer1.name = name;
signer1.tabs = tabs;
signer1.clientUserId = process.env.CLIENT_USER_ID!;
signer1.roleName = 'Applicant';
env.templateRoles = [signer1];
env.status = "sent";
return env;
}
Steps I have tried:
Ensured that the DocuSign eSignature SDK is installed correctly with npm install docusign-esign.
Checked that the @types/docusign-esign package is installed and up-to-date.
Verified the proper import of the docusign module: import * as docusign from 'docusign-esign';
What is causing this error, and how can I resolve it to properly access the EnvelopeDefinition and Tabs classes in my TypeScript project?
I am using the DocuSign eSignature SDK in my TypeScript project, and I am encountering the following TypeScript errors when trying to access certain properties:
Property 'EnvelopeDefinition' does not exist on type 'typeof import("c:/Users/USER/Desktop/docusign/node_modules/@types/docusign-esign/index")'.ts(2339) Property 'Tabs' does not exist on type 'typeof import("c:/Users/USER/Desktop/docusign/node_modules/@types/docusign-esign/index")'.ts(2339) Here is the TypeScript function where these errors occur:
function makeEnvelope(name: string, email: string, company: string): docusign.EnvelopeDefinition {
const env = new docusign.EnvelopeDefinition(); // Error here
env.templateId = process.env.TEMPLATE_ID!;
const text = new docusign.Text();
text.tabLabel = "company_name";
text.value = company;
const tabs = new docusign.Tabs(); // Error here
tabs.textTabs = [text];
const signer1 = new docusign.TemplateRole();
signer1.email = email;
signer1.name = name;
signer1.tabs = tabs;
signer1.clientUserId = process.env.CLIENT_USER_ID!;
signer1.roleName = 'Applicant';
env.templateRoles = [signer1];
env.status = "sent";
return env;
}
Steps I have tried:
Ensured that the DocuSign eSignature SDK is installed correctly with npm install docusign-esign.
Checked that the @types/docusign-esign package is installed and up-to-date.
Verified the proper import of the docusign module: import * as docusign from 'docusign-esign';
What is causing this error, and how can I resolve it to properly access the EnvelopeDefinition and Tabs classes in my TypeScript project?
I use "@types/docusign-esign" and would have
import { ApiClient, EnvelopeDefinition } from 'docusign-esign' //include everything you need
Try replacing
const env = new docusign.EnvelopeDefinition(); // Error here
with
const env = <EnvelopeDefinition>{};