66 type TsConfigJson ,
77 type TsConfigJsonResolved ,
88} from 'get-tsconfig'
9+ import type { AddonFunction } from 'rolldown'
910import type { IsolatedDeclarationsOptions } from 'rolldown/experimental'
1011
1112//#region General Options
@@ -166,6 +167,15 @@ export interface TscOptions {
166167 * `false`.
167168 */
168169 emitJs ?: boolean
170+
171+ /**
172+ * Content to be added at the top of each generated `.d.ts` file.
173+ */
174+ banner ?: string | Promise < string > | AddonFunction
175+ /**
176+ * Content to be added at the bottom of each generated `.d.ts` file.
177+ */
178+ footer ?: string | Promise < string > | AddonFunction
169179}
170180
171181export interface Options extends GeneralOptions , TscOptions {
@@ -193,11 +203,13 @@ export interface Options extends GeneralOptions, TscOptions {
193203}
194204
195205type Overwrite < T , U > = Pick < T , Exclude < keyof T , keyof U > > & U
206+ type MarkPartial < T , K extends keyof T > = Omit < Required < T > , K > &
207+ Partial < Pick < T , K > >
196208
197209export type OptionsResolved = Overwrite <
198- Required < Omit < Options , 'compilerOptions' > > ,
210+ MarkPartial < Omit < Options , 'compilerOptions' > , 'banner' | 'footer' > ,
199211 {
200- tsconfig : string | undefined
212+ tsconfig ? : string
201213 oxc : IsolatedDeclarationsOptions | false
202214 tsconfigRaw : TsConfigJson
203215 }
@@ -215,6 +227,8 @@ export function resolveOptions({
215227 sourcemap,
216228 resolve = false ,
217229 cjsDefault = false ,
230+ banner,
231+ footer,
218232
219233 // tsc
220234 build = false ,
@@ -313,6 +327,8 @@ export function resolveOptions({
313327 sourcemap,
314328 resolve,
315329 cjsDefault,
330+ banner,
331+ footer,
316332
317333 // tsc
318334 build,
0 commit comments