File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/ban-types */
2
2
3
3
import type { Node , Parent } from 'unist'
4
+ import type { LessThan , Subtract } from 'type-fest'
4
5
import type { Test } from 'unist-util-is'
5
6
import type { Visitor } from './index.js'
6
7
@@ -9,13 +10,17 @@ import type {Visitor} from './index.js'
9
10
*/
10
11
export type InclusiveDescendant <
11
12
Tree extends Node = never ,
12
- Found = void
13
- > = Tree extends Parent
13
+ Found = void ,
14
+ Depth extends number = 5
15
+ > = LessThan < Depth , 0 > extends true
16
+ ? Tree
17
+ : Tree extends Parent
14
18
?
15
19
| Tree
16
20
| InclusiveDescendant <
17
21
Exclude < Tree [ 'children' ] [ number ] , Found | Tree > ,
18
- Found | Tree
22
+ Found | Tree ,
23
+ Subtract < Depth , 1 >
19
24
>
20
25
: Tree
21
26
Original file line number Diff line number Diff line change 61
61
"strip-ansi" : " ^7.0.0" ,
62
62
"tsd" : " ^0.25.0" ,
63
63
"type-coverage" : " ^2.0.0" ,
64
+ "type-fest" : " ^4.32.0" ,
64
65
"typescript" : " ^4.7.0" ,
65
- "xo" : " ^0.53 .0"
66
+ "xo" : " ^0.60 .0"
66
67
},
67
68
"scripts" : {
68
69
"prepack" : " npm run build && npm run format" ,
You can’t perform that action at this time.
0 commit comments