File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -277,4 +277,23 @@ export function processData(data: unknown): unknown {
277
277
return data
278
278
}
279
279
280
+ // 5. Nested Object Types with Methods
281
+ export const complexObject = {
282
+ handlers : {
283
+ async onSuccess < T > ( data : T ) : Promise < void > {
284
+ console . log ( data )
285
+ } ,
286
+ onError ( error : Error & { code ?: number } ) : never {
287
+ throw error
288
+ }
289
+ } ,
290
+ utils : {
291
+ formatters : {
292
+ date : ( input : Date ) => input . toISOString ( ) ,
293
+ currency : ( amount : number , currency = 'USD' ) =>
294
+ new Intl . NumberFormat ( 'en-US' , { style : 'currency' , currency } ) . format ( amount )
295
+ }
296
+ }
297
+ }
298
+
280
299
export default dts
Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ export declare function processData(data: number): number;
120
120
export declare function processData ( data : boolean ) : boolean ;
121
121
export declare function processData < T extends object > ( data : T ) : T ;
122
122
export declare function processData ( data : unknown ) : unknown ;
123
+ export declare const complexObject : {
124
+ handlers : {
125
+ 'async onSuccess<T>(data' : unknown ;
126
+ 'onError(error' : unknown ;
127
+ } ;
128
+ } ;
123
129
124
130
export { generate , dtsConfig }
125
131
export type { DtsGenerationOption }
You can’t perform that action at this time.
0 commit comments