chore: update definitions

Update definitions to match those defined by the library author
This commit is contained in:
Hernan Rajchert
2018-11-29 18:54:27 -03:00
parent c11fada964
commit 03ae76d4ec
2 changed files with 31 additions and 10 deletions
+31 -8
View File
@@ -1,40 +1,63 @@
// Type definitions for Unist 2.0
// Project: https://github.com/syntax-tree/unist
// Project: https://github.com/syntax-tree/unist-ts
// 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>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// TypeScript Version: 3.1
export as namespace Unist
// Syntactic units in unist syntax trees are called nodes.
export interface Node {
// The variant of a node.
type: string;
// Information from the ecosystem.
data?: Data;
// Location of a node in a source document.
// Must not be present if a node is generated.
position?: Position;
}
export interface Data {
[key: string]: any;
[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;
/** >= 1 */
indent?: number[];
// Start column at each index (plus start line) in the source region,
// for elements that span multiple lines.
indent: number[];
}
// One place in a source file.
export interface Point {
/** >= 1 */
// Line in a source file (1-indexed integer).
line: number;
/** >= 1 */
// Column in a source file (1-indexed integer).
column: number;
/** >= 0 */
// Character in a source file (0-indexed integer).
offset?: number;
}
// Nodes containing other nodes.
export interface Parent extends Node {
// List representing the children of a node.
children: Node[];
}
// Nodes containing a value.
export interface Literal extends Node {
value: any;
}
-2
View File
@@ -1,5 +1,3 @@
import * as Unist from 'unist';
const data: Unist.Data = {
string: 'string',
number: 1,