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 11/* eslint-disable @typescript-eslint/ban-types */
22
33import type { Node , Parent } from 'unist'
4+ import type { LessThan , Subtract } from 'type-fest'
45import type { Test } from 'unist-util-is'
56import type { Visitor } from './index.js'
67
@@ -9,13 +10,17 @@ import type {Visitor} from './index.js'
910 */
1011export type InclusiveDescendant <
1112 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
1418 ?
1519 | Tree
1620 | InclusiveDescendant <
1721 Exclude < Tree [ 'children' ] [ number ] , Found | Tree > ,
18- Found | Tree
22+ Found | Tree ,
23+ Subtract < Depth , 1 >
1924 >
2025 : Tree
2126
Original file line number Diff line number Diff line change 6161 "strip-ansi" : " ^7.0.0" ,
6262 "tsd" : " ^0.25.0" ,
6363 "type-coverage" : " ^2.0.0" ,
64+ "type-fest" : " ^4.32.0" ,
6465 "typescript" : " ^4.7.0" ,
65- "xo" : " ^0.53 .0"
66+ "xo" : " ^0.60 .0"
6667 },
6768 "scripts" : {
6869 "prepack" : " npm run build && npm run format" ,
You can’t perform that action at this time.
0 commit comments