diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-10-10 01:12:15 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-10-10 01:12:15 -0400 |
commit | 1367d56a4fc8f055f7765636d985615c5c534e9d (patch) | |
tree | 803ec23ebc93fac92d8cf5690d5add6479b2ed56 /src | |
parent | ef5948e183b15009615818e22e9ea9c748abce2c (diff) |
generics for content type
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes.tsx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes.tsx index 56902ef14..073822fa8 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes.tsx @@ -29,11 +29,11 @@ type FieldSettings = { description?: string; }; -interface ConstructedField { +interface ConstructedField<T> { renderedDoc: () => Doc; validSubfieldGroups: () => Field[]; - setContent: (newContent: any) => void; - getContent: () => any; + setContent: (newContent: T) => void; + getContent: () => T; } class Field { @@ -114,7 +114,7 @@ class Field { } } -class TextField extends Field implements ConstructedField { +class TextField extends Field implements ConstructedField<string> { content: string = ''; constructor(settings: FieldSettings, parent: Field) { @@ -137,11 +137,7 @@ class TextField extends Field implements ConstructedField { return []; } - setContent = (newContent: any) => { - if (newContent !instanceof String){ - return; - } - + setContent = (newContent: string) => { this.content = newContent; } |