From d3ba03f75649289aaa7562d452a8ebdf5ea292e0 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Tue, 11 Dec 2018 13:48:40 +0900 Subject: [PATCH] Discard context type checking --- types/unist-util-is/index.d.ts | 6 +++--- types/unist-util-is/unist-util-is-tests.ts | 12 ++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/types/unist-util-is/index.d.ts b/types/unist-util-is/index.d.ts index ae92217c6e..82e6e1fdc8 100644 --- a/types/unist-util-is/index.d.ts +++ b/types/unist-util-is/index.d.ts @@ -14,8 +14,8 @@ declare namespace unistUtilIs { * @param index Position of node in parent * @param parent Parent of node */ - type TestFunction = (this: C, node: unknown, index?: number, parent?: Unist.Parent) => boolean | void; - type Test = TestFunction | Partial | string | null; + type TestFunction = (node: unknown, index?: number, parent?: Unist.Parent) => boolean | void; + type Test = TestFunction | Partial | string | null; } /** @@ -31,6 +31,6 @@ declare namespace unistUtilIs { * @param context Context object to invoke `test` with * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). */ -declare function unistUtilIs(test: unistUtilIs.Test | Array>, node: unknown, index?: number, parent?: Unist.Parent, context?: any): boolean; +declare function unistUtilIs(test: unistUtilIs.Test | unistUtilIs.Test[], node: unknown, index?: number, parent?: Unist.Parent, context?: any): boolean; export = unistUtilIs; diff --git a/types/unist-util-is/unist-util-is-tests.ts b/types/unist-util-is/unist-util-is-tests.ts index 4d355c90ec..9f3eecc680 100644 --- a/types/unist-util-is/unist-util-is-tests.ts +++ b/types/unist-util-is/unist-util-is-tests.ts @@ -20,15 +20,7 @@ is(test, node); is(test, node, 4, parent); is(test, node, 5, parent); -interface TestContext { - some: string; -} -function testWithContext(this: TestContext, node: unknown) {} -is(testWithContext, node); +function testFunc(node: unknown) {} +is(testFunc, node); const wrongTestFunc: is.TestFunction = (node: unknown, n: string) => {}; // $ExpectError - -interface OtherTestContext { - some: number; -} -is(testWithContext, node); // $ExpectError