@types/unist

  • Version 3.0.2
  • Published
  • 6.28 kB
  • No dependencies
  • MIT license

Install

npm i @types/unist
yarn add @types/unist
pnpm add @types/unist

Overview

TypeScript definitions for unist

Index

Interfaces

interface Data

interface Data {}
  • Info associated with nodes by the ecosystem.

    This space is guaranteed to never be specified by unist or specifications implementing unist. But you can use it in utilities and plugins to store data.

    This type can be augmented to register custom data. For example:

    declare module 'unist' {
    interface Data {
    // `someNode.data.myId` is typed as `number | undefined`
    myId?: number | undefined
    }
    }

interface Literal

interface Literal extends Node {}
  • Abstract unist node that contains the smallest possible value.

    This interface is supposed to be extended.

    For example, in HTML, a text node is a leaf that contains text.

property value

value: unknown;
  • Plain value.

interface Node

interface Node {}
  • Abstract unist node.

    The syntactic unit in unist syntax trees are called nodes.

    This interface is supposed to be extended. If you can use Literal or Parent, you should. But for example in markdown, a thematicBreak (***), is neither literal nor parent, but still a node.

property data

data?: Data | undefined;
  • Info from the ecosystem.

property position

position?: Position | undefined;
  • Position of a node in a source document.

    Nodes that are generated (not in the original source document) must not have a position.

property type

type: string;
  • Node type.

interface Parent

interface Parent extends Node {}
  • Abstract unist node that contains other nodes (*children*).

    This interface is supposed to be extended.

    For example, in XML, an element is a parent of different things, such as comments, text, and further elements.

property children

children: Node[];
  • List of children.

interface Point

interface Point {}
  • One place in a source file.

property column

column: number;
  • Column in a source file (1-indexed integer).

property line

line: number;
  • Line in a source file (1-indexed integer).

property offset

offset?: number | undefined;
  • Character in a source file (0-indexed integer).

interface Position

interface Position {}
  • Position of a node in a source document.

    A position is a range between two points.

property end

end: Point;
  • Place of the first character after the parsed source region.

property start

start: Point;
  • Place of the first character of the parsed source region.

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (0)

No dev dependencies.

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/unist.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/unist)
  • HTML
    <a href="https://www.jsdocs.io/package/@types/unist"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>