mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
fix(types): add missing SIMD variants to Bun.Build.CompileTarget type (#26248)
## Summary
- Adds missing SIMD variants to the `Build.Target` TypeScript type
- The runtime accepts targets like `bun-linux-x64-modern` but TypeScript
was rejecting them
- Generalized the type to use `${Architecture}` template where possible
## Test plan
- [x] Added regression test in `test/regression/issue/26247.test.ts`
that validates all valid target combinations type-check correctly
- [x] Verified with `bun bd test test/regression/issue/26247.test.ts`
Fixes #26247
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Alistair Smith <hi@alistair.sh>
This commit is contained in:
6
packages/bun-types/bun.d.ts
vendored
6
packages/bun-types/bun.d.ts
vendored
@@ -2433,11 +2433,11 @@ declare module "bun" {
|
|||||||
type SIMD = "baseline" | "modern";
|
type SIMD = "baseline" | "modern";
|
||||||
type CompileTarget =
|
type CompileTarget =
|
||||||
| `bun-darwin-${Architecture}`
|
| `bun-darwin-${Architecture}`
|
||||||
| `bun-darwin-x64-${SIMD}`
|
| `bun-darwin-${Architecture}-${SIMD}`
|
||||||
| `bun-linux-${Architecture}`
|
| `bun-linux-${Architecture}`
|
||||||
| `bun-linux-${Architecture}-${Libc}`
|
| `bun-linux-${Architecture}-${Libc}`
|
||||||
| `bun-linux-x64-${SIMD}`
|
| `bun-linux-${Architecture}-${SIMD}`
|
||||||
| `bun-linux-x64-${SIMD}-${Libc}`
|
| `bun-linux-${Architecture}-${SIMD}-${Libc}`
|
||||||
| "bun-windows-x64"
|
| "bun-windows-x64"
|
||||||
| `bun-windows-x64-${SIMD}`;
|
| `bun-windows-x64-${SIMD}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,21 @@
|
|||||||
import { expectType } from "./utilities";
|
import { expectAssignable, expectType } from "./utilities";
|
||||||
|
|
||||||
Bun.build({
|
Bun.build({
|
||||||
entrypoints: ["hey"],
|
entrypoints: ["hey"],
|
||||||
splitting: false,
|
splitting: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Build.CompileTarget should accept SIMD variants (issue #26247)
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-linux-x64-modern");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-linux-x64-baseline");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-linux-arm64-modern");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-linux-arm64-baseline");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-linux-x64-modern-glibc");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-linux-x64-modern-musl");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-darwin-x64-modern");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-darwin-arm64-baseline");
|
||||||
|
expectAssignable<Bun.Build.CompileTarget>("bun-windows-x64-modern");
|
||||||
|
|
||||||
Bun.build({
|
Bun.build({
|
||||||
entrypoints: ["hey"],
|
entrypoints: ["hey"],
|
||||||
splitting: false,
|
splitting: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user