Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 27, 2024
1 parent 845a982 commit 63be9e3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions fixtures/input/example-0001.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,23 @@ export function processData(data: unknown): unknown {
return data
}

// 5. Nested Object Types with Methods
export const complexObject = {
handlers: {
async onSuccess<T>(data: T): Promise<void> {
console.log(data)
},
onError(error: Error & { code?: number }): never {
throw error
}
},
utils: {
formatters: {
date: (input: Date) => input.toISOString(),
currency: (amount: number, currency = 'USD') =>
new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(amount)
}
}
}

export default dts
6 changes: 6 additions & 0 deletions fixtures/output/example-0001.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ export declare function processData(data: number): number;
export declare function processData(data: boolean): boolean;
export declare function processData<T extends object>(data: T): T;
export declare function processData(data: unknown): unknown;
export declare const complexObject: {
handlers: {
'async onSuccess<T>(data': unknown;
'onError(error': unknown;
};
};

export { generate, dtsConfig }
export type { DtsGenerationOption }
Expand Down

0 comments on commit 63be9e3

Please # to comment.