Skip to content

Commit 63be9e3

Browse files
committed
chore: wip
1 parent 845a982 commit 63be9e3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

fixtures/input/example-0001.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,23 @@ export function processData(data: unknown): unknown {
277277
return data
278278
}
279279

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+
280299
export default dts

fixtures/output/example-0001.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ export declare function processData(data: number): number;
120120
export declare function processData(data: boolean): boolean;
121121
export declare function processData<T extends object>(data: T): T;
122122
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+
};
123129

124130
export { generate, dtsConfig }
125131
export type { DtsGenerationOption }

0 commit comments

Comments
 (0)