update typescript docs

This commit is contained in:
Philipp Kühn
2021-02-10 18:25:22 +01:00
parent 215c26748b
commit 014523b7f5

View File

@@ -23,8 +23,8 @@ export interface CustomExtensionOptions {
awesomeness: number,
}
const CustomExtension = Extension.create({
defaultOptions: <CustomExtensionOptions>{
const CustomExtension = Extension.create<CustomExtensionOptions>({
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'
const CustomExtension = Extension.create({
addCommands() {
return {
declare module '@tiptap/core' {
interface Commands {
/**
* Comments will be added to the autocomplete.
*/
yourCommand: (): Command => ({ commands }) => {
yourCommand: (someProp: any) => Command,
}
}
const CustomExtension = Extension.create({
addCommands() {
return {
yourCommand: someProp => ({ commands }) => {
// …
},
}