@types/unist
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -1,13 +0,1 @@ | ||
// Type definitions for non-npm package Unist 2.0 | ||
// Project: https://github.com/syntax-tree/unist | ||
// Definitions by: bizen241 <https://github.com/bizen241> | ||
// Jun Lu <https://github.com/lujun2> | ||
// Hernan Rajchert <https://github.com/hrajchert> | ||
// Titus Wormer <https://github.com/wooorm> | ||
// Junyoung Choi <https://github.com/rokt33r> | ||
// Ben Moon <https://github.com/GuiltyDolphin> | ||
// JounQin <https://github.com/JounQin> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 3.0 | ||
/** | ||
@@ -14,0 +2,0 @@ * Syntactic units in unist syntax trees are called nodes. |
{ | ||
"name": "@types/unist", | ||
"version": "2.0.8", | ||
"description": "TypeScript definitions for Unist", | ||
"version": "2.0.9", | ||
"description": "TypeScript definitions for unist", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist", | ||
@@ -10,34 +10,34 @@ "license": "MIT", | ||
"name": "bizen241", | ||
"url": "https://github.com/bizen241", | ||
"githubUsername": "bizen241" | ||
"githubUsername": "bizen241", | ||
"url": "https://github.com/bizen241" | ||
}, | ||
{ | ||
"name": "Jun Lu", | ||
"url": "https://github.com/lujun2", | ||
"githubUsername": "lujun2" | ||
"githubUsername": "lujun2", | ||
"url": "https://github.com/lujun2" | ||
}, | ||
{ | ||
"name": "Hernan Rajchert", | ||
"url": "https://github.com/hrajchert", | ||
"githubUsername": "hrajchert" | ||
"githubUsername": "hrajchert", | ||
"url": "https://github.com/hrajchert" | ||
}, | ||
{ | ||
"name": "Titus Wormer", | ||
"url": "https://github.com/wooorm", | ||
"githubUsername": "wooorm" | ||
"githubUsername": "wooorm", | ||
"url": "https://github.com/wooorm" | ||
}, | ||
{ | ||
"name": "Junyoung Choi", | ||
"url": "https://github.com/rokt33r", | ||
"githubUsername": "rokt33r" | ||
"githubUsername": "rokt33r", | ||
"url": "https://github.com/rokt33r" | ||
}, | ||
{ | ||
"name": "Ben Moon", | ||
"url": "https://github.com/GuiltyDolphin", | ||
"githubUsername": "GuiltyDolphin" | ||
"githubUsername": "GuiltyDolphin", | ||
"url": "https://github.com/GuiltyDolphin" | ||
}, | ||
{ | ||
"name": "JounQin", | ||
"url": "https://github.com/JounQin", | ||
"githubUsername": "JounQin" | ||
"githubUsername": "JounQin", | ||
"url": "https://github.com/JounQin" | ||
} | ||
@@ -54,4 +54,5 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "6f0fbad7f7e548fa74313e425571a019550cf848fd074a2395066325b9ecb9a9", | ||
"typeScriptVersion": "4.3" | ||
"typesPublisherContentHash": "bba7aef6ce06ea8d0fda589e0679b537ed7a3c614a5009dfc858d69a2fe9439f", | ||
"typeScriptVersion": "4.5", | ||
"nonNpm": true | ||
} |
@@ -5,13 +5,119 @@ # Installation | ||
# Summary | ||
This package contains type definitions for Unist (https://github.com/syntax-tree/unist). | ||
This package contains type definitions for unist (https://github.com/syntax-tree/unist). | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2. | ||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2/index.d.ts) | ||
````ts | ||
/** | ||
* Syntactic units in unist syntax trees are called nodes. | ||
* | ||
* @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}. | ||
*/ | ||
export interface Node<TData extends object = Data> { | ||
/** | ||
* The variant of a node. | ||
*/ | ||
type: string; | ||
/** | ||
* Information from the ecosystem. | ||
*/ | ||
data?: TData | undefined; | ||
/** | ||
* Location of a node in a source document. | ||
* Must not be present if a node is generated. | ||
*/ | ||
position?: Position | undefined; | ||
} | ||
/** | ||
* Information associated by the ecosystem with the node. | ||
* Space is guaranteed to never be specified by unist or specifications | ||
* implementing unist. | ||
*/ | ||
export interface Data { | ||
[key: string]: unknown; | ||
} | ||
/** | ||
* Location of a node in a source file. | ||
*/ | ||
export interface Position { | ||
/** | ||
* Place of the first character of the parsed source region. | ||
*/ | ||
start: Point; | ||
/** | ||
* Place of the first character after the parsed source region. | ||
*/ | ||
end: Point; | ||
/** | ||
* Start column at each index (plus start line) in the source region, | ||
* for elements that span multiple lines. | ||
*/ | ||
indent?: number[] | undefined; | ||
} | ||
/** | ||
* One place in a source file. | ||
*/ | ||
export interface Point { | ||
/** | ||
* Line in a source file (1-indexed integer). | ||
*/ | ||
line: number; | ||
/** | ||
* Column in a source file (1-indexed integer). | ||
*/ | ||
column: number; | ||
/** | ||
* Character in a source file (0-indexed integer). | ||
*/ | ||
offset?: number | undefined; | ||
} | ||
/** | ||
* Util for extracting type of {@link Node.data} | ||
* | ||
* @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc. | ||
* | ||
* @example `NodeData<Node<{ key: string }>>` -> `{ key: string }` | ||
*/ | ||
export type NodeData<TNode extends Node<object>> = TNode extends Node<infer TData> ? TData : never; | ||
/** | ||
* Nodes containing other nodes. | ||
* | ||
* @typeParam ChildNode Node item of {@link Parent.children} | ||
*/ | ||
export interface Parent<ChildNode extends Node<object> = Node, TData extends object = NodeData<ChildNode>> | ||
extends Node<TData> | ||
{ | ||
/** | ||
* List representing the children of a node. | ||
*/ | ||
children: ChildNode[]; | ||
} | ||
/** | ||
* Nodes containing a value. | ||
* | ||
* @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node | ||
*/ | ||
export interface Literal<Value = unknown, TData extends object = Data> extends Node<TData> { | ||
value: Value; | ||
} | ||
```` | ||
### Additional Details | ||
* Last updated: Wed, 30 Aug 2023 19:35:32 GMT | ||
* Last updated: Wed, 18 Oct 2023 11:45:07 GMT | ||
* Dependencies: none | ||
* Global values: none | ||
# Credits | ||
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), and [JounQin](https://github.com/JounQin). |
8562
123
92