## 事象
[[Bun]]の`bun build`コマンドで型定義ファイル(.d.ts)を生成できない。
v1.0.4時点ではオプションにもなさそう。
```console
$ bun build
bun build v1.0.4 (745b6b94)
error: Missing entrypoints. What would you like to bundle?
Usage: bun build [flags] [...entrypoints]
Common Flags:
--outfile Write the output to a specific file (default: stdout)
--outdir Write the output to a directory (required for splitting)
--minify Enable all minification flags
--minify-whitespace Remove unneeded whitespace
--minify-syntax Transform code to use less syntax
--minify-identifiers Shorten variable names
--sourcemap Generate sourcemaps
("none", "inline", or "external")
--target The intended execution environment for the bundle.
("browser", "bun" or "node")
--splitting Enable code splitting (requires --outdir)
--watch Run bundler in watch mode
```
## 原因
#2023/10/05 時点で対応されていないから。
<div class="link-card">
<div class="link-card-header">
<img src="https://github.githubassets.com/favicons/favicon.svg" class="link-card-site-icon"/>
<span class="link-card-site-name">GitHub</span>
</div>
<div class="link-card-body">
<div class="link-card-content">
<div>
<p class="link-card-title">Generate type declarations during `bun build` · Issue #5141 · oven-sh/bun</p>
</div>
<div class="link-card-description">
What is the problem this feature would solve? I'd like to build my library written in typescript wit...
</div>
</div>
<img src="https://opengraph.githubassets.com/786f596b328c7d157f79c08d32bd930192044c00cca7718576c96344642232d2/oven-sh/bun/issues/5141" class="link-card-image" />
</div>
<a href="https://github.com/oven-sh/bun/issues/5141"></a>
</div>
## 解決方法
なし。先のIssueで代替案はいくつか提案されているが、[[Node.js]]の[[CommonJS]]プロジェクトではうまくうごかなかった...。
今後対応されそうな雰囲気はあるので、それを待った方が良さそう。
> My expectation is that Isolated Declarations will eventually ship in TypeScript and then some number of weeks or months later, we will ship support for emitting TypeScript types in bun build(for projects leveraging isolated declarations)