@types/hast
Advanced tools
Comparing version 2.3.3 to 2.3.4
@@ -14,2 +14,50 @@ // Type definitions for non-npm package Hast 2.3 | ||
/** | ||
* This map registers all node types that may be used as top-level content in the document. | ||
* | ||
* These types are accepted inside `root` nodes. | ||
* | ||
* This interface can be augmented to register custom node types. | ||
* | ||
* @example | ||
* declare module 'hast' { | ||
* interface RootContentMap { | ||
* // Allow using raw nodes defined by `rehype-raw`. | ||
* raw: Raw; | ||
* } | ||
* } | ||
*/ | ||
export interface RootContentMap { | ||
comment: Comment; | ||
doctype: DocType; | ||
element: Element; | ||
text: Text; | ||
} | ||
/** | ||
* This map registers all node types that may be used as content in an element. | ||
* | ||
* These types are accepted inside `element` nodes. | ||
* | ||
* This interface can be augmented to register custom node types. | ||
* | ||
* @example | ||
* declare module 'hast' { | ||
* interface RootContentMap { | ||
* custom: Custom; | ||
* } | ||
* } | ||
*/ | ||
export interface ElementContentMap { | ||
comment: Comment; | ||
element: Element; | ||
text: Text; | ||
} | ||
export type Content = RootContent | ElementContent; | ||
export type RootContent = RootContentMap[keyof RootContentMap]; | ||
export type ElementContent = ElementContentMap[keyof ElementContentMap]; | ||
/** | ||
* Node in hast containing other nodes. | ||
@@ -21,3 +69,3 @@ */ | ||
*/ | ||
children: Array<Element | DocType | Comment | Text>; | ||
children: Content[]; | ||
} | ||
@@ -42,2 +90,7 @@ | ||
type: 'root'; | ||
/** | ||
* List representing the children of a node. | ||
*/ | ||
children: RootContent[]; | ||
} | ||
@@ -72,3 +125,3 @@ | ||
*/ | ||
children: Array<Element | Comment | Text>; | ||
children: ElementContent[]; | ||
} | ||
@@ -75,0 +128,0 @@ |
{ | ||
"name": "@types/hast", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"description": "TypeScript definitions for Hast", | ||
@@ -35,4 +35,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast", | ||
}, | ||
"typesPublisherContentHash": "1c06a0c8d7c2a505a4a8632fd52c158c54e9af3e5bba881965c0008e2d0d2de1", | ||
"typesPublisherContentHash": "ea50bf034d071464d609c5729111263e27c0c1f7a5a853aeed7b8521b2160c81", | ||
"typeScriptVersion": "3.7" | ||
} |
@@ -9,118 +9,5 @@ # Installation | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast. | ||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast/index.d.ts) | ||
````ts | ||
// Type definitions for non-npm package Hast 2.3 | ||
// Project: https://github.com/syntax-tree/hast | ||
// Definitions by: lukeggchapman <https://github.com/lukeggchapman> | ||
// Junyoung Choi <https://github.com/rokt33r> | ||
// Christian Murphy <https://github.com/ChristianMurphy> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 3.0 | ||
import { Parent as UnistParent, Literal as UnistLiteral, Node as UnistNode } from 'unist'; | ||
export { UnistNode as Node }; | ||
/** | ||
* Node in hast containing other nodes. | ||
*/ | ||
export interface Parent extends UnistParent { | ||
/** | ||
* List representing the children of a node. | ||
*/ | ||
children: Array<Element | DocType | Comment | Text>; | ||
} | ||
/** | ||
* Nodes in hast containing a value. | ||
*/ | ||
export interface Literal extends UnistLiteral { | ||
value: string; | ||
} | ||
/** | ||
* Root represents a document. | ||
* Can be used as the rood of a tree, or as a value of the | ||
* content field on a 'template' Element, never as a child. | ||
*/ | ||
export interface Root extends Parent { | ||
/** | ||
* Represents this variant of a Node. | ||
*/ | ||
type: 'root'; | ||
} | ||
/** | ||
* Element represents an HTML Element. | ||
*/ | ||
export interface Element extends Parent { | ||
/** | ||
* Represents this variant of a Node. | ||
*/ | ||
type: 'element'; | ||
/** | ||
* Represents the element’s local name. | ||
*/ | ||
tagName: string; | ||
/** | ||
* Represents information associated with the element. | ||
*/ | ||
properties?: Properties | undefined; | ||
/** | ||
* If the tagName field is 'template', a content field can be present. | ||
*/ | ||
content?: Root | undefined; | ||
/** | ||
* List representing the children of a node. | ||
*/ | ||
children: Array<Element | Comment | Text>; | ||
} | ||
/** | ||
* Represents information associated with an element. | ||
*/ | ||
export interface Properties { | ||
[PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>; | ||
} | ||
/** | ||
* Represents an HTML DocumentType. | ||
*/ | ||
export interface DocType extends UnistNode { | ||
/** | ||
* Represents this variant of a Node. | ||
*/ | ||
type: 'doctype'; | ||
name: string; | ||
} | ||
/** | ||
* Represents an HTML Comment. | ||
*/ | ||
export interface Comment extends Literal { | ||
/** | ||
* Represents this variant of a Literal. | ||
*/ | ||
type: 'comment'; | ||
} | ||
/** | ||
* Represents an HTML Text. | ||
*/ | ||
export interface Text extends Literal { | ||
/** | ||
* Represents this variant of a Literal. | ||
*/ | ||
type: 'text'; | ||
} | ||
```` | ||
### Additional Details | ||
* Last updated: Sat, 21 Aug 2021 04:31:23 GMT | ||
* Last updated: Sun, 22 Aug 2021 06:31:24 GMT | ||
* Dependencies: [@types/unist](https://npmjs.com/package/@types/unist) | ||
@@ -127,0 +14,0 @@ * Global values: none |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141
6520
17