From d010c0e7b066d6c9962292fd49fe9446ca7161d1 Mon Sep 17 00:00:00 2001 From: Dipro Bhowmik Date: Fri, 8 Sep 2023 15:03:14 -0400 Subject: [PATCH 1/3] Add `exports.types` to package.json Added the types file path to `exports.types` in package.json to prevent the following error: ``` Could not find a declaration file for module '@mondaycom/apps-sdk'. '/Users/diprobhowmik/Documents/Development/monday-code-demo/next-js-typescript-test/node_modules/@mondaycom/apps-sdk/dist/esm/index.js' implicitly has an 'any' type. There are types at '/Users/diprobhowmik/Documents/Development/monday-code-demo/next-js-typescript-test/node_modules/@mondaycom/apps-sdk/dist/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@mondaycom/apps-sdk' library may need to update its package.json or typings. ``` The reason behind this error is that node will ignore the `types` field if the package has an `exports` field. And since the `exports` didn't include an `exports.types`, node would not be able to find the relevant types . --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1a23586..e600c4b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ ".": { "import": "./dist/esm/index.js", "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" + "default": "./dist/cjs/index.js", + "types": "./dist/types/index.d.ts" } }, "scripts": { From a001133bc999a4ec339e6513dab10f25c424ee5c Mon Sep 17 00:00:00 2001 From: Dipro Bhowmik Date: Thu, 2 May 2024 16:53:20 -0400 Subject: [PATCH 2/3] Make types the first export --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e600c4b..96b5c8d 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "types": "./dist/types/index.d.ts", "exports": { ".": { + "types": "./dist/types/index.d.ts" "import": "./dist/esm/index.js", "require": "./dist/cjs/index.js", "default": "./dist/cjs/index.js", - "types": "./dist/types/index.d.ts" } }, "scripts": { From 1d62ffa1f0a0dd31ee434ea17f8e9e597a9f73bd Mon Sep 17 00:00:00 2001 From: Dipro Bhowmik Date: Thu, 2 May 2024 16:53:48 -0400 Subject: [PATCH 3/3] Fix comma --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 96b5c8d..3047ffc 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "types": "./dist/types/index.d.ts", "exports": { ".": { - "types": "./dist/types/index.d.ts" + "types": "./dist/types/index.d.ts", "import": "./dist/esm/index.js", "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js", + "default": "./dist/cjs/index.js" } }, "scripts": {