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 4
4
*/
5
5
6
6
export type { Options } from './interfaces'
7
+ export type { Transform } from './types'
7
8
export { default as fromDocs } from './util'
Original file line number Diff line number Diff line change 3
3
* @module docast-util-from-docs/interfaces/tests/unit-d/Options
4
4
*/
5
5
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'
8
8
import type * as mdast from 'mdast-util-from-markdown'
9
9
import type * as micromark from 'micromark-util-types'
10
10
import type TestSubject from '../options'
@@ -28,9 +28,9 @@ describe('unit-d:interfaces/Options', () => {
28
28
. toEqualTypeOf < Nilable < micromark . Extension [ ] > > ( )
29
29
} )
30
30
31
- it ( 'should match [transforms?: Nilable<Fn<[Root], void> []>]' , ( ) => {
31
+ it ( 'should match [transforms?: Nilable<Transform []>]' , ( ) => {
32
32
expectTypeOf < TestSubject > ( )
33
33
. toHaveProperty ( 'transforms' )
34
- . toEqualTypeOf < Nilable < Fn < [ Root ] , void > [ ] > > ( )
34
+ . toEqualTypeOf < Nilable < Transform [ ] > > ( )
35
35
} )
36
36
} )
Original file line number Diff line number Diff line change 3
3
* @module docast-util-from-docs/interfaces/Options
4
4
*/
5
5
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'
8
8
import type { Code } from 'mdast'
9
9
import type * as mdast from 'mdast-util-from-markdown'
10
10
import type * as micromark from 'micromark-util-types'
@@ -41,9 +41,9 @@ interface Options {
41
41
/**
42
42
* Tree transforms.
43
43
*
44
- * @see {@linkcode Root }
44
+ * @see {@linkcode Transform }
45
45
*/
46
- transforms ?: Nilable < Fn < [ tree : Root ] , void > [ ] >
46
+ transforms ?: Nilable < Transform [ ] >
47
47
}
48
48
49
49
export type { Options as default }
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ import {
31
31
template ,
32
32
trim ,
33
33
type Assign ,
34
- type Fn ,
35
34
type Nilable ,
36
35
type Optional
37
36
} from '@flex-development/tutils'
@@ -64,7 +63,7 @@ import type { VFile } from 'vfile'
64
63
import { TokenKind } from './enums'
65
64
import type { Options , Token } from './interfaces'
66
65
import Lexer from './lexer'
67
- import type { UncommentReplacer } from './types'
66
+ import type { Transform , UncommentReplacer } from './types'
68
67
69
68
declare module 'mdast' {
70
69
interface BreakData {
@@ -1019,13 +1018,9 @@ class Parser {
1019
1018
/**
1020
1019
* Tree transforms.
1021
1020
*
1022
- * @const {Fn<[Root], void> []} transforms
1021
+ * @const {Transform []} transforms
1023
1022
*/
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 )
1029
1024
1030
1025
/**
1031
1026
* 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 3
3
* @module docast-util-from-docs/types
4
4
*/
5
5
6
+ export type { default as Transform } from './transform'
6
7
export 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