CoolFace
Apppublic

Umama-at-Bluchip/Quick-UI

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
README.md123 linesDownload Raw Back to unist
1# Installation
2> `npm install --save @types/unist`
3
4# Summary
5This package contains type definitions for unist (https://github.com/syntax-tree/unist).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2/index.d.ts)
10````ts
11/**12 * Syntactic units in unist syntax trees are called nodes.13 *14 * @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}.15 */16export interface Node<TData extends object = Data> {17    /**18     * The variant of a node.19     */20    type: string;21 22    /**23     * Information from the ecosystem.24     */25    data?: TData | undefined;26 27    /**28     * Location of a node in a source document.29     * Must not be present if a node is generated.30     */31    position?: Position | undefined;32}33 34/**35 * Information associated by the ecosystem with the node.36 * Space is guaranteed to never be specified by unist or specifications37 * implementing unist.38 */39export interface Data {40    [key: string]: unknown;41}42 43/**44 * Location of a node in a source file.45 */46export interface Position {47    /**48     * Place of the first character of the parsed source region.49     */50    start: Point;51 52    /**53     * Place of the first character after the parsed source region.54     */55    end: Point;56 57    /**58     * Start column at each index (plus start line) in the source region,59     * for elements that span multiple lines.60     */61    indent?: number[] | undefined;62}63 64/**65 * One place in a source file.66 */67export interface Point {68    /**69     * Line in a source file (1-indexed integer).70     */71    line: number;72 73    /**74     * Column in a source file (1-indexed integer).75     */76    column: number;77    /**78     * Character in a source file (0-indexed integer).79     */80    offset?: number | undefined;81}82 83/**84 * Util for extracting type of {@link Node.data}85 *86 * @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc.87 *88 * @example `NodeData<Node<{ key: string }>>` -> `{ key: string }`89 */90export type NodeData<TNode extends Node<object>> = TNode extends Node<infer TData> ? TData : never;91 92/**93 * Nodes containing other nodes.94 *95 * @typeParam ChildNode Node item of {@link Parent.children}96 */97export interface Parent<ChildNode extends Node<object> = Node, TData extends object = NodeData<ChildNode>>98    extends Node<TData>99{100    /**101     * List representing the children of a node.102     */103    children: ChildNode[];104}105 106/**107 * Nodes containing a value.108 *109 * @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node110 */111export interface Literal<Value = unknown, TData extends object = Data> extends Node<TData> {112    value: Value;113}114
115````
116
117### Additional Details
118 * Last updated: Tue, 07 Nov 2023 20:08:00 GMT
119 * Dependencies: none
120
121# Credits
122These 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).
123