1
- import type { BunPlugin } from 'bun' ;
2
- import type { DtsGenerationConfig , DtsGenerationOption } from '@stacksjs/dtsx' ;
3
- import { generate } from '@stacksjs/dtsx' ;
4
-
5
1
/**
6
2
* Example of const declaration
7
3
*/
@@ -42,9 +38,9 @@ export declare const someObject: {
42
38
* with another comment in an extra line
43
39
*/
44
40
export declare interface User {
45
- id : number
46
- name : string
47
- email : string
41
+ id : number
42
+ name : string
43
+ email : string
48
44
}
49
45
50
46
/**
@@ -53,8 +49,8 @@ email: string
53
49
* with multiple lines of comments, including an empty line
54
50
*/
55
51
export declare interface ResponseData {
56
- success : boolean
57
- data : User [ ]
52
+ success : boolean
53
+ data : User [ ]
58
54
}
59
55
60
56
/**
@@ -66,25 +62,22 @@ data: User[]
66
62
export declare function fetchUsers ( ) : Promise < ResponseData > ;
67
63
68
64
export declare interface ApiResponse < T > {
69
- status : number
70
- message : string
71
- data : T
65
+ status : number
66
+ message : string
67
+ data : T
72
68
}
73
69
74
70
/**
75
71
* Example of another const declaration
76
- *
77
- * with multiple empty lines, including being poorly formatted
72
+ *
73
+ * with multiple empty lines, including being poorly formatted
78
74
*/
79
- declare const settings : { [ key : string ] : any } = {
80
- theme : 'dark' ,
81
- language : 'en' ,
82
- }
75
+ declare const settings : { [ key : string ] : any } ;
83
76
84
77
export declare interface Product {
85
- id : number
86
- name : string
87
- price : number
78
+ id : number
79
+ name : string
80
+ price : number
88
81
}
89
82
90
83
/**
@@ -93,8 +86,8 @@ price: number
93
86
export declare function getProduct ( id : number ) : Promise < ApiResponse < Product > > ;
94
87
95
88
export declare interface AuthResponse {
96
- token : string
97
- expiresIn : number
89
+ token : string
90
+ expiresIn : number
98
91
}
99
92
100
93
export declare type AuthStatus = 'authenticated' | 'unauthenticated' ;
@@ -107,27 +100,15 @@ export declare const defaultHeaders: {
107
100
108
101
export declare function dts ( options ?: DtsGenerationOption ) : BunPlugin ;
109
102
110
- declare interface interface Options < T > {
111
- name : string
112
- cwd ?: string
113
- defaultConfig : T
103
+ declare interface Options < T > {
104
+ name : string
105
+ cwd ?: string
106
+ defaultConfig : T
114
107
}
115
108
116
109
export declare function loadConfig < T extends Record < string , unknown > > ( options : Options < T > ) : Promise < T > ;
117
110
118
- declare const dtsConfig : DtsGenerationConfig = await loadConfig ( {
119
- name : 'dts' ,
120
- cwd : process . cwd ( ) ,
121
- defaultConfig : {
122
- cwd : process . cwd ( ) ,
123
- root : './src' ,
124
- entrypoints : [ '**/*.ts' ] ,
125
- outdir : './dist' ,
126
- keepComments : true ,
127
- clean : true ,
128
- tsconfigPath : './tsconfig.json' ,
129
- } ,
130
- } ) ;
111
+ declare const dtsConfig : DtsGenerationConfig ;
131
112
132
113
export { generate , dtsConfig }
133
114
@@ -136,23 +117,26 @@ export type { DtsGenerationOption };
136
117
export { config } from './config' ;
137
118
138
119
export declare interface ComplexGeneric < T extends Record < string , unknown > , K extends keyof T > {
139
- data : T
140
- key : K
141
- value : T [ K ]
142
- transform : ( input : T [ K ] ) => string
143
- nested : Array < Partial < T > >
120
+ data : T
121
+ key : K
122
+ value : T [ K ]
123
+ transform : ( input : T [ K ] ) => string
124
+ nested : Array < Partial < T > >
144
125
}
145
126
146
- export declare type ComplexUnionIntersection =
147
- | ( User & { role : 'admin' } )
148
- | ( Product & { category : string } )
127
+ export declare type ComplexUnionIntersection = ;
128
+
129
+ | ( User & { role : 'admin' } ) ;
130
+
131
+ | ( Product & { category : string } ) ;
132
+
149
133
& {
150
134
metadata : Record < string , unknown >
151
135
}
152
136
137
+ export default dts ;
138
+
153
139
export * from './extract' ;
154
140
export * from './generate' ;
155
141
export * from './types' ;
156
142
export * from './utils' ;
157
-
158
- export default dts ;
0 commit comments