From fc8b7956f937b0bc0dfa97d27a71bd0040b0dfc6 Mon Sep 17 00:00:00 2001 From: "Lu, Jun" <34977084+lujun2@users.noreply.github.com> Date: Mon, 19 Nov 2018 02:57:31 +0800 Subject: [PATCH] @types/unist: update to v2.0.0 (#30522) * update unist typing to v2.0.0 * remove v1, use npm version instead --- types/unist/index.d.ts | 9 +++++---- types/unist/tsconfig.json | 15 ++++----------- types/unist/unist-tests.ts | 21 ++++++++------------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/types/unist/index.d.ts b/types/unist/index.d.ts index 5eed577657..7433ddcc13 100644 --- a/types/unist/index.d.ts +++ b/types/unist/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for Unist 1.0 +// Type definitions for Unist 2.0 // Project: https://github.com/syntax-tree/unist // Definitions by: bizen241 +// Jun Lu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -11,7 +12,7 @@ export interface Node { } export interface Data { - [key: string]: string | number | object | any[] | boolean | null; + [key: string]: any; } export interface Position { @@ -34,6 +35,6 @@ export interface Parent extends Node { children: Node[]; } -export interface Text extends Node { - value: string; +export interface Literal extends Node { + value: any; } diff --git a/types/unist/tsconfig.json b/types/unist/tsconfig.json index c9f03c2264..116f944fda 100644 --- a/types/unist/tsconfig.json +++ b/types/unist/tsconfig.json @@ -1,23 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "unist-tests.ts" - ] -} \ No newline at end of file + "files": ["index.d.ts", "unist-tests.ts"] +} diff --git a/types/unist/unist-tests.ts b/types/unist/unist-tests.ts index b49f1002f9..3cb69bcc76 100644 --- a/types/unist/unist-tests.ts +++ b/types/unist/unist-tests.ts @@ -4,46 +4,41 @@ const data: Unist.Data = { string: 'string', number: 1, object: { - key: 'value', + key: 'value' }, array: [], boolean: true, - null: null, + null: null }; const point: Unist.Point = { line: 1, column: 1, - offset: 0, + offset: 0 }; const position: Unist.Position = { start: point, end: point, - indent: [ - 1, - ], + indent: [1] }; const node: Unist.Node = { type: 'node', data, - position, + position }; -const text: Unist.Text = { +const text: Unist.Literal = { type: 'text', data, position, - value: 'value', + value: 'value' }; const parent: Unist.Parent = { type: 'parent', data, position, - children: [ - node, - text, - ], + children: [node, text] };