diff --git a/packages/core/src/test.ts b/packages/core/src/test.ts index b4c47e308..4ec2445ff 100644 --- a/packages/core/src/test.ts +++ b/packages/core/src/test.ts @@ -834,26 +834,27 @@ class ExtensionTest { } public create() { - - const self = this - - // type ParentOptions = NoInfer type ParentOptions = Options - - return function(options?: Partial>): ExtensionTest { - return cloneDeep(self as unknown as ExtensionTest, true) - .options(options as Options) + + return (options?: Partial>) => { + return cloneDeep(this, true).options(options as Options) } } } interface NodeExtends extends ExtensionExtends { + topNode: boolean schema: (params: ExtensionCallback) => NodeSpec } class NodeTest extends ExtensionTest { type = 'node' + public topNode(value: NodeExtends['topNode'] = true) { + this.storeConfig('topNode', value, 'overwrite') + return this + } + public schema(value: NodeExtends['schema']) { this.storeConfig('schema', value, 'overwrite') return this @@ -883,7 +884,11 @@ const Suggestion = new NodeTest() })) .create() -console.log(Suggestion().options({ trigger: 'jo' })) +// const Blub = new ExtensionTest() +// .name('blub') +// .create() + +console.log(Suggestion(), Suggestion().topNode().options({ trigger: 'jo' })) // interface MentionOptions { // trigger: string