Skip to content

Commit 0caa432

Browse files
committed
UIEXT-3031: Loosen type bound for UiSchemaWithProvidedOptions
UIEXT-3031 (Support multiple modes for file selection widget)
1 parent ac3c502 commit 0caa432

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/easy-birds-relax.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@knime/jsonforms": patch
3+
---
4+
5+
Loosen type bound of internal jsonforms type construction

packages/jsonforms/src/uiComponents/composables/useProvidedState.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type Ref, onMounted, ref, unref } from "vue";
22

33
import inject from "../../utils/inject";
44

5-
export type UiSchemaWithProvidedOptions<T extends Record<string, unknown>> = {
5+
export type UiSchemaWithProvidedOptions<T extends object> = {
66
options?: T;
77
providedOptions?: string[];
88
} & (
@@ -46,7 +46,7 @@ export type ExtractNestedValue<
4646
? T[P]
4747
: never;
4848
export default <
49-
U extends UiSchemaWithProvidedOptions<Record<string, unknown>>,
49+
U extends UiSchemaWithProvidedOptions<object>,
5050
K extends Paths<NonUndefined<U["options"]>>,
5151
D = ExtractNestedValue<NonUndefined<U["options"]>, K> | null,
5252
>(
@@ -57,6 +57,7 @@ export default <
5757
const addStateProviderListener = inject("addStateProviderListener");
5858

5959
const state = ref(
60+
// @ts-expect-error options is of type object and cannot be indexed with K
6061
uischema.value.options?.[providedOptionName] ?? defaultValue,
6162
) as Ref<NonUndefined<D>>;
6263

0 commit comments

Comments
 (0)