chore(types): a generic type for tool config added (#1517)

* Add a generic type to ToolSettings

* Update tool-settings.d.ts

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
This commit is contained in:
Tomoyuki Hata 2021-02-18 22:25:12 +09:00 committed by GitHub
parent 78478ace2b
commit 4ddba9208d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -2,6 +2,7 @@
### 2.19.2
- `Improvements` - A generic type for Tool config added [#1516](https://github.com/codex-team/editor.js/issues/1516)
- `Improvements` - Remove unused `force` option in `Caret.navigateNext()` and `Caret.navigatePrevious()` [#857](https://github.com/codex-team/editor.js/issues/857#issuecomment-770363438).
- `Improvements` - Remove bundles from the repo [#1541](https://github.com/codex-team/editor.js/pull/1541).
- `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503).

View file

@ -18,8 +18,10 @@ export interface ToolboxConfig {
/**
* Object passed to the Tool's constructor by {@link EditorConfig#tools}
*
* @template Config - the structure describing a config object supported by the tool
*/
export interface ToolSettings {
export interface ToolSettings <Config extends object = any> {
/**
* Tool's class
@ -29,7 +31,7 @@ export interface ToolSettings {
/**
* User configuration object that will be passed to the Tool's constructor
*/
config?: ToolConfig;
config?: ToolConfig<Config>;
/**
* Is need to show Inline Toolbar.