From 92de0a42a3f095bdb5843fa26dbc590b2372bd82 Mon Sep 17 00:00:00 2001 From: Sebastian Greaves Date: Fri, 26 Oct 2018 11:35:33 +0100 Subject: [PATCH 1/2] Correct type definition for KeyUtils - KeyUtils is a namespace, not an interface --- types/slate/index.d.ts | 10 +++++----- types/slate/slate-tests.ts | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) 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..7992fc0630 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(); From 6fc4ac0a8dd8624e874a5945139337f662a7af63 Mon Sep 17 00:00:00 2001 From: Sebastian Greaves Date: Fri, 26 Oct 2018 11:54:28 +0100 Subject: [PATCH 2/2] Correct string quote type --- types/slate/slate-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/slate/slate-tests.ts b/types/slate/slate-tests.ts index 7992fc0630..7eb81633bf 100644 --- a/types/slate/slate-tests.ts +++ b/types/slate/slate-tests.ts @@ -59,6 +59,6 @@ editor.query("testQuery"); editor.run("testCommand"); editor.event("mouseDown", new Event("mouseDown")); -KeyUtils.setGenerator(() => 'Test'); +KeyUtils.setGenerator(() => "Test"); KeyUtils.create(); KeyUtils.resetGenerator();