Skip to main content

Documentation Index

Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt

Use this file to discover all available pages before exploring further.

Bun 原生支持导入 .toml 文件。
data.toml
name = "bun"
version = "1.0.0"

[author]
name = "John Dough"
email = "[email protected]"

像导入其他源文件一样导入该文件。
https://mintcdn.com/bun-zhcndoc/cnUTwgMuf4cCrwC-/icons/typescript.svg?fit=max&auto=format&n=cnUTwgMuf4cCrwC-&q=85&s=e7767043c9e885c34f2d6c8fe2a95217data.ts
import data from "./data.toml";

data.name; // => "bun"
data.version; // => "1.0.0"
data.author.name; // => "John Dough"

更多关于在 Bun 中使用 TypeScript 的信息,请参见 Docs > Runtime > TypeScript