diff --git a/source/paths.d.ts b/source/paths.d.ts index 936e5917..c8e0e8b9 100644 --- a/source/paths.d.ts +++ b/source/paths.d.ts @@ -12,9 +12,9 @@ Paths options. */ export type PathsOptions = { /** - The maximum depth to recurse when searching for paths. + The maximum depth to recurse when searching for paths. Range: 0 ~ 10. - @default 10 + @default 5 */ maxRecursionDepth?: number; @@ -129,7 +129,7 @@ export type PathsOptions = { }; type DefaultPathsOptions = { - maxRecursionDepth: 10; + maxRecursionDepth: 5; bracketNotation: false; leavesOnly: false; depth: number; diff --git a/test-d/paths.ts b/test-d/paths.ts index a52237ae..6e14f519 100644 --- a/test-d/paths.ts +++ b/test-d/paths.ts @@ -111,7 +111,7 @@ expectAssignable({} as MyEntityPaths); // By default, the recursion limit should be reasonably long type RecursiveFoo = {foo: RecursiveFoo}; -expectAssignable>('foo.foo.foo.foo.foo.foo.foo.foo'); +expectAssignable>('foo.foo.foo.foo.foo.foo.foo.foo'); declare const recursion0: Paths; expectType<'foo'>(recursion0); @@ -206,7 +206,7 @@ expectType<`${number}.a` | `${number}.b`>(leadingSpreadLeaves); declare const leadingSpreadLeaves1: Paths<[...Array<{a?: string}>, {readonly b: number}, {c: number}], {leavesOnly: true}>; expectType<`${number}.a` | `${number}.b` | `${number}.c`>(leadingSpreadLeaves1); -declare const recursiveLeaves: Paths; +declare const recursiveLeaves: Paths; expectType<'foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo'>(recursiveLeaves); declare const recursiveWithMaxLeaves: Paths; @@ -282,7 +282,7 @@ expectType<'a.b.c' | `a.b2.${number}`>(maxSimilarToDepth); declare const maxSimilarToDepth2: Paths; expectType<'foo'>(maxSimilarToDepth2); -declare const maxSimilarToDepth3: Paths; // Default `maxRecursionDepth` is 10 +declare const maxSimilarToDepth3: Paths; // Default `maxRecursionDepth` is 10 expectType<'foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo'>(maxSimilarToDepth3); declare const maxMoreThanDepth: Paths; @@ -330,14 +330,14 @@ expectType<'a' | 'a.0.0.0.b'>(nestedTupleDepth); declare const recursiveDepth: Paths; expectType<'foo.foo.foo.foo.foo'>(recursiveDepth); -declare const recursiveDepth2: Paths; +declare const recursiveDepth2: Paths; expectType<'foo.foo' | 'foo.foo.foo.foo' | 'foo.foo.foo.foo.foo.foo.foo.foo.foo'>(recursiveDepth2); // For recursive types, leaves are at `maxRecursionDepth` -declare const recursiveDepth3: Paths; +declare const recursiveDepth3: Paths; expectType(recursiveDepth3); -declare const recursiveDepth4: Paths; // No leaves at depth `5` +declare const recursiveDepth4: Paths; // No leaves at depth `5` expectType<'foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo'>(recursiveDepth4); declare const recursiveDepth6: Paths; // Leaves are at depth `6`