Skip to content

Commit cbd81f2

Browse files
committed
fix #4223: improve ts types for entryPoints
1 parent 34c77ca commit cbd81f2

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
(()=>{})();
2222
```
2323

24+
* Allow mixed array for `entryPoints` API option ([#4223](https://github.com/evanw/esbuild/issues/4223))
25+
26+
The TypeScript type definitions now allow you to pass a mixed array of both string literals and object literals to the `entryPoints` API option, such as `['foo.js', { out: 'lib', in: 'bar.js' }]`. This was always possible to do in JavaScript but the TypeScript type definitions were previously too restrictive.
27+
2428
* Update Go from 1.23.8 to 1.23.10 ([#4204](https://github.com/evanw/esbuild/issues/4204), [#4207](https://github.com/evanw/esbuild/pull/4207)
2529

2630
This should have no effect on existing code as this version change does not change Go's operating system support. It may remove certain false positive reports (specifically CVE-2025-4673 and CVE-2025-22874) from vulnerability scanners that only detect which version of the Go compiler esbuild uses.

lib/shared/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export interface BuildOptions extends CommonOptions {
159159
/** Documentation: https://esbuild.github.io/api/#footer */
160160
footer?: { [type: string]: string }
161161
/** Documentation: https://esbuild.github.io/api/#entry-points */
162-
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
162+
entryPoints?: (string | { in: string, out: string })[] | Record<string, string>
163163
/** Documentation: https://esbuild.github.io/api/#stdin */
164164
stdin?: StdinOptions
165165
/** Documentation: https://esbuild.github.io/plugins/ */

scripts/ts-type-tests.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,20 @@ const testsWithoutErrors = {
265265
}
266266
})
267267
`,
268+
objectEntryPointBuild: `
269+
export {}
270+
import {build} from 'esbuild'
271+
build({
272+
entryPoints: { x: 'x', y: 'z' },
273+
})
274+
`,
275+
mixedEntryPointBuild: `
276+
export {}
277+
import {build} from 'esbuild'
278+
build({
279+
entryPoints: ['x', { in: 'y', out: 'z' }],
280+
})
281+
`,
268282
}
269283

270284
const testsWithErrors = {

0 commit comments

Comments
 (0)