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
+
1
8
/**
2
9
* Example of const declaration
3
10
*/
4
11
export declare const conf : { [ key : string ] : string } ;
5
-
6
12
export declare const someObject : {
7
13
someString : 'Stacks' ;
8
14
someNumber : 1000 ;
@@ -32,7 +38,6 @@ export declare const someObject: {
32
38
someInlineCall2 : ( ...args : any [ ] ) => void ;
33
39
someInlineCall3 : ( ...args : any [ ] ) => void ;
34
40
} ;
35
-
36
41
/**
37
42
* Example of interface declaration
38
43
* with another comment in an extra line
@@ -42,7 +47,6 @@ export declare interface User {
42
47
name : string
43
48
email : string
44
49
}
45
-
46
50
/**
47
51
* Example of type declaration
48
52
*
@@ -52,91 +56,69 @@ export declare interface ResponseData {
52
56
success : boolean
53
57
data : User [ ]
54
58
}
55
-
56
59
/**
57
60
* Example of function declaration
58
61
*
59
62
*
60
63
* with multiple empty lines, including an empty lines
61
64
*/
62
65
export declare function fetchUsers ( ) : Promise < ResponseData > ;
63
-
64
66
export declare interface ApiResponse < T > {
65
67
status : number
66
68
message : string
67
69
data : T
68
70
}
69
-
70
71
/**
71
72
* Example of another const declaration
72
73
*
73
74
* with multiple empty lines, including being poorly formatted
74
75
*/
75
76
declare const settings : { [ key : string ] : any } ;
76
-
77
77
export declare interface Product {
78
78
id : number
79
79
name : string
80
80
price : number
81
81
}
82
-
83
82
/**
84
83
* Example of function declaration
85
84
*/
86
85
export declare function getProduct ( id : number ) : Promise < ApiResponse < Product > > ;
87
-
88
86
export declare interface AuthResponse {
89
87
token : string
90
88
expiresIn : number
91
89
}
92
-
93
90
export declare type AuthStatus = 'authenticated' | 'unauthenticated' ;
94
-
95
91
export declare function authenticate ( user : string , password : string ) : Promise < AuthResponse > ;
96
-
97
92
export declare const defaultHeaders : {
98
93
'Content-Type' : 'application/json' ;
99
94
} ;
100
-
101
95
export declare function dts ( options ?: DtsGenerationOption ) : BunPlugin ;
102
-
103
96
declare interface Options < T > {
104
97
name : string
105
98
cwd ?: string
106
99
defaultConfig : T
107
100
}
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 > ;
111
102
declare const dtsConfig : DtsGenerationConfig ;
112
-
113
103
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'
119
110
export declare interface ComplexGeneric < T extends Record < string , unknown > , K extends keyof T > {
120
111
data : T
121
112
key : K
122
113
value : T [ K ]
123
114
transform : ( input : T [ K ] ) => string
124
115
nested : Array < Partial < T > >
125
116
}
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 } )
133
120
& {
134
121
metadata : Record < string , unknown >
135
122
}
136
123
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