@plyaz/types 1.5.5 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,7 +52,8 @@ import type { Provider, Type } from '@nestjs/common';
52
52
  import type { RenderOptions as RTLRenderOptions, RenderHookOptions as RTLRenderHookOptions } from '@testing-library/react';
53
53
  import type { UserEvent as UserEventLib } from '@testing-library/user-event';
54
54
  import type { MockEventEmitter, MockNextRouter, MockGetServerSidePropsContext, MockGetStaticPropsContext, MockNextApiResponse, MockNextApiRequest, TestScenario, CreateMockUseRouterReturn, CreateMockWebSocketReturn, CreateMockNextRequestFunction } from '..';
55
- import type { UnknownRecord } from 'type-fest';
55
+ import type { UnknownRecord, UnknownArray, Promisable, Arrayable } from 'type-fest';
56
+ import type { KeyValueStore, Identifiable, WithUrl, WithHttpMethod, WithHeaders, WithIpAddress, WithQueryParams, WithBody, Named, Clearable, Resettable, Describable, WithImpact, WithElement, WithDuration, IntervalControl, WithTimestamp, WithParams, WithKeyValues, WithTimeout, WithStatus, WithLocale, WithUserId, WithMessage } from '../../../common';
56
57
  /**
57
58
  * Subscription information for tracking subscriptions in tests
58
59
  *
@@ -67,8 +68,7 @@ import type { UnknownRecord } from 'type-fest';
67
68
  * };
68
69
  * ```
69
70
  */
70
- export interface SubscriptionInfo<T = unknown> {
71
- id: string;
71
+ export interface SubscriptionInfo<T = unknown> extends Identifiable {
72
72
  callback: Vitest.MockedFunction<(data: T) => void>;
73
73
  unsubscribe: () => void;
74
74
  }
@@ -179,10 +179,8 @@ export interface DeferredPromise<T = void> {
179
179
  * await waitFor(() => document.querySelector('.loaded'), options);
180
180
  * ```
181
181
  */
182
- export interface WaitOptions {
183
- timeout?: number;
182
+ export interface WaitOptions extends Partial<WithMessage & WithTimeout> {
184
183
  interval?: number;
185
- message?: string;
186
184
  }
187
185
  /**
188
186
  * Options for retry operations
@@ -262,11 +260,10 @@ export interface MockAsync<T = void> {
262
260
  * expect(timer.elapsed).toBe(500);
263
261
  * ```
264
262
  */
265
- export interface ControllableTimer {
263
+ export interface ControllableTimer extends Resettable {
266
264
  start: () => void;
267
265
  stop: () => void;
268
266
  tick: (ms: number) => void;
269
- reset: () => void;
270
267
  elapsed: number;
271
268
  }
272
269
  /**
@@ -330,9 +327,9 @@ export interface TestEventEmitter<T = unknown> {
330
327
  */
331
328
  export interface AsyncTestStep<T = unknown> {
332
329
  name: string;
333
- action: () => Promise<T> | T;
330
+ action: () => Promisable<T>;
334
331
  delay?: number;
335
- assertion?: (result: T) => void | Promise<void>;
332
+ assertion?: (result: T) => Promisable<void>;
336
333
  onError?: (error: Error) => void;
337
334
  }
338
335
  /**
@@ -497,7 +494,7 @@ export interface PollingTestOptions {
497
494
  * ```
498
495
  */
499
496
  export interface TestCleanup {
500
- add: (cleanup: () => void | Promise<void>) => void;
497
+ add: (cleanup: () => Promisable<void>) => void;
501
498
  runAll: () => Promise<void>;
502
499
  clear: () => void;
503
500
  }
@@ -543,11 +540,7 @@ export interface MockConsole {
543
540
  * };
544
541
  * ```
545
542
  */
546
- export interface MockEnv {
547
- set: (key: string, value: string) => void;
548
- get: (key: string) => string | undefined;
549
- delete: (key: string) => void;
550
- clear: () => void;
543
+ export interface MockEnv extends KeyValueStore<string, string> {
551
544
  restore: () => void;
552
545
  }
553
546
  /**
@@ -600,8 +593,8 @@ export interface BenchmarkOptions {
600
593
  iterations?: number;
601
594
  time?: number;
602
595
  warmup?: number;
603
- setup?: () => void | Promise<void>;
604
- teardown?: () => void | Promise<void>;
596
+ setup?: () => Promisable<void>;
597
+ teardown?: () => Promisable<void>;
605
598
  runs?: number;
606
599
  format?: 'table' | 'json';
607
600
  }
@@ -620,8 +613,8 @@ export interface BenchmarkOptions {
620
613
  */
621
614
  export interface TestBedConfig {
622
615
  providers: Provider[];
623
- imports?: unknown[];
624
- exports?: unknown[];
616
+ imports?: UnknownArray;
617
+ exports?: UnknownArray;
625
618
  }
626
619
  /**
627
620
  * Options for testing NestJS controllers.
@@ -662,10 +655,8 @@ export interface ControllerTestHarnessOptions<T> {
662
655
  * };
663
656
  * ```
664
657
  */
665
- export interface ValidateMiddlwareResponseExpected {
658
+ export interface ValidateMiddlwareResponseExpected extends Partial<WithUrl & WithStatus> {
666
659
  type: 'next' | 'redirect' | 'rewrite' | 'response';
667
- url?: string;
668
- status?: number;
669
660
  }
670
661
  /**
671
662
  * Options for creating service test harness.
@@ -757,7 +748,7 @@ export interface ApiRouteTestContext {
757
748
  expectStatus: (status: number) => void;
758
749
  expectJson: (data: unknown) => void;
759
750
  expectRedirect: (url: string, status?: number) => void;
760
- expectHeader: (name: string, value: string | string[]) => void;
751
+ expectHeader: (name: string, value: Arrayable<string>) => void;
761
752
  }
762
753
  /**
763
754
  * Test context for middleware functions.
@@ -804,8 +795,8 @@ export interface MiddlewareTestContext {
804
795
  */
805
796
  export interface AppRouterHookTestOptions<TProps> extends RenderHookOptions<TProps> {
806
797
  pathname?: string;
807
- searchParams?: Record<string, string | string[]>;
808
- params?: Record<string, string | string[]>;
798
+ searchParams?: Record<string, Arrayable<string>>;
799
+ params?: Record<string, Arrayable<string>>;
809
800
  }
810
801
  export type UserEvent = UserEventLib;
811
802
  /**
@@ -826,7 +817,7 @@ export type UserEvent = UserEventLib;
826
817
  */
827
818
  export interface UserEventConfig {
828
819
  delay?: number;
829
- advanceTimers?: (ms: number) => void | Promise<void>;
820
+ advanceTimers?: (ms: number) => Promisable<void>;
830
821
  applyAccept?: boolean;
831
822
  autoModify?: boolean;
832
823
  skipAutoClose?: boolean;
@@ -852,7 +843,7 @@ export interface UserEventConfig {
852
843
  export interface InteractionSequence {
853
844
  type: 'click' | 'type' | 'select' | 'check' | 'focus' | 'blur' | 'hover' | 'key' | 'paste' | 'clear' | 'upload' | 'drag' | 'scroll' | 'wait' | 'tab' | 'keyboard';
854
845
  target?: string | HTMLElement;
855
- value?: string | string[] | boolean | File | File[];
846
+ value?: Arrayable<string> | boolean | Arrayable<File>;
856
847
  wait?: number;
857
848
  options?: {
858
849
  delay?: number;
@@ -1010,8 +1001,7 @@ export interface EventDrivenTestUtils {
1010
1001
  * };
1011
1002
  * ```
1012
1003
  */
1013
- export interface TestServer {
1014
- url: string;
1004
+ export interface TestServer extends WithUrl {
1015
1005
  port: number;
1016
1006
  close: () => Promise<void>;
1017
1007
  on: (event: string, handler: Function) => void;
@@ -1069,8 +1059,7 @@ export interface ConcurrentTestResult {
1069
1059
  * };
1070
1060
  * ```
1071
1061
  */
1072
- export interface RateLimitResult {
1073
- timestamp: number;
1062
+ export interface RateLimitResult extends WithTimestamp<number> {
1074
1063
  success: boolean;
1075
1064
  error?: Error;
1076
1065
  }
@@ -1105,10 +1094,9 @@ export interface RateLimitTestResult {
1105
1094
  * };
1106
1095
  * ```
1107
1096
  */
1108
- export interface PollingAttempt {
1097
+ export interface PollingAttempt extends WithTimestamp<number> {
1109
1098
  attempt: number;
1110
1099
  result: unknown;
1111
- timestamp: number;
1112
1100
  }
1113
1101
  /**
1114
1102
  * Results from polling operation testing.
@@ -1159,7 +1147,7 @@ export interface DebounceTestResult {
1159
1147
  * ```
1160
1148
  */
1161
1149
  export interface ThrottleCall {
1162
- args: unknown[];
1150
+ args: UnknownArray;
1163
1151
  delay: number;
1164
1152
  }
1165
1153
  /**
@@ -1176,7 +1164,7 @@ export interface ThrottleCall {
1176
1164
  */
1177
1165
  export interface ThrottleResult {
1178
1166
  called: boolean;
1179
- args?: unknown[];
1167
+ args?: UnknownArray;
1180
1168
  }
1181
1169
  /**
1182
1170
  * Async testing scenario definition.
@@ -1196,11 +1184,10 @@ export interface ThrottleResult {
1196
1184
  * };
1197
1185
  * ```
1198
1186
  */
1199
- export interface AsyncScenario<T = void> {
1200
- name: string;
1187
+ export interface AsyncScenario<T = void> extends Named {
1201
1188
  setup: () => Promise<void>;
1202
1189
  action: () => Promise<T>;
1203
- verify: (result: T) => void | Promise<void>;
1190
+ verify: (result: T) => Promisable<void>;
1204
1191
  cleanup?: () => Promise<void>;
1205
1192
  expectedHooks: string[];
1206
1193
  }
@@ -1219,8 +1206,7 @@ export interface AsyncScenario<T = void> {
1219
1206
  * };
1220
1207
  * ```
1221
1208
  */
1222
- export interface WaitForChangeOptions<T> {
1223
- timeout?: number;
1209
+ export interface WaitForChangeOptions<T> extends Partial<WithTimeout> {
1224
1210
  interval?: number;
1225
1211
  compareFn?: (a: T, b: T) => boolean;
1226
1212
  }
@@ -1243,12 +1229,27 @@ export interface WaitForChangeOptions<T> {
1243
1229
  * ```
1244
1230
  */
1245
1231
  export interface PerformanceMetrics {
1232
+ /** Minimum execution time (ms) */
1246
1233
  min: number;
1234
+ /** Maximum execution time (ms) */
1247
1235
  max: number;
1236
+ /** Operations per second */
1237
+ opsPerSecond: number;
1238
+ /** Mean execution time (ms) */
1248
1239
  mean: number;
1240
+ /** Median execution time (ms) */
1249
1241
  median: number;
1242
+ /** Standard deviation of execution times */
1243
+ stdDev: number;
1244
+ /** 95th percentile execution time (ms) */
1250
1245
  p95: number;
1246
+ /** 99th percentile execution time (ms) */
1251
1247
  p99: number;
1248
+ /**
1249
+ * Array of all duration measurements (ms)
1250
+ * @remarks This is actually an array of durations, not the count of runs
1251
+ * The naming is inconsistent but matches the current implementation
1252
+ */
1252
1253
  runs: number[];
1253
1254
  }
1254
1255
  /**
@@ -1300,7 +1301,33 @@ export interface MeasureTimeResult<T> {
1300
1301
  * ```
1301
1302
  */
1302
1303
  export interface BenchmarkResult {
1303
- [functionName: string]: PerformanceMetrics;
1304
+ /** Name of the benchmark suite */
1305
+ name: string;
1306
+ /**
1307
+ * Performance metrics for each benchmarked operation
1308
+ * @remarks Keys are the function names from the input functions object
1309
+ */
1310
+ operations: Record<string, PerformanceMetrics>;
1311
+ /**
1312
+ * Timestamp when benchmark was run
1313
+ * @optional
1314
+ */
1315
+ timestamp?: number;
1316
+ /**
1317
+ * Total duration of all benchmark runs (ms)
1318
+ * @optional
1319
+ */
1320
+ totalDuration?: number;
1321
+ /**
1322
+ * Comparison data between operations
1323
+ * @optional
1324
+ */
1325
+ comparison?: {
1326
+ fastest: string;
1327
+ slowest: string;
1328
+ /** Relative performance (fastest = 1.0) */
1329
+ relative: Record<string, number>;
1330
+ };
1304
1331
  }
1305
1332
  /**
1306
1333
  * Options for load testing.
@@ -1525,12 +1552,45 @@ export interface PerformanceComparisonInput<T> {
1525
1552
  * peak: 60 * 1024 * 1024 // 60MB peak
1526
1553
  * };
1527
1554
  * ```
1555
+ * @remarks
1556
+ * Added `used` and `heapUsed` properties for better compatibility
1557
+ * and clearer API. The `heapUsed` property provides compatibility
1558
+ * with Node.js memory usage conventions.
1528
1559
  */
1529
1560
  export interface MemoryMeasurement {
1561
+ /** Memory usage before operation (bytes) */
1530
1562
  before: number;
1563
+ /** Memory usage after operation (bytes) */
1531
1564
  after: number;
1565
+ /** Change in memory usage (after - before) in bytes */
1532
1566
  delta: number;
1567
+ /** Peak memory usage during operation (bytes) */
1533
1568
  peak: number;
1569
+ /**
1570
+ * Memory used by operation (bytes)
1571
+ * @remarks Alias for delta, provides clearer semantic meaning
1572
+ */
1573
+ used: number;
1574
+ /**
1575
+ * Heap memory used by operation (bytes)
1576
+ * @remarks Alias for delta, provides Node.js compatibility
1577
+ */
1578
+ heapUsed: number;
1579
+ /**
1580
+ * Total heap size (bytes)
1581
+ * @optional Additional memory information when available
1582
+ */
1583
+ heapTotal?: number;
1584
+ /**
1585
+ * External memory usage (bytes)
1586
+ * @optional V8 external memory when available
1587
+ */
1588
+ external?: number;
1589
+ /**
1590
+ * Resident set size (bytes)
1591
+ * @optional Total memory allocated for the process
1592
+ */
1593
+ rss?: number;
1534
1594
  }
1535
1595
  /**
1536
1596
  * Options for memory measurement during testing.
@@ -1549,8 +1609,27 @@ export interface MemoryMeasurement {
1549
1609
  * ```
1550
1610
  */
1551
1611
  export interface MeasureMemoryOptions {
1612
+ /**
1613
+ * Force garbage collection before measurement
1614
+ * @default false
1615
+ * @remarks Requires --expose-gc flag in Node.js
1616
+ */
1552
1617
  forceGC?: boolean;
1618
+ /**
1619
+ * Number of measurement runs to average
1620
+ * @default 1
1621
+ */
1553
1622
  runs?: number;
1623
+ /**
1624
+ * Run garbage collection between each measurement
1625
+ * @default false
1626
+ */
1627
+ gcBetweenRuns?: boolean;
1628
+ /**
1629
+ * Include detailed heap statistics
1630
+ * @default false
1631
+ */
1632
+ detailed?: boolean;
1554
1633
  }
1555
1634
  /**
1556
1635
  * Result from memory measurement testing.
@@ -1628,10 +1707,9 @@ export interface AssertPerformanceOptions {
1628
1707
  * };
1629
1708
  * ```
1630
1709
  */
1631
- export interface EventHistoryEntry {
1710
+ export interface EventHistoryEntry extends WithTimestamp<number> {
1632
1711
  event: string;
1633
1712
  payload: unknown;
1634
- timestamp: number;
1635
1713
  }
1636
1714
  /**
1637
1715
  * Configuration for simulating events in tests.
@@ -1678,8 +1756,7 @@ export interface SimulatedEvent {
1678
1756
  * const mockWS = createMockWebSocket(options);
1679
1757
  * ```
1680
1758
  */
1681
- export interface WebSocketMockOptions {
1682
- url?: string;
1759
+ export interface WebSocketMockOptions extends Partial<WithUrl> {
1683
1760
  protocol?: string;
1684
1761
  extensions?: string;
1685
1762
  readyState?: number;
@@ -1721,8 +1798,7 @@ export interface WebSocketServerMockOptions {
1721
1798
  * };
1722
1799
  * ```
1723
1800
  */
1724
- export interface WebSocketTestScenario {
1725
- name: string;
1801
+ export interface WebSocketTestScenario extends Named {
1726
1802
  message: unknown;
1727
1803
  expectedResponse?: unknown;
1728
1804
  expectedBroadcast?: unknown;
@@ -1747,11 +1823,8 @@ export interface WebSocketTestScenario {
1747
1823
  * const ws = await connectWebSocket(connectionOptions);
1748
1824
  * ```
1749
1825
  */
1750
- export interface WebSocketConnectionOptions {
1751
- url: string;
1752
- protocols?: string | string[];
1753
- headers?: Record<string, string>;
1754
- timeout?: number;
1826
+ export interface WebSocketConnectionOptions extends Partial<WithTimeout>, WithUrl, WithHeaders {
1827
+ protocols?: Arrayable<string>;
1755
1828
  }
1756
1829
  /**
1757
1830
  * Test configuration for file operations.
@@ -1772,9 +1845,8 @@ export interface WebSocketConnectionOptions {
1772
1845
  * };
1773
1846
  * ```
1774
1847
  */
1775
- export interface FileOperationTest {
1776
- name: string;
1777
- operation: (fs: unknown) => void | Promise<void>;
1848
+ export interface FileOperationTest extends Named {
1849
+ operation: (fs: unknown) => Promisable<void>;
1778
1850
  expectedFiles?: Map<string, string | globalThis.Buffer>;
1779
1851
  expectedError?: string | RegExp;
1780
1852
  }
@@ -1862,8 +1934,7 @@ export interface AriaAttributes {
1862
1934
  * ];
1863
1935
  * ```
1864
1936
  */
1865
- export interface KeyboardNavigationTest {
1866
- element: HTMLElement;
1937
+ export interface KeyboardNavigationTest extends WithElement {
1867
1938
  key: string;
1868
1939
  expectedBehavior: 'focus' | 'activate' | 'navigate' | 'ignore';
1869
1940
  expectedTarget?: HTMLElement;
@@ -1888,8 +1959,7 @@ export interface KeyboardNavigationTest {
1888
1959
  * ];
1889
1960
  * ```
1890
1961
  */
1891
- export interface ScreenReaderTest {
1892
- element: HTMLElement;
1962
+ export interface ScreenReaderTest extends WithElement {
1893
1963
  expectedText: string | RegExp;
1894
1964
  includeHidden?: boolean;
1895
1965
  }
@@ -1917,8 +1987,7 @@ export interface ScreenReaderTest {
1917
1987
  * ];
1918
1988
  * ```
1919
1989
  */
1920
- export interface LifecycleHook {
1921
- name: string;
1990
+ export interface LifecycleHook extends Named {
1922
1991
  method: string;
1923
1992
  phase: 'mount' | 'update' | 'unmount' | 'init' | 'destroy';
1924
1993
  required?: boolean;
@@ -1944,13 +2013,12 @@ export interface LifecycleHook {
1944
2013
  * };
1945
2014
  * ```
1946
2015
  */
1947
- export interface ComponentLifecycleTest {
1948
- name: string;
2016
+ export interface ComponentLifecycleTest extends Named {
1949
2017
  Component: React.ComponentType<unknown>;
1950
- props?: Record<string, unknown>;
2018
+ props?: UnknownRecord;
1951
2019
  expectedHooks: LifecycleHook[];
1952
2020
  interactions?: Array<{
1953
- action: () => void | Promise<void>;
2021
+ action: () => Promisable<void>;
1954
2022
  expectedHooksAfter: string[];
1955
2023
  }>;
1956
2024
  }
@@ -2004,10 +2072,9 @@ export interface ServiceWithLifecycle {
2004
2072
  * };
2005
2073
  * ```
2006
2074
  */
2007
- export interface ServiceLifecycleTest {
2008
- name: string;
2075
+ export interface ServiceLifecycleTest extends Named {
2009
2076
  Service: new (...args: unknown[]) => ServiceWithLifecycle;
2010
- dependencies?: unknown[];
2077
+ dependencies?: UnknownArray;
2011
2078
  expectedHooks: LifecycleHook[];
2012
2079
  cleanupExpected?: boolean;
2013
2080
  }
@@ -2025,9 +2092,7 @@ export interface ServiceLifecycleTest {
2025
2092
  * ```
2026
2093
  */
2027
2094
  export interface ProviderWithLifecycle {
2028
- constructor: {
2029
- name: string;
2030
- };
2095
+ constructor: Named;
2031
2096
  onModuleInit?: () => Promise<void>;
2032
2097
  onModuleDestroy?: () => Promise<void>;
2033
2098
  [key: string]: unknown;
@@ -2047,8 +2112,7 @@ export interface ProviderWithLifecycle {
2047
2112
  * };
2048
2113
  * ```
2049
2114
  */
2050
- export interface ModuleLifecycleTest {
2051
- name: string;
2115
+ export interface ModuleLifecycleTest extends Named {
2052
2116
  Module: new (...args: unknown[]) => unknown;
2053
2117
  providers: ProviderWithLifecycle[];
2054
2118
  expectedInitOrder: string[];
@@ -2069,10 +2133,9 @@ export interface ModuleLifecycleTest {
2069
2133
  * };
2070
2134
  * ```
2071
2135
  */
2072
- export interface ApplicationLifecycleTest {
2073
- name: string;
2074
- app: Record<string, unknown>;
2075
- modules: unknown[];
2136
+ export interface ApplicationLifecycleTest extends Named {
2137
+ app: UnknownRecord;
2138
+ modules: UnknownArray;
2076
2139
  expectedStartupSequence: string[];
2077
2140
  expectedShutdownSequence: string[];
2078
2141
  }
@@ -2094,14 +2157,13 @@ export interface ApplicationLifecycleTest {
2094
2157
  * };
2095
2158
  * ```
2096
2159
  */
2097
- export interface TestSuiteConfig<T> {
2098
- name: string;
2160
+ export interface TestSuiteConfig<T> extends Named {
2099
2161
  createInstance: () => T;
2100
2162
  defaultProps?: unknown;
2101
- setupBeforeAll?: () => void | Promise<void>;
2102
- setupBeforeEach?: () => void | Promise<void>;
2103
- teardownAfterEach?: () => void | Promise<void>;
2104
- teardownAfterAll?: () => void | Promise<void>;
2163
+ setupBeforeAll?: () => Promisable<void>;
2164
+ setupBeforeEach?: () => Promisable<void>;
2165
+ teardownAfterEach?: () => Promisable<void>;
2166
+ teardownAfterAll?: () => Promisable<void>;
2105
2167
  }
2106
2168
  /**
2107
2169
  * Environment configuration for testing.
@@ -2135,8 +2197,7 @@ export interface EnvironmentConfig {
2135
2197
  * };
2136
2198
  * ```
2137
2199
  */
2138
- export interface AnimationTestOptions {
2139
- duration?: number;
2200
+ export interface AnimationTestOptions extends Partial<WithDuration> {
2140
2201
  easing?: string;
2141
2202
  delay?: number;
2142
2203
  iterations?: number;
@@ -2157,9 +2218,8 @@ export interface AnimationTestOptions {
2157
2218
  * };
2158
2219
  * ```
2159
2220
  */
2160
- export interface TransitionTestOptions {
2221
+ export interface TransitionTestOptions extends Partial<WithDuration> {
2161
2222
  property?: string;
2162
- duration?: number;
2163
2223
  timingFunction?: string;
2164
2224
  delay?: number;
2165
2225
  }
@@ -2199,8 +2259,7 @@ export interface KeyframeTest {
2199
2259
  * };
2200
2260
  * ```
2201
2261
  */
2202
- export interface AnimationSequence {
2203
- name: string;
2262
+ export interface AnimationSequence extends Named {
2204
2263
  steps: Array<{
2205
2264
  delay?: number;
2206
2265
  duration: number;
@@ -2224,11 +2283,10 @@ export interface AnimationSequence {
2224
2283
  * };
2225
2284
  * ```
2226
2285
  */
2227
- export interface EnvironmentTestCase {
2228
- name: string;
2286
+ export interface EnvironmentTestCase extends Named {
2229
2287
  environment: EnvironmentConfig;
2230
- expectedBehavior: () => void | Promise<void>;
2231
- cleanup?: () => void | Promise<void>;
2288
+ expectedBehavior: () => Promisable<void>;
2289
+ cleanup?: () => Promisable<void>;
2232
2290
  }
2233
2291
  /**
2234
2292
  * Configuration test scenario.
@@ -2246,11 +2304,10 @@ export interface EnvironmentTestCase {
2246
2304
  * };
2247
2305
  * ```
2248
2306
  */
2249
- export interface ConfigTestScenario {
2250
- name: string;
2251
- config: Record<string, unknown>;
2307
+ export interface ConfigTestScenario extends Named {
2308
+ config: UnknownRecord;
2252
2309
  environment?: EnvironmentConfig;
2253
- expectedValues: Record<string, unknown>;
2310
+ expectedValues: UnknownRecord;
2254
2311
  shouldThrow?: boolean;
2255
2312
  expectedError?: string | RegExp;
2256
2313
  }
@@ -2284,8 +2341,7 @@ export interface SpringConfig {
2284
2341
  * };
2285
2342
  * ```
2286
2343
  */
2287
- export interface RAFCallback {
2288
- id: number;
2344
+ export interface RAFCallback extends Identifiable<number> {
2289
2345
  callback: FrameRequestCallback;
2290
2346
  }
2291
2347
  /**
@@ -2315,9 +2371,7 @@ export interface LoadingState {
2315
2371
  * };
2316
2372
  * ```
2317
2373
  */
2318
- export interface ForTextOptions {
2319
- timeout?: number;
2320
- }
2374
+ export type ForTextOptions = WithTimeout;
2321
2375
  /**
2322
2376
  * Test value with index wrapper.
2323
2377
  * Associates test values with their position.
@@ -2349,10 +2403,9 @@ export interface TestValueWithIndex<T> {
2349
2403
  * };
2350
2404
  * ```
2351
2405
  */
2352
- export interface CallRecord {
2406
+ export interface CallRecord extends WithTimestamp<number> {
2353
2407
  method: string;
2354
- args: unknown[];
2355
- timestamp: number;
2408
+ args: UnknownArray;
2356
2409
  }
2357
2410
  /**
2358
2411
  * Module spy for tracking calls.
@@ -2387,8 +2440,7 @@ export interface ModuleSpy<T> {
2387
2440
  * };
2388
2441
  * ```
2389
2442
  */
2390
- export interface NamedTestCase<T> {
2391
- name: string;
2443
+ export interface NamedTestCase<T> extends Named {
2392
2444
  input: T;
2393
2445
  expected: unknown;
2394
2446
  }
@@ -2401,9 +2453,24 @@ export interface ImageLoaderProps {
2401
2453
  width: number;
2402
2454
  quality?: number;
2403
2455
  }
2456
+ /**
2457
+ * Global type augmentation for performance.memory
2458
+ *
2459
+ * @remarks
2460
+ * Extends the Performance interface to include memory property
2461
+ * available in Chrome and Node.js environments
2462
+ */
2404
2463
  export interface PerformanceMemory {
2464
+ /**
2465
+ * Performance object with memory property
2466
+ */
2405
2467
  memory?: {
2468
+ /** Used JS heap size in bytes */
2406
2469
  usedJSHeapSize: number;
2470
+ /** Total JS heap size in bytes */
2471
+ totalJSHeapSize: number;
2472
+ /** JS heap size limit in bytes */
2473
+ jsHeapSizeLimit: number;
2407
2474
  };
2408
2475
  }
2409
2476
  export interface NextPageResult {
@@ -2429,7 +2496,7 @@ export interface NextPageResult {
2429
2496
  * ```
2430
2497
  */
2431
2498
  export interface MockCallResult {
2432
- args: unknown[];
2499
+ args: UnknownArray;
2433
2500
  result: unknown;
2434
2501
  error?: unknown;
2435
2502
  }
@@ -2544,12 +2611,7 @@ export interface MockNextRouterReturn {
2544
2611
  * };
2545
2612
  * ```
2546
2613
  */
2547
- export interface MockNextRequest {
2548
- url: string;
2549
- method: string;
2550
- headers: Headers;
2551
- body: unknown;
2552
- ip: string;
2614
+ export interface MockNextRequest extends WithUrl, WithHttpMethod, WithHeaders, WithIpAddress, WithBody {
2553
2615
  searchParams?: Record<string, string>;
2554
2616
  nextUrl: {
2555
2617
  pathname: string;
@@ -2582,13 +2644,12 @@ export interface MockNextRequest {
2582
2644
  * response.redirect('/login');
2583
2645
  * ```
2584
2646
  */
2585
- export interface MockNextResponse {
2647
+ export interface MockNextResponse extends WithStatus<number> {
2586
2648
  cookies: {
2587
2649
  set: Vitest.Mock;
2588
2650
  delete: Vitest.Mock;
2589
2651
  };
2590
2652
  headers: Headers;
2591
- status: number;
2592
2653
  redirect: Vitest.Mock;
2593
2654
  rewrite: Vitest.Mock;
2594
2655
  next: Vitest.Mock;
@@ -2670,7 +2731,7 @@ export interface GetStaticPathsExpectations {
2670
2731
  pathCount?: number;
2671
2732
  fallback: boolean | 'blocking';
2672
2733
  validatePaths?: (paths: Array<string | {
2673
- params: Record<string, string | string[] | undefined>;
2734
+ params: Record<string, Arrayable<string> | undefined>;
2674
2735
  }>) => void;
2675
2736
  }
2676
2737
  /**
@@ -2767,15 +2828,13 @@ export interface LoadingComponentExpectations {
2767
2828
  * };
2768
2829
  * ```
2769
2830
  */
2770
- export interface MiddlewareTestScenarioWithRequest {
2771
- name: string;
2831
+ export interface MiddlewareTestExpectedResponse extends Partial<WithUrl & WithStatus> {
2832
+ type: 'next' | 'redirect' | 'rewrite' | 'response';
2833
+ headers?: Record<string, string>;
2834
+ }
2835
+ export interface MiddlewareTestScenarioWithRequest extends Named {
2772
2836
  request: Parameters<CreateMockNextRequestFunction>;
2773
- expected: {
2774
- type: 'next' | 'redirect' | 'rewrite' | 'response';
2775
- url?: string;
2776
- headers?: Record<string, string>;
2777
- status?: number;
2778
- };
2837
+ expected: MiddlewareTestExpectedResponse;
2779
2838
  }
2780
2839
  /**
2781
2840
  * API route handler methods for Next.js.
@@ -2811,8 +2870,7 @@ export interface ApiRouteHandlerMethods {
2811
2870
  * };
2812
2871
  * ```
2813
2872
  */
2814
- export interface RouteHandlerTestScenario {
2815
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
2873
+ export interface RouteHandlerTestScenario extends WithHttpMethod {
2816
2874
  request: Parameters<CreateMockNextRequestFunction>;
2817
2875
  expectedStatus: number;
2818
2876
  expectedBody?: unknown;
@@ -2849,7 +2907,7 @@ export interface ImageLoaderTestScenario {
2849
2907
  * ```
2850
2908
  */
2851
2909
  export interface ParameterizedTest<T> {
2852
- test: (name: string, fn: (input: T, expected: unknown) => void | Promise<void>) => void;
2910
+ test: (name: string, fn: (input: T, expected: unknown) => Promisable<void>) => void;
2853
2911
  }
2854
2912
  /**
2855
2913
  * Test suite for service testing.
@@ -2882,7 +2940,7 @@ export interface ServiceTestSuite<T> {
2882
2940
  * ```
2883
2941
  */
2884
2942
  export interface NestJSTestSuiteReturn {
2885
- testProviderRegistration: (providerTokens: unknown[]) => void;
2943
+ testProviderRegistration: (providerTokens: UnknownArray) => void;
2886
2944
  testProviderInjection: (injectionTests: Array<ProviderInjectionTest>) => void;
2887
2945
  }
2888
2946
  /**
@@ -2983,8 +3041,7 @@ export interface MockManyResult {
2983
3041
  * };
2984
3042
  * ```
2985
3043
  */
2986
- export interface RouteMatchResult {
2987
- params: Record<string, string | string[]>;
3044
+ export interface RouteMatchResult extends WithParams {
2988
3045
  isMatch: boolean;
2989
3046
  }
2990
3047
  /**
@@ -2999,8 +3056,7 @@ export interface RouteMatchResult {
2999
3056
  * };
3000
3057
  * ```
3001
3058
  */
3002
- export interface PerformanceEntryResult {
3003
- name: string;
3059
+ export interface PerformanceEntryResult extends Named {
3004
3060
  metrics: PerformanceMetrics;
3005
3061
  }
3006
3062
  /**
@@ -3018,7 +3074,9 @@ export interface PerformanceEntryResult {
3018
3074
  * ```
3019
3075
  */
3020
3076
  export interface MemoryMeasurementResult<T> {
3077
+ /** Single measurement data */
3021
3078
  measurement: MemoryMeasurement;
3079
+ /** Function execution result */
3022
3080
  result: T;
3023
3081
  }
3024
3082
  /**
@@ -3034,6 +3092,10 @@ export interface MemoryMeasurementResult<T> {
3034
3092
  * ```
3035
3093
  */
3036
3094
  export interface GlobalWithGC {
3095
+ /**
3096
+ * Manual garbage collection trigger
3097
+ * @remarks Only available with --expose-gc flag
3098
+ */
3037
3099
  gc?: () => void;
3038
3100
  }
3039
3101
  /**
@@ -3069,9 +3131,8 @@ export interface MemoryLeakTestResult {
3069
3131
  * };
3070
3132
  * ```
3071
3133
  */
3072
- export interface PropVariation {
3073
- name: string;
3074
- props: Record<string, unknown>;
3134
+ export interface PropVariation extends Named {
3135
+ props: UnknownRecord;
3075
3136
  expectation: () => void;
3076
3137
  }
3077
3138
  /**
@@ -3089,8 +3150,7 @@ export interface PropVariation {
3089
3150
  * };
3090
3151
  * ```
3091
3152
  */
3092
- export interface ValidTestCase<T> {
3093
- name: string;
3153
+ export interface ValidTestCase<T> extends Named {
3094
3154
  input: unknown;
3095
3155
  expected?: T;
3096
3156
  }
@@ -3107,8 +3167,7 @@ export interface ValidTestCase<T> {
3107
3167
  * };
3108
3168
  * ```
3109
3169
  */
3110
- export interface InvalidTestCase {
3111
- name: string;
3170
+ export interface InvalidTestCase extends Named {
3112
3171
  input: unknown;
3113
3172
  expectedError: string | RegExp;
3114
3173
  }
@@ -3124,8 +3183,7 @@ export interface InvalidTestCase {
3124
3183
  * };
3125
3184
  * ```
3126
3185
  */
3127
- export interface CreatedResource {
3128
- name: string;
3186
+ export interface CreatedResource extends Named {
3129
3187
  resource: unknown;
3130
3188
  }
3131
3189
  /**
@@ -3141,10 +3199,9 @@ export interface CreatedResource {
3141
3199
  * };
3142
3200
  * ```
3143
3201
  */
3144
- export interface LifecycleHookRecord {
3202
+ export interface LifecycleHookRecord extends WithTimestamp<number> {
3145
3203
  phase: string;
3146
3204
  method: string;
3147
- timestamp: number;
3148
3205
  }
3149
3206
  /**
3150
3207
  * Test case for path matching.
@@ -3195,7 +3252,7 @@ export interface ErrorScenario<T> {
3195
3252
  * ```
3196
3253
  */
3197
3254
  export interface PropsTestScenario {
3198
- props: Record<string, unknown>;
3255
+ props: UnknownRecord;
3199
3256
  expectedContent?: string;
3200
3257
  }
3201
3258
  /**
@@ -3218,7 +3275,7 @@ export interface ResponsiveBreakpoint {
3218
3275
  height: number;
3219
3276
  expectations: () => void;
3220
3277
  }
3221
- export type TestCombination<T extends Record<string, unknown[]>> = {
3278
+ export type TestCombination<T extends Record<string, UnknownArray>> = {
3222
3279
  [K in keyof T]: T[K][number];
3223
3280
  };
3224
3281
  /**
@@ -3263,8 +3320,7 @@ export type LoadingResult = {
3263
3320
  * };
3264
3321
  * ```
3265
3322
  */
3266
- export interface TableTestCase<TInput, TExpected> {
3267
- name: string;
3323
+ export interface TableTestCase<TInput, TExpected> extends Named {
3268
3324
  input: TInput;
3269
3325
  expected: TExpected;
3270
3326
  skip?: boolean;
@@ -3287,8 +3343,7 @@ export interface TableTestCase<TInput, TExpected> {
3287
3343
  * };
3288
3344
  * ```
3289
3345
  */
3290
- export interface EdgeCaseTest<T, R> {
3291
- name: string;
3346
+ export interface EdgeCaseTest<T, R> extends Named {
3292
3347
  input: T;
3293
3348
  expected?: R;
3294
3349
  shouldThrow?: string | RegExp | Error;
@@ -3451,8 +3506,7 @@ export interface BoundaryValueTest<T> {
3451
3506
  * };
3452
3507
  * ```
3453
3508
  */
3454
- export interface EquivalenceClassTest<T, R> {
3455
- name: string;
3509
+ export interface EquivalenceClassTest<T, R> extends Named {
3456
3510
  samples: T[];
3457
3511
  expected: R;
3458
3512
  }
@@ -3494,12 +3548,11 @@ export interface StateTransitionTest<TState, TAction> {
3494
3548
  * };
3495
3549
  * ```
3496
3550
  */
3497
- export interface SnapshotTestCase<T> {
3498
- name: string;
3551
+ export interface SnapshotTestCase<T> extends Named {
3499
3552
  input: T;
3500
3553
  transform?: (input: T) => unknown;
3501
3554
  }
3502
- export interface CombinationTestOptions<T extends Record<string, unknown[]>> {
3555
+ export interface CombinationTestOptions<T extends Record<string, UnknownArray>> {
3503
3556
  filter?: (combination: TestCombination<T>) => boolean;
3504
3557
  maxCombinations?: number;
3505
3558
  }
@@ -3525,8 +3578,7 @@ export interface ParallaxElement {
3525
3578
  element: HTMLElement;
3526
3579
  speed: number;
3527
3580
  }
3528
- export interface SpringAnimationConfigTest {
3529
- name: string;
3581
+ export interface SpringAnimationConfigTest extends Named {
3530
3582
  tension: number;
3531
3583
  friction: number;
3532
3584
  mass: number;
@@ -3566,8 +3618,7 @@ export interface EnvironmentHooks {
3566
3618
  getManager: () => EnvironmentManager;
3567
3619
  useEnvironment: (env: EnvironmentConfig) => void;
3568
3620
  }
3569
- export interface EnvironmentValidationTestCase {
3570
- name: string;
3621
+ export interface EnvironmentValidationTestCase extends Named {
3571
3622
  environment: EnvironmentConfig;
3572
3623
  shouldPass: boolean;
3573
3624
  expectedErrors?: string[];
@@ -3578,49 +3629,39 @@ export interface EnvironmentFeatureFlagScenario {
3578
3629
  defaultValue?: boolean;
3579
3630
  expectedValue: boolean;
3580
3631
  }
3581
- export interface DatabaseEnvironmentTest {
3582
- name: string;
3632
+ export interface DatabaseEnvironmentTest extends Named {
3583
3633
  environment: EnvironmentConfig;
3584
- expectedConfig: Record<string, unknown>;
3634
+ expectedConfig: UnknownRecord;
3585
3635
  shouldConnect: boolean;
3586
3636
  }
3587
- export interface LoggingEnvironmentTest {
3588
- name: string;
3637
+ export interface LoggingEnvironmentTest extends Named {
3589
3638
  environment: EnvironmentConfig;
3590
3639
  expectedLevel: string;
3591
3640
  expectedFormat?: string;
3592
3641
  expectedTransports?: string[];
3593
3642
  }
3594
- export interface APIClientEnvironmentTest {
3595
- name: string;
3643
+ export interface APIClientEnvironmentTest extends Named {
3596
3644
  environment: EnvironmentConfig;
3597
3645
  expectedBaseURL: string;
3598
3646
  expectedTimeout: number;
3599
3647
  expectedHeaders?: Record<string, string>;
3600
3648
  }
3601
- export interface SecretsManagementTest {
3602
- name: string;
3649
+ export interface SecretsManagementTest extends Named {
3603
3650
  environment: EnvironmentConfig;
3604
3651
  secrets: Record<string, string>;
3605
3652
  expectedBehavior: 'store' | 'mock' | 'error';
3606
3653
  }
3607
- export interface SecretsManager {
3608
- get: (key: string) => Promise<string | undefined>;
3609
- set: (key: string, value: string) => Promise<void>;
3610
- delete: (key: string) => Promise<void>;
3654
+ export interface SecretsManager extends KeyValueStore<string, string> {
3611
3655
  }
3612
- export interface MockEnvironment {
3656
+ export interface MockEnvironment extends KeyValueStore<string, string> {
3613
3657
  update: (updates: EnvironmentConfig) => void;
3614
- get: (key: string) => string | undefined;
3615
- set: (key: string, value: string) => void;
3616
3658
  unset: (key: string) => void;
3617
3659
  restore: () => void;
3618
3660
  getAll: () => EnvironmentConfig;
3619
- clear: () => void;
3620
3661
  }
3621
3662
  export interface EnvironmentTransformationTestCase {
3622
3663
  input: EnvironmentConfig;
3623
- expectedOutput: Record<string, unknown>;
3664
+ expectedOutput: UnknownRecord;
3624
3665
  description: string;
3625
3666
  }
3626
3667
  export interface UserInteraction {
@@ -3640,7 +3681,7 @@ export interface AccessibilityReport {
3640
3681
  }
3641
3682
  export interface MockNextNavigationOptions {
3642
3683
  pathname?: string;
3643
- searchParams?: Record<string, string | string[]>;
3684
+ searchParams?: Record<string, Arrayable<string>>;
3644
3685
  push?: ReturnType<typeof Vitest.vi.fn>;
3645
3686
  replace?: ReturnType<typeof Vitest.vi.fn>;
3646
3687
  refresh?: ReturnType<typeof Vitest.vi.fn>;
@@ -3648,13 +3689,12 @@ export interface MockNextNavigationOptions {
3648
3689
  forward?: ReturnType<typeof Vitest.vi.fn>;
3649
3690
  }
3650
3691
  export interface SRTestOptions {
3651
- initialProps: Record<string, unknown>;
3692
+ initialProps: UnknownRecord;
3652
3693
  revalidate: number;
3653
- newProps: Record<string, unknown>;
3694
+ newProps: UnknownRecord;
3654
3695
  waitTime?: number;
3655
3696
  }
3656
- export interface ApiRouteTestScenario {
3657
- name: string;
3697
+ export interface ApiRouteTestScenario extends Named {
3658
3698
  request: Partial<MockNextApiRequest>;
3659
3699
  expectedStatus: number;
3660
3700
  expectedBody?: unknown;
@@ -3682,17 +3722,15 @@ export interface ApiAuthScenario {
3682
3722
  expectedStatus: number;
3683
3723
  expectedMessage?: string;
3684
3724
  }
3685
- export interface ApiRouteOptions {
3725
+ export interface ApiRouteOptions extends Partial<WithUrl> {
3686
3726
  method?: string;
3687
- url?: string;
3688
- headers?: Record<string, string | string[]>;
3689
- query?: Record<string, string | string[]>;
3727
+ headers?: Record<string, Arrayable<string>>;
3728
+ query?: Record<string, Arrayable<string>>;
3690
3729
  body?: unknown;
3691
3730
  cookies?: Record<string, string>;
3692
3731
  }
3693
- export interface ServerComponentTestScenario {
3694
- name: string;
3695
- props: Record<string, unknown>;
3732
+ export interface ServerComponentTestScenario extends Named {
3733
+ props: UnknownRecord;
3696
3734
  searchParams?: Record<string, string>;
3697
3735
  params?: Record<string, string>;
3698
3736
  expectedContent?: string | RegExp;
@@ -3709,7 +3747,7 @@ export interface ServerComponentTestScenario {
3709
3747
  * ```
3710
3748
  */
3711
3749
  export interface MiddlewareMatcherConfig {
3712
- matcher: string | string[];
3750
+ matcher: Arrayable<string>;
3713
3751
  }
3714
3752
  /**
3715
3753
  * Result from mocking Next.js navigation.
@@ -3843,7 +3881,7 @@ export interface ComponentWithLoading {
3843
3881
  * ```
3844
3882
  */
3845
3883
  export interface ConditionalRenderingTest {
3846
- props: Record<string, unknown>;
3884
+ props: UnknownRecord;
3847
3885
  shouldRender: string[];
3848
3886
  shouldNotRender: string[];
3849
3887
  }
@@ -3864,7 +3902,7 @@ export interface ProviderConfig {
3864
3902
  children: React.ReactNode;
3865
3903
  [key: string]: unknown;
3866
3904
  }>;
3867
- props?: Record<string, unknown>;
3905
+ props?: UnknownRecord;
3868
3906
  }
3869
3907
  /**
3870
3908
  * Test case for user interactions.
@@ -3879,8 +3917,7 @@ export interface ProviderConfig {
3879
3917
  * };
3880
3918
  * ```
3881
3919
  */
3882
- export interface UserInteractionTest {
3883
- name: string;
3920
+ export interface UserInteractionTest extends Named {
3884
3921
  action: (user: unknown) => Promise<void>;
3885
3922
  expectation: () => void;
3886
3923
  }
@@ -3934,8 +3971,7 @@ export interface ComponentTestSuiteResult {
3934
3971
  * };
3935
3972
  * ```
3936
3973
  */
3937
- export interface ResourceCleanupTest {
3938
- name: string;
3974
+ export interface ResourceCleanupTest extends Named {
3939
3975
  create: () => unknown;
3940
3976
  cleanup: (resource: unknown) => Promise<void> | void;
3941
3977
  isCleanedUp: (resource: unknown) => boolean;
@@ -3956,7 +3992,7 @@ export interface ResourceCleanupTest {
3956
3992
  export interface DependencyInjectionContainer {
3957
3993
  register: (token: unknown, factory: () => unknown, options: {
3958
3994
  lifecycle: 'singleton' | 'transient' | 'scoped';
3959
- dependencies?: unknown[];
3995
+ dependencies?: UnknownArray;
3960
3996
  }) => void;
3961
3997
  resolve: (token: unknown) => unknown;
3962
3998
  dispose: () => Promise<void>;
@@ -3979,7 +4015,7 @@ export interface DependencyInjectionContainer {
3979
4015
  export interface DependencyInjectionConfig {
3980
4016
  token: unknown;
3981
4017
  factory: () => unknown;
3982
- dependencies?: unknown[];
4018
+ dependencies?: UnknownArray;
3983
4019
  lifecycle: 'singleton' | 'transient' | 'scoped';
3984
4020
  cleanup?: (instance: unknown) => void;
3985
4021
  }
@@ -3998,10 +4034,8 @@ export interface DependencyInjectionConfig {
3998
4034
  * };
3999
4035
  * ```
4000
4036
  */
4001
- export interface AsyncLifecycleHook {
4002
- name: string;
4037
+ export interface AsyncLifecycleHook extends Named, Partial<WithTimeout> {
4003
4038
  method: string;
4004
- timeout?: number;
4005
4039
  shouldReject?: boolean;
4006
4040
  expectedError?: string | RegExp;
4007
4041
  }
@@ -4085,26 +4119,26 @@ export interface MockIntersectionObserverEntry {
4085
4119
  intersectionRatio: number;
4086
4120
  boundingClientRect: DOMRect;
4087
4121
  }
4088
- export type ConfigObject = Record<string, unknown>;
4122
+ export type ConfigObject = UnknownRecord;
4089
4123
  export type ConfigLoader = (env: string) => unknown;
4090
4124
  export type EnvironmentTransformer = (env: EnvironmentConfig) => ConfigObject;
4091
4125
  export type KeyboardUserInteraction = Pick<UserInteraction, 'keyboard'>;
4092
4126
  export type FocusUserInteraction = Required<Pick<UserInteraction, 'keyboard' | 'tab'>>;
4093
4127
  export type SkipLinkUserInteraction = Required<Pick<UserInteraction, 'click' | 'tab'>>;
4094
4128
  export type AccessibilityAttributesMap = Record<string, string>;
4095
- export type TestParameters = Record<string, unknown>;
4096
- export type TestMatrixInputs<T extends Record<string, unknown[]>> = {
4129
+ export type TestParameters = UnknownRecord;
4130
+ export type TestMatrixInputs<T extends Record<string, UnknownArray>> = {
4097
4131
  [K in keyof T]: T[K][];
4098
4132
  };
4099
- export type TestMatrixCombination<T extends Record<string, unknown[]>> = {
4133
+ export type TestMatrixCombination<T extends Record<string, UnknownArray>> = {
4100
4134
  [K in keyof T]: T[K][number];
4101
4135
  };
4102
- export type PartialTestMatrixCombination<T extends Record<string, unknown[]>> = Partial<{
4136
+ export type PartialTestMatrixCombination<T extends Record<string, UnknownArray>> = Partial<{
4103
4137
  [K in keyof T]: T[K][number];
4104
4138
  }>;
4105
- export type PropertyTestFunction<T> = (value: T) => boolean | Promise<boolean>;
4139
+ export type PropertyTestFunction<T> = (value: T) => Promisable<boolean>;
4106
4140
  export type StateTransitionApplyFunction<TState, TAction> = (state: TState, action: TAction) => TState;
4107
- export type CombinationTestFunction<T extends Record<string, unknown[]>> = (combination: TestCombination<T>) => void | Promise<void>;
4141
+ export type CombinationTestFunction<T extends Record<string, UnknownArray>> = (combination: TestCombination<T>) => Promisable<void>;
4108
4142
  export type UnknownFunction = (...args: unknown[]) => unknown;
4109
4143
  /**
4110
4144
  * Configuration for spy target.
@@ -4141,9 +4175,8 @@ export type ModuleMockFactories = Record<string, () => UnknownRecord>;
4141
4175
  * };
4142
4176
  * ```
4143
4177
  */
4144
- export interface TestCaseWithSetup<T> {
4145
- name: string;
4146
- args: unknown[];
4178
+ export interface TestCaseWithSetup<T> extends Named {
4179
+ args: UnknownArray;
4147
4180
  expected: unknown;
4148
4181
  setup?: (instance: T) => void;
4149
4182
  }
@@ -4163,8 +4196,7 @@ export interface TestCaseWithSetup<T> {
4163
4196
  * };
4164
4197
  * ```
4165
4198
  */
4166
- export interface LifecycleHookTestConfig<T> {
4167
- name: string;
4199
+ export interface LifecycleHookTestConfig<T> extends Named {
4168
4200
  hook: keyof T;
4169
4201
  expectedCalls?: number;
4170
4202
  expectError?: boolean;
@@ -4187,7 +4219,7 @@ export interface LifecycleHookTestConfig<T> {
4187
4219
  */
4188
4220
  export interface ErrorHandlingScenario<T> {
4189
4221
  method: keyof T;
4190
- args: unknown[];
4222
+ args: UnknownArray;
4191
4223
  expectedError: string | RegExp | typeof Error;
4192
4224
  setup?: (instance: T) => void;
4193
4225
  }
@@ -4370,7 +4402,7 @@ export interface ServiceTestHarnessReturn<T> {
4370
4402
  * ```
4371
4403
  */
4372
4404
  export interface DynamicModuleClass {
4373
- forRoot: (config: unknown) => Record<string, unknown>;
4405
+ forRoot: (config: unknown) => UnknownRecord;
4374
4406
  }
4375
4407
  /**
4376
4408
  * Expectations for dynamic module testing.
@@ -4386,9 +4418,9 @@ export interface DynamicModuleClass {
4386
4418
  * ```
4387
4419
  */
4388
4420
  export interface DynamicModuleExpectations {
4389
- providers?: unknown[];
4390
- imports?: unknown[];
4391
- exports?: unknown[];
4421
+ providers?: UnknownArray;
4422
+ imports?: UnknownArray;
4423
+ exports?: UnknownArray;
4392
4424
  }
4393
4425
  /**
4394
4426
  * Return value from NestJS test suite setup.
@@ -4424,8 +4456,8 @@ export interface NestJSTestSuiteSetupReturn {
4424
4456
  */
4425
4457
  export interface ProviderInjectionTest {
4426
4458
  token: unknown;
4427
- dependencies: unknown[];
4428
- testFn: (instance: unknown, deps: unknown[]) => void;
4459
+ dependencies: UnknownArray;
4460
+ testFn: (instance: unknown, deps: UnknownArray) => void;
4429
4461
  }
4430
4462
  /**
4431
4463
  * WebSocket ping message.
@@ -4524,10 +4556,9 @@ export interface ImageLoaderInput {
4524
4556
  * };
4525
4557
  * ```
4526
4558
  */
4527
- export interface UserFlowStep {
4528
- name: string;
4559
+ export interface UserFlowStep extends Named {
4529
4560
  interactions: InteractionSequence[];
4530
- assertions: () => void | Promise<void>;
4561
+ assertions: () => Promisable<void>;
4531
4562
  navigation?: {
4532
4563
  expectedUrl?: string;
4533
4564
  waitForNavigation?: boolean;
@@ -4576,8 +4607,8 @@ export interface MockNextRequestCreatorParams {
4576
4607
  */
4577
4608
  export interface ProviderInjection {
4578
4609
  token: unknown;
4579
- dependencies: unknown[];
4580
- testFn: (instance: unknown, deps: unknown[]) => void;
4610
+ dependencies: UnknownArray;
4611
+ testFn: (instance: unknown, deps: UnknownArray) => void;
4581
4612
  }
4582
4613
  /**
4583
4614
  * Mock Redis client interface.
@@ -4621,10 +4652,10 @@ export interface CreateMockRedisClientMock {
4621
4652
  * ```
4622
4653
  */
4623
4654
  export interface CallTracker {
4624
- trackCall: (name: string, args: unknown[]) => void;
4655
+ trackCall: (name: string, args: UnknownArray) => void;
4625
4656
  getCalls: (name?: string) => Array<{
4626
4657
  name: string;
4627
- args: unknown[];
4658
+ args: UnknownArray;
4628
4659
  timestamp: number;
4629
4660
  }>;
4630
4661
  reset: () => void;
@@ -4648,7 +4679,7 @@ export interface CallTracker {
4648
4679
  export interface TrackedSpy extends SpyInstance {
4649
4680
  getCallCount: () => number;
4650
4681
  getCallHistory: () => Array<{
4651
- args: unknown[];
4682
+ args: UnknownArray;
4652
4683
  result?: unknown;
4653
4684
  error?: unknown;
4654
4685
  }>;
@@ -4697,9 +4728,8 @@ export interface TrackedData<T> {
4697
4728
  * };
4698
4729
  * ```
4699
4730
  */
4700
- export interface AccessInfo {
4731
+ export interface AccessInfo extends WithTimestamp<number> {
4701
4732
  property: string | symbol;
4702
- timestamp: number;
4703
4733
  count: number;
4704
4734
  }
4705
4735
  /**
@@ -4871,8 +4901,8 @@ export interface WorkerTestHarness {
4871
4901
  * ```
4872
4902
  */
4873
4903
  export interface WorkerSpy {
4874
- getMessagesSent: () => unknown[];
4875
- getMessagesReceived: () => unknown[];
4904
+ getMessagesSent: () => UnknownArray;
4905
+ getMessagesReceived: () => UnknownArray;
4876
4906
  getErrors: () => Error[];
4877
4907
  isTerminated: () => boolean;
4878
4908
  simulateMessage: (message: unknown) => void;
@@ -5036,7 +5066,7 @@ export interface MonitorOptions {
5036
5066
  * };
5037
5067
  * ```
5038
5068
  */
5039
- export interface PerformanceMonitor {
5069
+ export interface PerformanceMonitor extends Resettable {
5040
5070
  start: () => void;
5041
5071
  stop: () => void;
5042
5072
  getMetrics: () => {
@@ -5044,7 +5074,6 @@ export interface PerformanceMonitor {
5044
5074
  memory?: number[];
5045
5075
  timestamps: number[];
5046
5076
  };
5047
- reset: () => void;
5048
5077
  }
5049
5078
  /**
5050
5079
  * Options for memory leak testing.
@@ -5103,10 +5132,9 @@ export interface LeakResult {
5103
5132
  * };
5104
5133
  * ```
5105
5134
  */
5106
- export interface HookScenario {
5107
- name: string;
5108
- action: () => void | Promise<void>;
5109
- expectedState: Record<string, unknown>;
5135
+ export interface HookScenario extends Named {
5136
+ action: () => Promisable<void>;
5137
+ expectedState: UnknownRecord;
5110
5138
  expectedError?: Error | null;
5111
5139
  }
5112
5140
  /**
@@ -5131,10 +5159,9 @@ export interface SuspenseOptions {
5131
5159
  * Concurrent rendering scenario
5132
5160
  * @interface ConcurrentScenario
5133
5161
  */
5134
- export interface ConcurrentScenario {
5135
- name: string;
5162
+ export interface ConcurrentScenario extends Named {
5136
5163
  priority: 'high' | 'low' | 'normal';
5137
- action: () => void | Promise<void>;
5164
+ action: () => Promisable<void>;
5138
5165
  expectedBehavior: () => void;
5139
5166
  }
5140
5167
  /**
@@ -5152,10 +5179,7 @@ export interface A11yOptions {
5152
5179
  * Accessibility violation
5153
5180
  * @interface A11yViolation
5154
5181
  */
5155
- export interface A11yViolation {
5156
- id: string;
5157
- impact?: 'minor' | 'moderate' | 'serious' | 'critical';
5158
- description: string;
5182
+ export interface A11yViolation extends Identifiable, Describable, Partial<WithImpact> {
5159
5183
  help: string;
5160
5184
  helpUrl: string;
5161
5185
  nodes: Array<{
@@ -5229,31 +5253,26 @@ export interface ContrastResult {
5229
5253
  * User session options
5230
5254
  * @interface SessionOptions
5231
5255
  */
5232
- export interface SessionOptions {
5233
- userId?: string;
5256
+ export interface SessionOptions extends Partial<WithUserId & WithLocale> {
5234
5257
  deviceType?: 'desktop' | 'mobile' | 'tablet';
5235
5258
  browser?: string;
5236
5259
  viewport?: {
5237
5260
  width: number;
5238
5261
  height: number;
5239
5262
  };
5240
- locale?: string;
5241
5263
  timezone?: string;
5242
5264
  }
5243
5265
  /**
5244
5266
  * User event session
5245
5267
  * @interface UserSession
5246
5268
  */
5247
- export interface UserSession {
5248
- id: string;
5249
- userId: string;
5269
+ export interface UserSession extends Identifiable, WithLocale, WithUserId {
5250
5270
  deviceType: 'desktop' | 'mobile' | 'tablet';
5251
5271
  browser: string;
5252
5272
  viewport: {
5253
5273
  width: number;
5254
5274
  height: number;
5255
5275
  };
5256
- locale: string;
5257
5276
  timezone: string;
5258
5277
  startTime: Date;
5259
5278
  interactions: Interaction[];
@@ -5283,8 +5302,7 @@ export interface TypeOptions {
5283
5302
  * Drag options
5284
5303
  * @interface DragOptions
5285
5304
  */
5286
- export interface DragOptions {
5287
- duration?: number;
5305
+ export interface DragOptions extends Partial<WithDuration> {
5288
5306
  steps?: number;
5289
5307
  dropEffect?: 'move' | 'copy' | 'link' | 'none';
5290
5308
  }
@@ -5325,24 +5343,20 @@ export type TouchGestureAdvanced = {
5325
5343
  * User interaction record
5326
5344
  * @interface Interaction
5327
5345
  */
5328
- export interface Interaction {
5329
- timestamp: Date;
5346
+ export interface Interaction extends WithTimestamp<Date>, WithDuration {
5330
5347
  type: string;
5331
5348
  target: string;
5332
5349
  data?: unknown;
5333
- duration?: number;
5334
5350
  }
5335
5351
  /**
5336
5352
  * Swipe gesture parameters
5337
5353
  * @interface SwipeGestureParams
5338
5354
  */
5339
- export interface SwipeGestureParams {
5340
- element: Element;
5355
+ export interface SwipeGestureParams extends WithElement<Element>, WithDuration {
5341
5356
  startX: number;
5342
5357
  startY: number;
5343
5358
  endX: number;
5344
5359
  endY: number;
5345
- duration: number;
5346
5360
  }
5347
5361
  /**
5348
5362
  * Pinch gesture parameters
@@ -5359,8 +5373,7 @@ export interface PinchGestureParams {
5359
5373
  * Animation frame data
5360
5374
  * @interface Frame
5361
5375
  */
5362
- export interface Frame {
5363
- timestamp: number;
5376
+ export interface Frame extends WithTimestamp<number> {
5364
5377
  styles: Record<string, string>;
5365
5378
  }
5366
5379
  /**
@@ -5395,9 +5408,7 @@ export interface RAFMock {
5395
5408
  * Interval handle
5396
5409
  * @interface IntervalHandle
5397
5410
  */
5398
- export interface IntervalHandle {
5399
- stop: () => void;
5400
- isRunning: () => boolean;
5411
+ export interface IntervalHandle extends Pick<IntervalControl, 'stop' | 'isRunning'> {
5401
5412
  }
5402
5413
  /**
5403
5414
  * Schedule handle
@@ -5480,25 +5491,24 @@ export interface MockLocation {
5480
5491
  * @interface RouteExpectation
5481
5492
  */
5482
5493
  export interface RouteExpectation {
5483
- params?: Record<string, string | string[]>;
5484
- query?: Record<string, string | string[]>;
5485
- beforeTransition?: () => void | Promise<void>;
5486
- afterTransition?: () => void | Promise<void>;
5494
+ params?: Record<string, Arrayable<string>>;
5495
+ query?: Record<string, Arrayable<string>>;
5496
+ beforeTransition?: () => Promisable<void>;
5497
+ afterTransition?: () => Promisable<void>;
5487
5498
  }
5488
5499
  /**
5489
5500
  * Route guard configuration
5490
5501
  * @interface RouteGuard
5491
5502
  */
5492
5503
  export interface RouteGuard {
5493
- canActivate?: (to: string, from: string) => boolean | Promise<boolean>;
5494
- canDeactivate?: (from: string, to: string) => boolean | Promise<boolean>;
5504
+ canActivate?: (to: string, from: string) => Promisable<boolean>;
5505
+ canDeactivate?: (from: string, to: string) => Promisable<boolean>;
5495
5506
  }
5496
5507
  /**
5497
5508
  * Guard scenario for testing
5498
5509
  * @interface GuardScenario
5499
5510
  */
5500
- export interface GuardScenario {
5501
- name: string;
5511
+ export interface GuardScenario extends Named {
5502
5512
  from: string;
5503
5513
  to: string;
5504
5514
  shouldAllow: boolean;
@@ -5540,7 +5550,7 @@ export interface NextTestContext {
5540
5550
  */
5541
5551
  export interface SSPContext extends Partial<MockGetServerSidePropsContext> {
5542
5552
  scenario?: string;
5543
- expectedProps?: Record<string, unknown>;
5553
+ expectedProps?: UnknownRecord;
5544
5554
  expectedRedirect?: {
5545
5555
  destination: string;
5546
5556
  permanent?: boolean;
@@ -5553,7 +5563,7 @@ export interface SSPContext extends Partial<MockGetServerSidePropsContext> {
5553
5563
  */
5554
5564
  export interface SPContext extends Partial<MockGetStaticPropsContext> {
5555
5565
  scenario?: string;
5556
- expectedProps?: Record<string, unknown>;
5566
+ expectedProps?: UnknownRecord;
5557
5567
  expectedRevalidate?: number;
5558
5568
  expectedRedirect?: {
5559
5569
  destination: string;
@@ -5565,12 +5575,8 @@ export interface SPContext extends Partial<MockGetStaticPropsContext> {
5565
5575
  * API request test configuration
5566
5576
  * @interface APIRequest
5567
5577
  */
5568
- export interface APIRequest {
5578
+ export interface APIRequest extends Partial<WithHttpMethod>, Partial<WithHeaders>, Partial<WithBody>, Partial<WithQueryParams> {
5569
5579
  scenario?: string;
5570
- method?: string;
5571
- headers?: Record<string, string>;
5572
- body?: unknown;
5573
- query?: Record<string, string>;
5574
5580
  cookies?: Record<string, string>;
5575
5581
  expectedStatus?: number;
5576
5582
  expectedBody?: unknown;
@@ -5580,23 +5586,21 @@ export interface APIRequest {
5580
5586
  * Lifecycle testing scenario
5581
5587
  * @interface LifecycleScenario
5582
5588
  */
5583
- export interface LifecycleScenario {
5584
- name: string;
5585
- action: () => void | Promise<void>;
5586
- expectedState?: Record<string, unknown>;
5589
+ export interface LifecycleScenario extends Named {
5590
+ action: () => Promisable<void>;
5591
+ expectedState?: UnknownRecord;
5587
5592
  expectedEvents?: string[];
5588
5593
  }
5589
5594
  /**
5590
5595
  * Lifecycle event tracker
5591
5596
  * @interface LifecycleTracker
5592
5597
  */
5593
- export interface LifecycleTracker {
5598
+ export interface LifecycleTracker extends Clearable {
5594
5599
  events: Array<{
5595
5600
  type: string;
5596
5601
  timestamp: number;
5597
5602
  data?: unknown;
5598
5603
  }>;
5599
- clear: () => void;
5600
5604
  getEvents: () => Array<{
5601
5605
  type: string;
5602
5606
  timestamp: number;
@@ -5680,9 +5684,8 @@ export interface EnvMock {
5680
5684
  * Environment snapshot
5681
5685
  * @interface EnvSnapshot
5682
5686
  */
5683
- export interface EnvSnapshot {
5687
+ export interface EnvSnapshot extends WithKeyValues<string | undefined>, WithTimestamp<number> {
5684
5688
  variables: Record<string, string | undefined>;
5685
- timestamp: number;
5686
5689
  }
5687
5690
  /**
5688
5691
  * System signal type
@@ -5693,13 +5696,13 @@ export type Signal = 'SIGTERM' | 'SIGINT' | 'SIGHUP' | 'SIGUSR1' | 'SIGUSR2';
5693
5696
  * Signal handler function
5694
5697
  * @type SignalHandler
5695
5698
  */
5696
- export type SignalHandler = (signal: Signal) => void | Promise<void>;
5699
+ export type SignalHandler = (signal: Signal) => Promisable<void>;
5697
5700
  /**
5698
5701
  * Component type for lifecycle testing
5699
5702
  * @type ComponentType
5700
5703
  * @typeParam P - Props type
5701
5704
  */
5702
- export type ComponentType<P = Record<string, unknown>> = new (props: P) => React.Component<P>;
5705
+ export type ComponentType<P = UnknownRecord> = new (props: P) => React.Component<P>;
5703
5706
  /**
5704
5707
  * Next.js Get Server-Side Props function
5705
5708
  * @type GSSP
@@ -5743,7 +5746,7 @@ export interface PipelineResult {
5743
5746
  export interface ModuleMocks {
5744
5747
  restore: () => void;
5745
5748
  getCallCount: (moduleName: string) => number;
5746
- getLastCall: (moduleName: string) => unknown[];
5749
+ getLastCall: (moduleName: string) => UnknownArray;
5747
5750
  }
5748
5751
  /**
5749
5752
  * Async hook interface
@@ -5755,3 +5758,67 @@ export interface AsyncHook {
5755
5758
  after?: (asyncId: number) => void;
5756
5759
  destroy?: (asyncId: number) => void;
5757
5760
  }
5761
+ /**
5762
+ * JSON parsing options for safe parsing
5763
+ */
5764
+ export interface JSONParseOptions {
5765
+ /**
5766
+ * Custom reviver function
5767
+ * @remarks Called after prototype pollution filtering
5768
+ */
5769
+ reviver?: (key: string, value: unknown) => unknown;
5770
+ /**
5771
+ * Allow parsing of Date strings
5772
+ * @default false
5773
+ */
5774
+ parseDates?: boolean;
5775
+ /**
5776
+ * Additional keys to filter out during parsing
5777
+ * @default []
5778
+ */
5779
+ filterKeys?: string[];
5780
+ }
5781
+ /**
5782
+ * JSON stringify options for safe stringification
5783
+ */
5784
+ export interface JSONStringifyOptions {
5785
+ /**
5786
+ * Indentation (number of spaces or string)
5787
+ */
5788
+ space?: string | number;
5789
+ /**
5790
+ * Custom replacer function
5791
+ */
5792
+ replacer?: (key: string, value: unknown) => unknown;
5793
+ /**
5794
+ * Custom circular reference placeholder
5795
+ * @default "[Circular]"
5796
+ */
5797
+ circularPlaceholder?: string;
5798
+ /**
5799
+ * Maximum depth for nested objects
5800
+ * @default Infinity
5801
+ */
5802
+ maxDepth?: number;
5803
+ }
5804
+ /**
5805
+ * JSON utilities interface
5806
+ */
5807
+ export interface JSONUtils {
5808
+ /**
5809
+ * Safely parse JSON with prototype pollution prevention
5810
+ */
5811
+ parse(json: string, options?: JSONParseOptions): unknown;
5812
+ /**
5813
+ * Safely stringify objects handling circular references
5814
+ */
5815
+ stringify(obj: unknown, options?: JSONStringifyOptions | string | number): string;
5816
+ /**
5817
+ * Check if a string is valid JSON
5818
+ */
5819
+ isValid?(json: string): boolean;
5820
+ /**
5821
+ * Deep clone an object using JSON
5822
+ */
5823
+ clone?<T>(obj: T): T;
5824
+ }