## TypeScript Bun natively supports TypeScript out of the box. All files are transpiled on the fly by Bun's fast native transpiler before being executed. Similar to other build tools, Bun does not perform typechecking; it simply removes type annotations from the file. ```bash $ bun index.js $ bun index.jsx $ bun index.ts $ bun index.tsx ``` Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](/docs/runtime/typescript) page for details. ## JSX Bun supports `.jsx` and `.tsx` files out of the box. Bun's internal transpiler converts JSX syntax into vanilla JavaScript before execution. ```tsx#react.tsx function Component(props: {message: string}) { return (

{props.message}

); } console.log(); ``` Bun implements special logging for JSX to make debugging easier. ```bash $ bun run react.tsx ``` ## Text files {% callout %} Supported in Bun v0.6.0 canary. {% /callout %} Text files can be imported as strings. {% codetabs %} ```ts#index.ts import text from "./text.txt"; console.log(text); // => "Hello world!" ``` ```txt#text.txt Hello world! ``` {% /codetabs %} ## JSON and TOML JSON and TOML files can be directly imported from a source file. The contents will be loaded and returned as a JavaScript object. ```ts import pkg from "./package.json"; import data from "./data.toml"; ``` ## WASM As of v0.5.2, experimental support exists for WASI, the [WebAssembly System Interface](https://github.com/WebAssembly/WASI). To run a `.wasm` binary with Bun: ```bash $ bun ./my-wasm-app.wasm # if the filename doesn't end with ".wasm" $ bun run ./my-wasm-app.whatever ``` {% callout %} **Note** — WASI support is based on [wasi-js](https://github.com/sagemathinc/cowasm/tree/main/packages/wasi-js). Currently, it only supports WASI binaries that use the `wasi_snapshot_preview1` or `wasi_unstable` APIs. Bun's implementation is not fully optimized for performance; this will become more of a priority as WASM grows in popularity. {% /callout %} ## Custom loaders Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](/docs/bundler/plugins) for full documentation.