From f6c77c70ab348514c1660a9df0bc37845331c844 Mon Sep 17 00:00:00 2001 From: wesleybl Date: Thu, 8 Aug 2024 12:29:43 -0300 Subject: [PATCH 1/2] Fixes imports to avoid type errors in addons tests When we shadow a module in an addon and this module is imported relatively in some .ts file used in the addon tests, we receive the error: Could not find a declaration file for module './Module'. '../Module.jsx' implicitly has an 'any' type So we use absolute import in .ts files to avoid this problem. --- packages/volto/news/6244.bugfix | 1 + packages/volto/src/helpers/Blocks/cloneBlocks.ts | 2 +- packages/volto/src/helpers/FormValidation/FormValidation.jsx | 2 +- packages/volto/src/helpers/FormValidation/validators.ts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 packages/volto/news/6244.bugfix diff --git a/packages/volto/news/6244.bugfix b/packages/volto/news/6244.bugfix new file mode 100644 index 0000000000..781dcc9c2a --- /dev/null +++ b/packages/volto/news/6244.bugfix @@ -0,0 +1 @@ +Fixes imports to avoid type errors in addons tests. @wesleybl diff --git a/packages/volto/src/helpers/Blocks/cloneBlocks.ts b/packages/volto/src/helpers/Blocks/cloneBlocks.ts index 32a5e76693..452531899a 100644 --- a/packages/volto/src/helpers/Blocks/cloneBlocks.ts +++ b/packages/volto/src/helpers/Blocks/cloneBlocks.ts @@ -4,7 +4,7 @@ import { getBlocksFieldname, getBlocksLayoutFieldname, hasBlocksData, -} from './Blocks'; +} from '@plone/volto/helpers/Blocks/Blocks'; import config from '@plone/registry'; export function cloneBlocks(blocksData) { diff --git a/packages/volto/src/helpers/FormValidation/FormValidation.jsx b/packages/volto/src/helpers/FormValidation/FormValidation.jsx index 5aa25dc0c4..92dcdd7cee 100644 --- a/packages/volto/src/helpers/FormValidation/FormValidation.jsx +++ b/packages/volto/src/helpers/FormValidation/FormValidation.jsx @@ -1,5 +1,5 @@ import { map, keys, intersection, isEmpty } from 'lodash'; -import { messages } from '../MessageLabels/MessageLabels'; +import { messages } from '@plone/volto/helpers/MessageLabels/MessageLabels'; import config from '@plone/volto/registry'; import { toast } from 'react-toastify'; import Toast from '@plone/volto/components/manage/Toast/Toast'; diff --git a/packages/volto/src/helpers/FormValidation/validators.ts b/packages/volto/src/helpers/FormValidation/validators.ts index 82e927b927..ad4f461e48 100644 --- a/packages/volto/src/helpers/FormValidation/validators.ts +++ b/packages/volto/src/helpers/FormValidation/validators.ts @@ -1,4 +1,4 @@ -import { validationMessage } from './FormValidation'; +import { validationMessage } from '@plone/volto/helpers/FormValidation/FormValidation'; import { messages } from '@plone/volto/helpers/MessageLabels/MessageLabels'; type MinMaxValidator = { From f24eec117194f0021ba64b2552afca0a516f6abe Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Thu, 8 Aug 2024 13:50:40 -0700 Subject: [PATCH 2/2] Update packages/volto/news/6244.bugfix --- packages/volto/news/6244.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/volto/news/6244.bugfix b/packages/volto/news/6244.bugfix index 781dcc9c2a..4b9b29e635 100644 --- a/packages/volto/news/6244.bugfix +++ b/packages/volto/news/6244.bugfix @@ -1 +1 @@ -Fixes imports to avoid type errors in addons tests. @wesleybl +Changed imports from relative to absolute to avoid type errors in add-on tests. @wesleybl