diff --git a/types/slate/index.d.ts b/types/slate/index.d.ts index 7c9a41efa8..8f80ba4615 100644 --- a/types/slate/index.d.ts +++ b/types/slate/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for slate 0.42 +// Type definitions for slate 0.43 // Project: https://github.com/ianstormtaylor/slate // Definitions by: Andy Kent // Jamie Talbot @@ -1478,10 +1478,10 @@ export class SlateError extends Error { [key: string]: any; } -export interface KeyUtils { - create(key: string): string; - setGenerator(func: () => any): void; - resetGenerator(): void; +export namespace KeyUtils { + function create(key?: string): string; + function setGenerator(func: () => any): void; + function resetGenerator(): void; } export type useMemoization = () => void; diff --git a/types/slate/slate-tests.ts b/types/slate/slate-tests.ts index 8e843e2d3d..7eb81633bf 100644 --- a/types/slate/slate-tests.ts +++ b/types/slate/slate-tests.ts @@ -1,4 +1,4 @@ -import { Value, Data, BlockJSON, Document, Editor, Change } from "slate"; +import { Value, Data, BlockJSON, Document, Editor, Change, KeyUtils } from "slate"; const data = Data.create({ foo: "bar " }); const value = Value.create({ data }); @@ -58,3 +58,7 @@ editor.command("testCommand"); editor.query("testQuery"); editor.run("testCommand"); editor.event("mouseDown", new Event("mouseDown")); + +KeyUtils.setGenerator(() => "Test"); +KeyUtils.create(); +KeyUtils.resetGenerator();