Skip to content

Commit

Permalink
feat(types): allow autocomplete for target (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImLunaHey authored and egoist committed Feb 7, 2023
1 parent 4154e05 commit 398ae15
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ export type BannerOrFooter =
}
| ((ctx: { format: Format }) => { js?: string; css?: string } | undefined)

type Autocomplete<Keys extends string> = Keys | Omit<string, Keys>
export type BrowserTarget =
| 'chrome'
| 'deno'
| 'edge'
| 'firefox'
| 'hermes'
| 'ie'
| 'ios'
| 'node'
| 'opera'
| 'rhino'
| 'safari'
export type EsTarget =
| 'es3'
| 'es5'
| 'es6'
| 'es2015'
| 'es2016'
| 'es2017'
| 'es2018'
| 'es2019'
| 'es2020'
| 'es2021'
| 'es2022'
| 'esnext'
export type Target = Autocomplete<BrowserTarget | EsTarget>

/**
* The options available in tsup.config.ts
* Not all of them are available from CLI flags
Expand All @@ -65,7 +93,7 @@ export type Options = {
*
* default to `node14`
*/
target?: string | string[]
target?: Target | Target[]
minify?: boolean | 'terser'
terserOptions?: MinifyOptions
minifyWhitespace?: boolean
Expand Down

0 comments on commit 398ae15

Please sign in to comment.