File tree Expand file tree Collapse file tree 7 files changed +50
-16
lines changed Expand file tree Collapse file tree 7 files changed +50
-16
lines changed Original file line number Diff line number Diff line change 44 */
55
66export type { Options } from './interfaces'
7+ export type { Transform } from './types'
78export { default as fromDocs } from './util'
Original file line number Diff line number Diff line change 33 * @module docast-util-from-docs/interfaces/tests/unit-d/Options
44 */
55
6- import type { Root } from '@flex-development/docast '
7- import type { Fn , Nilable , OneOrMany } from '@flex-development/tutils'
6+ import type { Transform } from '#src/types '
7+ import type { Nilable , OneOrMany } from '@flex-development/tutils'
88import type * as mdast from 'mdast-util-from-markdown'
99import type * as micromark from 'micromark-util-types'
1010import type TestSubject from '../options'
@@ -28,9 +28,9 @@ describe('unit-d:interfaces/Options', () => {
2828 . toEqualTypeOf < Nilable < micromark . Extension [ ] > > ( )
2929 } )
3030
31- it ( 'should match [transforms?: Nilable<Fn<[Root], void> []>]' , ( ) => {
31+ it ( 'should match [transforms?: Nilable<Transform []>]' , ( ) => {
3232 expectTypeOf < TestSubject > ( )
3333 . toHaveProperty ( 'transforms' )
34- . toEqualTypeOf < Nilable < Fn < [ Root ] , void > [ ] > > ( )
34+ . toEqualTypeOf < Nilable < Transform [ ] > > ( )
3535 } )
3636} )
Original file line number Diff line number Diff line change 33 * @module docast-util-from-docs/interfaces/Options
44 */
55
6- import type { Root } from '@flex-development/docast '
7- import type { Fn , Nilable , OneOrMany } from '@flex-development/tutils'
6+ import type { Transform } from '#src/types '
7+ import type { Nilable , OneOrMany } from '@flex-development/tutils'
88import type { Code } from 'mdast'
99import type * as mdast from 'mdast-util-from-markdown'
1010import type * as micromark from 'micromark-util-types'
@@ -41,9 +41,9 @@ interface Options {
4141 /**
4242 * Tree transforms.
4343 *
44- * @see {@linkcode Root }
44+ * @see {@linkcode Transform }
4545 */
46- transforms ?: Nilable < Fn < [ tree : Root ] , void > [ ] >
46+ transforms ?: Nilable < Transform [ ] >
4747}
4848
4949export type { Options as default }
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ import {
3131 template ,
3232 trim ,
3333 type Assign ,
34- type Fn ,
3534 type Nilable ,
3635 type Optional
3736} from '@flex-development/tutils'
@@ -64,7 +63,7 @@ import type { VFile } from 'vfile'
6463import { TokenKind } from './enums'
6564import type { Options , Token } from './interfaces'
6665import Lexer from './lexer'
67- import type { UncommentReplacer } from './types'
66+ import type { Transform , UncommentReplacer } from './types'
6867
6968declare module 'mdast' {
7069 interface BreakData {
@@ -1019,13 +1018,9 @@ class Parser {
10191018 /**
10201019 * Tree transforms.
10211020 *
1022- * @const {Fn<[Root], void> []} transforms
1021+ * @const {Transform []} transforms
10231022 */
1024- const transforms : Fn < [ tree : Root ] , void > [ ] = fallback (
1025- this . options . transforms ,
1026- [ ] ,
1027- isNIL
1028- )
1023+ const transforms : Transform [ ] = fallback ( this . options . transforms , [ ] , isNIL )
10291024
10301025 /**
10311026 * Dump paragraphs.
Original file line number Diff line number Diff line change 1+ /**
2+ * @file Type Tests - Transform
3+ * @module docast-util-from-docs/types/tests/unit-d/Transform
4+ */
5+
6+ import type { Root } from '@flex-development/docast'
7+ import type TestSubject from '../transform'
8+
9+ describe ( 'unit-d:types/Transform' , ( ) => {
10+ it ( 'should be callable with [Root]' , ( ) => {
11+ expectTypeOf < TestSubject > ( ) . parameters . toEqualTypeOf < [ Root ] > ( )
12+ } )
13+
14+ it ( 'should return void' , ( ) => {
15+ expectTypeOf < TestSubject > ( ) . returns . toBeVoid ( )
16+ } )
17+ } )
Original file line number Diff line number Diff line change 33 * @module docast-util-from-docs/types
44 */
55
6+ export type { default as Transform } from './transform'
67export type { default as UncommentReplacer } from './uncomment-replacer'
Original file line number Diff line number Diff line change 1+ /**
2+ * @file Type Definitions - Transform
3+ * @module docast-util-from-docs/types/Transform
4+ */
5+
6+ import type { Root } from '@flex-development/docast'
7+
8+ /**
9+ * Transform the docblock syntax `tree`.
10+ *
11+ * @see {@linkcode Root }
12+ *
13+ * @this {void}
14+ *
15+ * @param {Root } tree - docast tree
16+ * @return {void } Nothing
17+ */
18+ type Transform = ( this : void , tree : Root ) => void
19+
20+ export type { Transform as default }
You can’t perform that action at this time.
0 commit comments