update typescript docs
This commit is contained in:
@@ -23,8 +23,8 @@ export interface CustomExtensionOptions {
|
|||||||
awesomeness: number,
|
awesomeness: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
const CustomExtension = Extension.create({
|
const CustomExtension = Extension.create<CustomExtensionOptions>({
|
||||||
defaultOptions: <CustomExtensionOptions>{
|
defaultOptions: {
|
||||||
awesomeness: 100,
|
awesomeness: 100,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -36,13 +36,19 @@ The core package also exports a `Command` type, which needs to be added to all c
|
|||||||
```ts
|
```ts
|
||||||
import { Command, Extension } from '@tiptap/core'
|
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({
|
const CustomExtension = Extension.create({
|
||||||
addCommands() {
|
addCommands() {
|
||||||
return {
|
return {
|
||||||
/**
|
yourCommand: someProp => ({ commands }) => {
|
||||||
* Comments will be added to the autocomplete.
|
|
||||||
*/
|
|
||||||
yourCommand: (): Command => ({ commands }) => {
|
|
||||||
// …
|
// …
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user