Document Bun supports Import Attributes and JSON modules syntax (#13074)

This commit is contained in:
guest271314
2024-08-04 07:44:38 -07:00
committed by GitHub
parent 483af7c33c
commit fd84ace83b

View File

@@ -27,6 +27,16 @@ data.version; // => "1.0.0"
data.author.name; // => "John Dough"
```
Bun also supports [Import Attributes](https://github.com/tc39/proposal-import-attributes/) and [JSON modules](https://github.com/tc39/proposal-json-modules) syntax.
```ts
import data from "./package.json" with { type: "json" };
data.name; // => "bun"
data.version; // => "1.0.0"
data.author.name; // => "John Dough"
```
---
See [Docs > Runtime > TypeScript](/docs/runtime/typescript) for more information on using TypeScript with Bun.