From f8aff22606d097584fbcf224eeed1321625bf05e Mon Sep 17 00:00:00 2001 From: Christian Murphy Date: Wed, 25 Sep 2019 14:09:16 -0700 Subject: [PATCH] unist-util-is now has native typings (#38577) --- notNeededPackages.json | 6 ++++ types/unist-util-is/index.d.ts | 36 ---------------------- types/unist-util-is/tsconfig.json | 23 -------------- types/unist-util-is/tslint.json | 1 - types/unist-util-is/unist-util-is-tests.ts | 26 ---------------- 5 files changed, 6 insertions(+), 86 deletions(-) delete mode 100644 types/unist-util-is/index.d.ts delete mode 100644 types/unist-util-is/tsconfig.json delete mode 100644 types/unist-util-is/tslint.json delete mode 100644 types/unist-util-is/unist-util-is-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 654512b442..eae50bd715 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -3738,6 +3738,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/unique-string", "asOfVersion": "2.0.0" }, + { + "libraryName": "unist-util-is", + "typingsPackageName": "unist-util-is", + "sourceRepoURL": "https://github.com/syntax-tree/unist-util-is", + "asOfVersion": "4.0.0" + }, { "libraryName": "Universal Router", "typingsPackageName": "universal-router", diff --git a/types/unist-util-is/index.d.ts b/types/unist-util-is/index.d.ts deleted file mode 100644 index 82e6e1fdc8..0000000000 --- a/types/unist-util-is/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Type definitions for unist-util-is 2.1 -// Project: https://github.com/syntax-tree/unist-util-is#readme -// Definitions by: Junyoung Choi -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 - -/// - -import * as Unist from 'unist'; - -declare namespace unistUtilIs { - /** - * @param node Node to test - * @param index Position of node in parent - * @param parent Parent of node - */ - type TestFunction = (node: unknown, index?: number, parent?: Unist.Parent) => boolean | void; - type Test = TestFunction | Partial | string | null; -} - -/** - * Unist utility to check if a node passes a test. - * - * @param test When not given, checks if `node` is a `Node`. - * When `string`, works like passing `function (node) {return node.type === test}`. - * When `array`, checks any one of the subtests pass. - * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values - * @param node Node to check. `false` is returned - * @param index Position of `node` in `parent` - * @param parent Parent of `node` - * @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 | unistUtilIs.Test[], node: unknown, index?: number, parent?: Unist.Parent, context?: any): boolean; - -export = unistUtilIs; diff --git a/types/unist-util-is/tsconfig.json b/types/unist-util-is/tsconfig.json deleted file mode 100644 index dbe499fef0..0000000000 --- a/types/unist-util-is/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "unist-util-is-tests.ts" - ] -} diff --git a/types/unist-util-is/tslint.json b/types/unist-util-is/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/unist-util-is/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/unist-util-is/unist-util-is-tests.ts b/types/unist-util-is/unist-util-is-tests.ts deleted file mode 100644 index 9f3eecc680..0000000000 --- a/types/unist-util-is/unist-util-is-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -import is = require('unist-util-is'); - -const node = {type: 'strong'}; -const parent = {type: 'paragraph', children: [node]}; - -function test(node: unknown, n?: number) { - return n === 5; -} - -is(null, {children: []}); -is(null, node); -is('strong', node); -is('emphasis', node); - -is(node, node); -is({type: 'paragraph'}, parent); -is({type: 'strong'}, parent); - -is(test, node); -is(test, node, 4, parent); -is(test, node, 5, parent); - -function testFunc(node: unknown) {} -is(testFunc, node); - -const wrongTestFunc: is.TestFunction = (node: unknown, n: string) => {}; // $ExpectError