From 014523b7f5b3d8d62ca779527c1446ec9a65cebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Wed, 10 Feb 2021 18:25:22 +0100 Subject: [PATCH] update typescript docs --- docs/src/docPages/guide/typescript.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/src/docPages/guide/typescript.md b/docs/src/docPages/guide/typescript.md index aa032334..79f9b3a1 100644 --- a/docs/src/docPages/guide/typescript.md +++ b/docs/src/docPages/guide/typescript.md @@ -23,8 +23,8 @@ export interface CustomExtensionOptions { awesomeness: number, } -const CustomExtension = Extension.create({ - defaultOptions: { +const CustomExtension = Extension.create({ + defaultOptions: { awesomeness: 100, }, }) @@ -36,13 +36,19 @@ The core package also exports a `Command` type, which needs to be added to all c ```ts import { Command, Extension } from '@tiptap/core' +declare module '@tiptap/core' { + interface Commands { + /** + * Comments will be added to the autocomplete. + */ + yourCommand: (someProp: any) => Command, + } +} + const CustomExtension = Extension.create({ addCommands() { return { - /** - * Comments will be added to the autocomplete. - */ - yourCommand: (): Command => ({ commands }) => { + yourCommand: someProp => ({ commands }) => { // … }, }