From 3bf30f0c1e8129ac96dae6a76a9c9f2f641671da Mon Sep 17 00:00:00 2001 From: Tomoyuki Hata Date: Sun, 28 Feb 2021 06:33:06 +0900 Subject: [PATCH] Add generics to OutputBlockData (#1326) * Add generics to OutputBlockData * Fix typo * Update CHANGELOG.md * Add @template description Co-authored-by: Peter Savchenko Co-authored-by: George Berezhnoy --- docs/CHANGELOG.md | 1 + types/data-formats/output-data.d.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 93f47350a..b070c5b87 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,6 +8,7 @@ - `Improvements` - Remove bundles from the repo [#1541](https://github.com/codex-team/editor.js/pull/1541). - `Improvements` - Document will be scrolled when blocks are selected with `SHIFT+UP` or `SHIFT+DOWN` [#1447](https://github.com/codex-team/editor.js/issues/1447) - `Improvements` - The caret will be set on editor copy/paste [#1470](https://github.com/codex-team/editor.js/pull/1470) +- `Improvements` - Added generic types to OutputBlockData [#1551](https://github.com/codex-team/editor.js/issues/1551). - `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503). - `Fix` - Fix an unstable block cut process [#1489](https://github.com/codex-team/editor.js/issues/1489). - `Fix` - Type definition of the Sanitizer config: the sanitize function now contains param definition [#1491](https://github.com/codex-team/editor.js/pull/1491). diff --git a/types/data-formats/output-data.d.ts b/types/data-formats/output-data.d.ts index 101cdcc0f..1e2c0a644 100644 --- a/types/data-formats/output-data.d.ts +++ b/types/data-formats/output-data.d.ts @@ -2,16 +2,19 @@ import {BlockToolData} from '../tools'; /** * Output of one Tool + * + * @template Type - the string literal describing a tool type + * @template Data - the structure describing a data object supported by the tool */ -export interface OutputBlockData { +export interface OutputBlockData { /** - * Too type + * Tool type */ - type: string; + type: Type; /** * Saved Block data */ - data: BlockToolData; + data: BlockToolData; } export interface OutputData {