diff --git a/src/index.ts b/src/index.ts index 00e79302a..2bdce99af 100644 --- a/src/index.ts +++ b/src/index.ts @@ -43,7 +43,7 @@ function addMethod>( name: string, fn: (this: T, ...args: any[]) => T, ): void; -function addMethod ISchema>( +function addMethod ISchema>( schemaType: T, name: string, fn: (this: InstanceType, ...args: any[]) => InstanceType, diff --git a/test/types/types.ts b/test/types/types.ts index 8a27b49a5..30960acec 100644 --- a/test/types/types.ts +++ b/test/types/types.ts @@ -10,6 +10,7 @@ import { bool, reach, addMethod, + Schema, } from '../../src'; import { create as tuple } from '../../src/tuple'; import { create as lazy } from '../../src/Lazy'; @@ -1079,6 +1080,10 @@ reach: { } addMethod: { + addMethod(Schema, 'foo', function () { + return this.clone(); + }); + addMethod(string, 'foo', function () { return this.clone(); });