@@ -12,11 +12,9 @@ export interface ArrayPaginationResult<T extends Array<any>>
12
12
result: Readonly <Ref <T >>;
13
13
}
14
14
15
- // Warning: (ae-forgotten-export) The symbol "i18nDefinition" needs to be exported by the entry point index.d.ts
16
- // Warning: (ae-forgotten-export) The symbol "i18nResult" needs to be exported by the entry point index.d.ts
17
15
// Warning: (ae-forgotten-export) The symbol "I18nExtractLocale" needs to be exported by the entry point index.d.ts
18
16
//
19
- // @public (undocumented)
17
+ // @public
20
18
export function buildI18n<
21
19
T extends i18nDefinition <TMessage >,
22
20
TMessage extends Record <keyof T [" messages" ], i18n | (() => Promise <any >)>
@@ -68,11 +66,60 @@ export type FormatValue =
68
66
| RefTyped <string >
69
67
| RefTyped <number >;
70
68
71
- // Warning: (ae-forgotten-export) The symbol "i18nMessageValue" needs to be exported by the entry point index.d.ts
72
- //
73
- // @public (undocumented)
69
+ // @public
74
70
export interface i18n extends Record <string , i18nMessageValue > {}
75
71
72
+ // @public
73
+ export interface i18nDefinition <TMessage > {
74
+ fallback? : keyof TMessage ;
75
+ locale: keyof TMessage ;
76
+ messages: {
77
+ [K in keyof TMessage ]: i18n | (() => Promise <i18n >) | (() => i18n );
78
+ };
79
+ notFoundFallback? : boolean ;
80
+ resolve? : i18nResolver ;
81
+ }
82
+
83
+ // @public
84
+ export type i18nLocale <T > = {
85
+ [K in keyof T ]: i18nMessage <T [K ]>;
86
+ };
87
+
88
+ // @public
89
+ export type i18nMessage <T > = T extends Ref <string >
90
+ ? string
91
+ : T extends () => Promise <infer P >
92
+ ? i18nLocale <P >
93
+ : T extends (... args : infer TArgs ) => RefTyped <string >
94
+ ? (... args : TArgs ) => string
95
+ : T extends object
96
+ ? i18nLocale <T >
97
+ : T extends Ref <infer V >
98
+ ? V
99
+ : T ;
100
+
101
+ // @public
102
+ export type i18nMessageValue = i18nLocale <any > | RefTyped <string >;
103
+
104
+ // @public
105
+ export type i18nResolver = (
106
+ i18n : i18n ,
107
+ path : Readonly <RefTyped <string >>,
108
+ args : RefTyped <FormatObject > | Array <FormatValue > | undefined
109
+ ) => RefTyped <string >;
110
+
111
+ // @public
112
+ export interface i18nResult <TLocales , TMessages extends any = i18n > {
113
+ $t(path : string , args ? : object | Array <object >): Readonly <Ref <string >>;
114
+ $ts(path : string , args ? : object | Array <object >): string ;
115
+ // (undocumented)
116
+ addLocale(locale : string , messages : TMessages ): void ;
117
+ i18n: Readonly <Ref <Readonly <TMessages >>>;
118
+ locale: Ref <TLocales >;
119
+ locales: Readonly <Ref <Readonly <Array <TLocales >>>>;
120
+ removeLocale(locale : TLocales ): void ;
121
+ }
122
+
76
123
// @public (undocumented)
77
124
export const isArray: (arg : any ) => arg is any [];
78
125
@@ -126,38 +173,27 @@ export type Options = {
126
173
isImmediate: boolean ;
127
174
};
128
175
129
- // @public (undocumented)
176
+ // @public
177
+ export type PaginationControl = () => void ;
178
+
179
+ // @public
130
180
export interface PaginationOptions {
131
- // (undocumented)
132
181
currentPage: RefTyped <number >;
133
- // (undocumented)
134
182
pageSize: RefTyped <number >;
135
- // (undocumented)
136
183
total: RefTyped <number >;
137
184
}
138
185
139
- // @public (undocumented)
186
+ // @public
140
187
export interface PaginationResult {
141
- // (undocumented)
142
188
currentPage: Ref <number >;
143
- // (undocumented)
144
189
first: PaginationControl ;
145
- // (undocumented)
146
190
last: PaginationControl ;
147
- // (undocumented)
148
191
lastPage: Readonly <Ref <number >>;
149
- // Warning: (ae-forgotten-export) The symbol "PaginationControl" needs to be exported by the entry point index.d.ts
150
- //
151
- // (undocumented)
152
192
next: PaginationControl ;
153
- // (undocumented)
154
193
offset: Ref <number >;
155
- // (undocumented)
156
194
pageSize: Ref <number >;
157
- // (undocumented)
158
195
prev: PaginationControl ;
159
- // (undocumented)
160
- total: Ref <number >;
196
+ total: Readonly <Ref <Readonly <number >>>;
161
197
}
162
198
163
199
// @public (undocumented)
@@ -207,7 +243,7 @@ export interface RetryReturnNoFactory extends RetryReturn {
207
243
exec<T >(fn : () => T ): T ;
208
244
}
209
245
210
- // @public (undocumented)
246
+ // @public
211
247
export function setI18n<
212
248
T extends i18nDefinition <TMessage >,
213
249
TMessage extends Record <keyof T [" messages" ], i18n | (() => Promise <any >)>
@@ -330,7 +366,7 @@ export function useDebounce<T extends Procedure>(
330
366
options ? : Options
331
367
): T ;
332
368
333
- // @public (undocumented)
369
+ // @public
334
370
export function useFormat(
335
371
format : RefTyped <Readonly <string >>,
336
372
obj ? : RefTyped <FormatObject >
@@ -342,7 +378,7 @@ export function useFormat(
342
378
obj ? : RefTyped <FormatObject >
343
379
): Readonly <Ref <string >>;
344
380
345
- // @public (undocumented)
381
+ // @public
346
382
export function useFormat(
347
383
format : Readonly <RefTyped <string >>,
348
384
... args : Array <FormatValue >
@@ -360,13 +396,13 @@ export function useFormat(
360
396
args : any
361
397
): Readonly <Ref <string >>;
362
398
363
- // @public (undocumented)
399
+ // @public
364
400
export function useI18n<
365
401
T extends i18nDefinition <TMessage >,
366
402
TMessage extends Record <keyof T [" messages" ], i18n | (() => Promise <any >)>
367
403
>(definition : T ): i18nResult <keyof T [" messages" ], T [" messages" ][T [" locale" ]]>;
368
404
369
- // @public (undocumented)
405
+ // @public
370
406
export function useI18n<T = i18n >(): i18nResult <string [], T >;
371
407
372
408
// @public
@@ -382,24 +418,24 @@ export interface UseNowOptions {
382
418
timeFn? : () => number ;
383
419
}
384
420
385
- // @public (undocumented)
421
+ // @public
386
422
export function usePagination(options : PaginationOptions ): PaginationResult ;
387
423
388
- // @public (undocumented)
389
- export function usePath<T = any >(
390
- source : RefTyped <object >,
424
+ // @public
425
+ export function usePath<T = any , TSource = any >(
426
+ source : RefTyped <TSource >,
391
427
path : RefTyped <string >,
392
428
separator ? : string ,
393
- notFoundReturn ? : UsePathNotFoundReturn
429
+ notFoundReturn ? : UsePathNotFoundReturn < TSource >
394
430
): Ref <Readonly <T >>;
395
431
396
432
// @public (undocumented)
397
- export type UsePathNotFoundReturn <T = any > = (
433
+ export type UsePathNotFoundReturn <TSource > = (
398
434
path : string ,
399
435
source : any ,
400
436
fullPath : string ,
401
- originalSource : any
402
- ) => T ;
437
+ originalSource : TSource
438
+ ) => any ;
403
439
404
440
// @public
405
441
export function usePerformanceNow(
0 commit comments