Skip to content

Commit

Permalink
types: more build overload definitions (#1911)
Browse files Browse the repository at this point in the history
  • Loading branch information
mk0x9 authored Jan 6, 2022
1 parent 5c64b40 commit 86e6278
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,9 @@ export interface AnalyzeMetafileOptions {
* Documentation: https://esbuild.github.io/api/#build-api
*/
export declare function build(options: BuildOptions & { write: false }): Promise<BuildResult & { outputFiles: OutputFile[] }>;
export declare function build(options: BuildOptions & { incremental: true, metafile: true }): Promise<BuildIncremental & { metafile: Metafile }>;
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
export declare function build(options: BuildOptions): Promise<BuildResult>;

/**
Expand Down
15 changes: 15 additions & 0 deletions scripts/ts-type-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ const tests = {
result.rebuild.dispose()
}
`,
metafileTrue: `
import {build, analyzeMetafile} from 'esbuild';
build({ metafile: true }).then(result => {
analyzeMetafile(result.metafile)
})
`,
incrementalAndMetafileTrue: `
import {build, analyzeMetafile} from 'esbuild';
build({
incremental: true,
metafile: true,
}).then(result => {
analyzeMetafile(result.metafile)
})
`,
ifRebuild: `
import * as esbuild from 'esbuild'
let options: any
Expand Down

0 comments on commit 86e6278

Please sign in to comment.