mondaycom / monday-sdk-js

Node.js and JavaScript SDK for developing over the monday.com platform
https://monday.com
MIT License
87 stars 39 forks source link

monday-sdk-js Types not found after migrating quickstart-react to react Typescript #86

Closed goodpilotfish closed 1 year ago

goodpilotfish commented 1 year ago

Describe the bug When running tsc I get the following warning:

src/App.tsx:33:23 - error TS7016: Could not find a declaration file for module 'monday-sdk-js'. '/repo/node_modules/monday-sdk-js/src/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/monday-sdk-js` if it exists or add a new declaration (.d.ts) file containing `declare module 'monday-sdk-js';`

33 import mondaySdk from "monday-sdk-js";

Steps to reproduce

  1. Clone (quickstart-react)[https://github.com/mondaycom/welcome-apps/tree/master/apps/quickstart-react] from mondays offical welcome apps repo
  2. Migrate quickstart-react to Typescript to a working project
  3. Run tsc
  4. See error above

Note: If you install @types/monday-sdk-js you see the following warning in package-lock.js, so I assume it should not fix my problem.

"node_modules/@types/monday-sdk-js": {
      "version": "0.2.1",
      "resolved": "https://registry.npmjs.org/@types/monday-sdk-js/-/monday-sdk-js-0.2.1.tgz",
      "integrity": "sha512-avjXIhnk3iQuK5OMPe0VlkT6iedYXJJcFr7kSgTsSW9vSmmv+NwQrMwS5IhatAzIxtPpl9CKpF0tyUmUJboc5A==",
      "deprecated": "This is a stub types definition. monday-sdk-js provides its own type definitions, so you do not need this installed.",
      "dependencies": {
        "monday-sdk-js": "*"
      }
    },

Expected behavior No error when running tsc

Thoughts: I see the types folder in the monday-sdk-js project. Is some extra typeRoots necessery in the tsconfig.json to make this work?

Thanks!

yuhgto commented 1 year ago

Can you install the latest version of the SDK by running npm install monday-sdk-js@latest and see if it continues?

I was working the other day and found this same issue, turned out that my npm install didn't actually install the latest version of the SDK.

goodpilotfish commented 1 year ago

Thanks! Installed it without "@latest" and apparently that pulled a pre-types version.

-        "monday-sdk-js": "^0.1.4",
+        "monday-sdk-js": "^0.3.0",

Now it works well. Happy coding!