vfile-message
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -7,3 +7,3 @@ export class VFileMessage extends Error { | ||
* @param {string|Error} reason Reason for message (`string` or `Error`). Uses the stack and message of the error if given. | ||
* @param {NodeLike|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). | ||
* @param {Node|NodeLike|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). | ||
* @param {string} [origin] Place in code the message originates from (`string`, optional). | ||
@@ -14,5 +14,6 @@ */ | ||
place?: | ||
| import('unist').Node<import('unist').Data> | ||
| import('unist').Position | ||
| import('unist').Point | ||
| NodeLike | ||
| import('unist').Point | ||
| undefined, | ||
@@ -86,7 +87,8 @@ origin?: string | undefined | ||
} | ||
export type NodeLike = Record<string, unknown> & { | ||
export type Node = import('unist').Node | ||
export type Position = import('unist').Position | ||
export type Point = import('unist').Point | ||
export type NodeLike = object & { | ||
type: string | ||
position?: Position | undefined | ||
} | ||
export type Position = import('unist').Position | ||
export type Point = import('unist').Point |
/** | ||
* @typedef {Record<string, unknown> & {type: string, position?: Position|undefined}} NodeLike | ||
* @typedef {import('unist').Node} Node | ||
* @typedef {import('unist').Position} Position | ||
* @typedef {import('unist').Point} Point | ||
* @typedef {object & {type: string, position?: Position|undefined}} NodeLike | ||
*/ | ||
@@ -15,3 +16,3 @@ | ||
* @param {string|Error} reason Reason for message (`string` or `Error`). Uses the stack and message of the error if given. | ||
* @param {NodeLike|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). | ||
* @param {Node|NodeLike|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). | ||
* @param {string} [origin] Place in code the message originates from (`string`, optional). | ||
@@ -57,3 +58,2 @@ */ | ||
else if ('start' in place || 'end' in place) { | ||
// @ts-ignore Looks like a position. | ||
position = place | ||
@@ -63,3 +63,2 @@ } | ||
else if ('line' in place || 'column' in place) { | ||
// @ts-ignore Looks like a point. | ||
position.start = place | ||
@@ -66,0 +65,0 @@ } |
{ | ||
"name": "vfile-message", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "vfile utility to create a virtual message", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
15458
233