Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): allow autocomplete for target #809

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ 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 @@ -64,7 +69,7 @@ export type Options = {
*
* default to `node14`
*/
target?: string | string[]
target?: Target | Target[]
minify?: boolean
minifyWhitespace?: boolean
minifyIdentifiers?: boolean
Expand Down