@@ -95,6 +95,15 @@ export type NoExternalFn = (
9595
9696export type CIOption = 'ci-only' | 'local-only'
9797
98+ export type WithEnabled < T > =
99+ | boolean
100+ | undefined
101+ | CIOption
102+ | ( T & {
103+ /** @default true */
104+ enabled ?: boolean | CIOption
105+ } )
106+
98107/**
99108 * Options for tsdown.
100109 */
@@ -389,7 +398,7 @@ export interface UserConfig {
389398 *
390399 * @default false
391400 */
392- debug ?: boolean | CIOption | DebugOptions
401+ debug ?: WithEnabled < DebugOptions >
393402
394403 //#region Addons
395404
@@ -400,21 +409,21 @@ export interface UserConfig {
400409 * - If the `types` field is present, or if the main `exports` contains a `types` entry, declaration file generation is enabled by default.
401410 * - Otherwise, declaration file generation is disabled by default.
402411 */
403- dts ?: boolean | CIOption | DtsOptions
412+ dts ?: WithEnabled < DtsOptions >
404413
405414 /**
406415 * Enable unused dependencies check with `unplugin-unused`
407416 * Requires `unplugin-unused` to be installed.
408417 * @default false
409418 */
410- unused ?: boolean | CIOption | UnusedOptions
419+ unused ?: WithEnabled < UnusedOptions >
411420
412421 /**
413422 * Run publint after bundling.
414423 * Requires `publint` to be installed.
415424 * @default false
416425 */
417- publint ?: boolean | CIOption | PublintOptions
426+ publint ?: WithEnabled < PublintOptions >
418427
419428 /**
420429 * Run `arethetypeswrong` after bundling.
@@ -423,13 +432,13 @@ export interface UserConfig {
423432 * @default false
424433 * @see https://github.com/arethetypeswrong/arethetypeswrong.github.io
425434 */
426- attw ?: boolean | CIOption | AttwOptions
435+ attw ?: WithEnabled < AttwOptions >
427436
428437 /**
429438 * Enable size reporting after bundling.
430439 * @default true
431440 */
432- report ?: boolean | CIOption | ReportOptions
441+ report ?: WithEnabled < ReportOptions >
433442
434443 /**
435444 * `import.meta.glob` support.
@@ -444,7 +453,7 @@ export interface UserConfig {
444453 * This will set the `main`, `module`, `types`, `exports` fields in `package.json`
445454 * to point to the generated files.
446455 */
447- exports ?: boolean | CIOption | ExportsOptions
456+ exports ?: WithEnabled < ExportsOptions >
448457
449458 /**
450459 * @deprecated Alias for `copy`, will be removed in the future.
0 commit comments