Alexandro.Net

Version 1.0.0

@stackline/types-unist

TypeScript definitions for unist

Independent maintenance of @types/unist 2.0.11. Original authors and licenses are retained.

Installation

# Preserve existing imports with an npm alias
npm install @types/unist@npm:@stackline/types-unist@1.0.0
# Or use the scoped package name in your imports
npm install @stackline/types-unist@1.0.0

Node.js: See compatibility notes. Read the compatibility and maintenance notes before migrating.

Usage and API

The reference below may retain upstream package names. Use the alias installation above to run those imports with this Stackline release.

@stackline/types-unist

Maintained TypeScript declaration fork of @types/unist@2.0.11. This package supplies declarations, not JavaScript runtime code. The original declarations, contributors and MIT license are retained; focused changes are listed in CHANGELOG.md.

npm install --save-dev @stackline/types-unist@1.0.0
# Keep existing type imports and automatic @types discovery:
npm install --save-dev @types/unist@npm:@stackline/types-unist@1.0.0

For direct installation, use @stackline/types-unist in type imports, or in compilerOptions.types for Jest globals. Aliasing to @types/unist preserves the upstream module names. Requires TypeScript 4.8 or newer, subject to the dependencies selected by your lockfile. No library runtime engine requirement is introduced. Development tooling uses Node.js24.

Source and issue review · Issues · npm · Stackline

Original package documentation

Installation

npm install --save @types/unist

Summary

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

/**
 * 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

Credits

These definitions were written by bizen241, Jun Lu, Hernan Rajchert, Titus Wormer, Junyoung Choi, Ben Moon, and JounQin.

Upstream issues and maintenance review

Upstream and review

Issue review

GitHub search on 2026-09-29 used repo:DefinitelyTyped/DefinitelyTyped is:issue is:open "unist" and the corresponding closed query. Counts: open: 0 results (collected 0), closed: 2 results (collected 2). Search results can contain unrelated packages; they are not evidence that every result is a defect here. Archived search responses and baseline comparisons are retained in the release research evidence. No issue was posted or modified.

Closed #31470 concerns TypeScript2 versus unknown in early unist2 releases. This selected version explicitly requires TypeScript4.8; the minimum-compiler test verifies that existing contract. #71375 is registry availability, not declaration behavior.

Validation

Real declaration usage and negative type assertions are compiled with TypeScript 4.8.4 and 5.9.3, with strict: true and skipLibCheck: false, from source and isolated direct/alias tarball installs. CI also checks the complete dependency audit, CodeQL, package contents and exact CI archive identity before GitHub-only publication. Registry verification compiles direct and aliased installs rather than importing these type-only packages as JavaScript.

Release changes

Changelog

1.0.0

Release files and references

Package bytes, npm provenance and the immutable GitHub release were verified for this version. Security checks describe the reviewed release; documented compatibility risks and upstream reports are not blanket claims of resolution.