diff --git a/docs/guide/typescript.md b/docs/guide/typescript.md index 8cc77401..12ad76bc 100644 --- a/docs/guide/typescript.md +++ b/docs/guide/typescript.md @@ -45,6 +45,8 @@ export interface CustomExtensionStorage { } const CustomExtension = Extension.create<{}, CustomExtensionStorage>({ + name: 'customExtension', + addStorage() { return { awesomeness: 100, @@ -53,6 +55,14 @@ const CustomExtension = Extension.create<{}, CustomExtensionStorage>({ }) ``` +When using storage outside of the extension you have to manually set the type. + +``` +import { CustomExtensionStorage } from './custom-extension + +const customStorage = editor.storage.customExtension as CustomExtensionStorage +``` + ### Command type The core package also exports a `Command` type, which needs to be added to all commands that you specify in your code. Here is an example: