Skip to content

Commit

Permalink
feat(types): DocastNode
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Feb 9, 2024
1 parent b7ce43a commit 0e244ce
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export type * from './content'
export type * from './interfaces'
export type * from './mixins'
export type * from './nodes'
export type * from './types'
35 changes: 35 additions & 0 deletions src/types/__tests__/docast-node.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @file Type Tests - DocastNode
* @module docast/types/tests/unit-d/DocastNode
*/

import type {
BlockTag,
Comment,
Description,
InlineTag,
TypeExpression
} from '#src/nodes'
import type TestSubject from '../docast-node'

describe('unit-d:types/DocastNode', () => {
it('should extract BlockTag', () => {
expectTypeOf<TestSubject>().extract<BlockTag>().not.toBeNever()
})

it('should extract Comment', () => {
expectTypeOf<TestSubject>().extract<Comment>().not.toBeNever()
})

it('should extract Description', () => {
expectTypeOf<TestSubject>().extract<Description>().not.toBeNever()
})

it('should extract InlineTag', () => {
expectTypeOf<TestSubject>().extract<InlineTag>().not.toBeNever()
})

it('should extract TypeExpression', () => {
expectTypeOf<TestSubject>().extract<TypeExpression>().not.toBeNever()
})
})
19 changes: 19 additions & 0 deletions src/types/docast-node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @file Type Definitions - DocastNode
* @module docast/types/DocastNode
*/

import type {
BlockTag,
Comment,
Description,
InlineTag,
TypeExpression
} from '#src/nodes'

/**
* A native docast node.
*/
type DocastNode = BlockTag | Comment | Description | InlineTag | TypeExpression

export type { DocastNode as default }
6 changes: 6 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @file Entry Point - Type Definitions
* @module docast/types
*/

export type { default as DocastNode } from './docast-node'

0 comments on commit 0e244ce

Please sign in to comment.