From fd84ace83b17c6108edcf48f664c339a5e2e6967 Mon Sep 17 00:00:00 2001 From: guest271314 Date: Sun, 4 Aug 2024 07:44:38 -0700 Subject: [PATCH] Document Bun supports Import Attributes and JSON modules syntax (#13074) --- docs/guides/runtime/import-json.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/guides/runtime/import-json.md b/docs/guides/runtime/import-json.md index 3db2daaea1..d7c2424ab4 100644 --- a/docs/guides/runtime/import-json.md +++ b/docs/guides/runtime/import-json.md @@ -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.