editor.js/types/data-formats/output-data.d.ts
Tomoyuki Hata 3bf30f0c1e
Add generics to OutputBlockData (#1326)
* Add generics to OutputBlockData

* Fix typo

* Update CHANGELOG.md

* Add @template description

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
2021-02-28 00:33:06 +03:00

36 lines
633 B
TypeScript

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<Type extends string = string, Data extends object = any> {
/**
* Tool type
*/
type: Type;
/**
* Saved Block data
*/
data: BlockToolData<Data>;
}
export interface OutputData {
/**
* Editor's version
*/
version?: string;
/**
* Timestamp of saving in milliseconds
*/
time?: number;
/**
* Saved Blocks
*/
blocks: OutputBlockData[];
}