Skip to content

Commit 3a19f8b

Browse files
committed
chore: wip
1 parent 524af20 commit 3a19f8b

File tree

2 files changed

+84
-194
lines changed

2 files changed

+84
-194
lines changed

fixtures/output/example-0001.d.ts

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import type { BunPlugin } from 'bun'
2+
import process from 'node:process'
3+
import { generate, deepMerge } from '@stacksjs/dtsx'
4+
import type { DtsGenerationConfig, DtsGenerationOption } from '@stacksjs/dtsx'
5+
import { existsSync } from 'node:fs'
6+
import { resolve } from 'node:path'
7+
18
/**
29
* Example of const declaration
310
*/
411
export declare const conf: { [key: string]: string };
5-
612
export declare const someObject: {
713
someString: 'Stacks';
814
someNumber: 1000;
@@ -32,7 +38,6 @@ export declare const someObject: {
3238
someInlineCall2: (...args: any[]) => void;
3339
someInlineCall3: (...args: any[]) => void;
3440
};
35-
3641
/**
3742
* Example of interface declaration
3843
* with another comment in an extra line
@@ -42,7 +47,6 @@ export declare interface User {
4247
name: string
4348
email: string
4449
}
45-
4650
/**
4751
* Example of type declaration
4852
*
@@ -52,91 +56,69 @@ export declare interface ResponseData {
5256
success: boolean
5357
data: User[]
5458
}
55-
5659
/**
5760
* Example of function declaration
5861
*
5962
*
6063
* with multiple empty lines, including an empty lines
6164
*/
6265
export declare function fetchUsers(): Promise<ResponseData>;
63-
6466
export declare interface ApiResponse<T> {
6567
status: number
6668
message: string
6769
data: T
6870
}
69-
7071
/**
7172
* Example of another const declaration
7273
*
7374
* with multiple empty lines, including being poorly formatted
7475
*/
7576
declare const settings: { [key: string]: any };
76-
7777
export declare interface Product {
7878
id: number
7979
name: string
8080
price: number
8181
}
82-
8382
/**
8483
* Example of function declaration
8584
*/
8685
export declare function getProduct(id: number): Promise<ApiResponse<Product>>;
87-
8886
export declare interface AuthResponse {
8987
token: string
9088
expiresIn: number
9189
}
92-
9390
export declare type AuthStatus = 'authenticated' | 'unauthenticated';
94-
9591
export declare function authenticate(user: string, password: string): Promise<AuthResponse>;
96-
9792
export declare const defaultHeaders: {
9893
'Content-Type': 'application/json';
9994
};
100-
10195
export declare function dts(options?: DtsGenerationOption): BunPlugin;
102-
10396
declare interface Options<T> {
10497
name: string
10598
cwd?: string
10699
defaultConfig: T
107100
}
108-
109-
export declare function loadConfig<T extends Record<string, unknown>>(options: Options<T>): Promise<T>;
110-
101+
export declare async function loadConfig<T extends Record<string, unknown>>(options: Options<T>): Promise<T>;
111102
declare const dtsConfig: DtsGenerationConfig;
112-
113103
export { generate, dtsConfig }
114-
115-
export type { DtsGenerationOption };
116-
117-
export { config } from './config';
118-
104+
export type { DtsGenerationOption }
105+
export { config } from './config'
106+
export * from './extract'
107+
export * from './generate'
108+
export * from './types'
109+
export * from './utils'
119110
export declare interface ComplexGeneric<T extends Record<string, unknown>, K extends keyof T> {
120111
data: T
121112
key: K
122113
value: T[K]
123114
transform: (input: T[K]) => string
124115
nested: Array<Partial<T>>
125116
}
126-
127-
export declare type ComplexUnionIntersection =;
128-
129-
| (User & { role: 'admin' });
130-
131-
| (Product & { category: string });
132-
117+
export declare type ComplexUnionIntersection =
118+
| (User & { role: 'admin' })
119+
| (Product & { category: string })
133120
& {
134121
metadata: Record<string, unknown>
135122
}
136123

137-
export default dts;
138-
139-
export * from './extract';
140-
export * from './generate';
141-
export * from './types';
142-
export * from './utils';
124+
export default dts

0 commit comments

Comments
 (0)