From 4ce866432cd9e66cfb952b1a92eb1e83a417130d Mon Sep 17 00:00:00 2001 From: Lexus Drumgold Date: Tue, 12 Mar 2024 17:26:48 -0400 Subject: [PATCH] feat: `PositionalInfo` Signed-off-by: Lexus Drumgold --- src/__tests__/positional-info.spec-d.ts | 17 +++++++++++++++++ src/index.ts | 1 + src/positional-info.ts | 20 ++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/__tests__/positional-info.spec-d.ts create mode 100644 src/positional-info.ts diff --git a/src/__tests__/positional-info.spec-d.ts b/src/__tests__/positional-info.spec-d.ts new file mode 100644 index 00000000..ed46df12 --- /dev/null +++ b/src/__tests__/positional-info.spec-d.ts @@ -0,0 +1,17 @@ +/** + * @file Type Tests - PositionalInfo + * @module unist-util-types/tests/unit-d/PositionalInfo + */ + +import type * as mdast from 'mdast' +import type TestSubject from '../positional-info' + +describe('unit-d:PositionalInfo', () => { + it('should equal Pick', () => { + // Arrange + type T = mdast.Code + + // Expect + expectTypeOf>().toEqualTypeOf>() + }) +}) diff --git a/src/index.ts b/src/index.ts index 7efc6c15..a7ba5feb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,4 +6,5 @@ export type { default as Decrement } from './decrement' export type { default as InclusiveDescendant } from './descendant-inclusive' export type { default as Increment } from './increment' +export type { default as PositionalInfo } from './positional-info' export type { default as Uint } from './uint' diff --git a/src/positional-info.ts b/src/positional-info.ts new file mode 100644 index 00000000..f931827f --- /dev/null +++ b/src/positional-info.ts @@ -0,0 +1,20 @@ +/** + * @file PositionalInfo + * @module unist-util-types/PositionalInfo + */ + +import type { Node } from 'unist' + +/** + * Object containing the [*positional information*][1] of [node][2] `T`. + * + * [1]: https://github.com/syntax-tree/unist#positional-information + * [2]: https://github.com/syntax-tree/unist#node + * + * @see {@linkcode Node} + * + * @template {Node} [T=Node] - Node to get positional information from + */ +type PositionalInfo = Pick + +export type { PositionalInfo as default }