MadKudu / node-hubspot

Node wrapper for the HubSpot API
MIT License
192 stars 157 forks source link

Unable compile a TypeScript project using this #318

Open stephenmathieson opened 2 years ago

stephenmathieson commented 2 years ago

Trying to run the TypeScript compiler on a file that uses this module yields many errors about request-promise. Adding @types/request-promise does not fix it.

Example:

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2019",
    "outDir": "./dist",
    "module": "commonjs",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "noImplicitAny": true,
    "skipLibCheck": true
  },
  "include": ["src/"]
}

src/thing.ts

import Hubspot from "hubspot";

const h = new Hubspot({ apiKey: "abc" });

h.contacts.create({});
Error logs ``` $ tsc node_modules/hubspot/lib/typescript/broadcast.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/campaign.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/company.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/company_property.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/company_property_group.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/contact.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/contact_property.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/crm_associations.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/deal.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/deal_property.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/deal_property_group.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/emails.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/engagement.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/file.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/form.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/integrations.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/list.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/marketing_email.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/oauth.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/owner.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/page.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/pipeline.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/subscription.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/ticket.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/timeline.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ node_modules/hubspot/lib/typescript/workflow.ts:1:32 - error TS7016: Could not find a declaration file for module 'request-promise'. '/private/var/folders/rv/7q3pn2c94pbf82592qpt1w2m0000gq/T/hubspot-ts-test/node_modules/request-promise/lib/rp.js' implicitly has an 'any' type. Try `npm i --save-dev @types/request-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'request-promise';` 1 import { RequestPromise } from 'request-promise'    ~~~~~~~~~~~~~~~~~ Found 26 errors in 26 files. Errors Files 1 node_modules/hubspot/lib/typescript/broadcast.ts:1 1 node_modules/hubspot/lib/typescript/campaign.ts:1 1 node_modules/hubspot/lib/typescript/company.ts:1 1 node_modules/hubspot/lib/typescript/company_property.ts:1 1 node_modules/hubspot/lib/typescript/company_property_group.ts:1 1 node_modules/hubspot/lib/typescript/contact.ts:1 1 node_modules/hubspot/lib/typescript/contact_property.ts:1 1 node_modules/hubspot/lib/typescript/crm_associations.ts:1 1 node_modules/hubspot/lib/typescript/deal.ts:1 1 node_modules/hubspot/lib/typescript/deal_property.ts:1 1 node_modules/hubspot/lib/typescript/deal_property_group.ts:1 1 node_modules/hubspot/lib/typescript/emails.ts:1 1 node_modules/hubspot/lib/typescript/engagement.ts:1 1 node_modules/hubspot/lib/typescript/file.ts:1 1 node_modules/hubspot/lib/typescript/form.ts:1 1 node_modules/hubspot/lib/typescript/integrations.ts:1 1 node_modules/hubspot/lib/typescript/list.ts:1 1 node_modules/hubspot/lib/typescript/marketing_email.ts:1 1 node_modules/hubspot/lib/typescript/oauth.ts:1 1 node_modules/hubspot/lib/typescript/owner.ts:1 1 node_modules/hubspot/lib/typescript/page.ts:1 1 node_modules/hubspot/lib/typescript/pipeline.ts:1 1 node_modules/hubspot/lib/typescript/subscription.ts:1 1 node_modules/hubspot/lib/typescript/ticket.ts:1 1 node_modules/hubspot/lib/typescript/timeline.ts:1 1 node_modules/hubspot/lib/typescript/workflow.ts:1 ```
OakBehringer commented 1 year ago

yarn add @types/request-promise --dev