From f35497d8c1085d9612744b454f0b17ac76a8dca4 Mon Sep 17 00:00:00 2001 From: Daniel Oakman <141111365+danoaky-tiny@users.noreply.github.com> Date: Tue, 28 May 2024 22:16:45 +1000 Subject: [PATCH] INT-3308_2: Put back support for any unknown key to be assigned as an init prop (#532) * INT-3308_2: Any other string key is typed as any again and don't export EditorOptions * INT-3308_2: Added a test for unknown other `init` props --- src/main/ts/components/Editor.tsx | 4 ++-- src/test/ts/browser/EditorInitTest.ts | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main/ts/components/Editor.tsx b/src/main/ts/components/Editor.tsx index 00ebfd9d..a63e1094 100644 --- a/src/main/ts/components/Editor.tsx +++ b/src/main/ts/components/Editor.tsx @@ -14,14 +14,14 @@ interface DoNotUse { type OmittedInitProps = 'selector' | 'target' | 'readonly' | 'license_key'; -export type EditorOptions = Parameters[0]; +type EditorOptions = Parameters[0]; export type InitOptions = Omit, OmittedInitProps> & { selector?: DoNotUse<'selector prop is handled internally by the component'>; target?: DoNotUse<'target prop is handled internally by the component'>; readonly?: DoNotUse<'readonly prop is overridden by the component, use the `disabled` prop instead'>; license_key?: DoNotUse<'license_key prop is overridden by the integration, use the `licenseKey` prop instead'>; -}; +} & { [key: string]: unknown }; export type Version = `${'4' | '5' | '6' | '7'}${'' | '-dev' | '-testing' | `.${number}` | `.${number}.${number}`}`; diff --git a/src/test/ts/browser/EditorInitTest.ts b/src/test/ts/browser/EditorInitTest.ts index 497e5ff7..df8fe694 100644 --- a/src/test/ts/browser/EditorInitTest.ts +++ b/src/test/ts/browser/EditorInitTest.ts @@ -85,6 +85,28 @@ describe('EditorInitTest', () => { } }); }); + + it('Assigning other unknown props to the editor is allowed', async () => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + using _ = await render({ + init: { + mergetags_list: [{ + title: 'Client', + menu: [ + { + value: 'Client.LastCallDate', + title: 'Call date' + }, + { + value: 'Client.Name', + title: 'Client name' + } + ] + }], + something_else: 'value' + } + }); + }); }) ); });