From 85094d4fb46926aafd31c534cc973697e8c0a492 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Wed, 23 Jul 2025 03:25:00 +0700 Subject: [PATCH] DOCUMENTATION: Mention TypeScript support and update example in React docs (#2263) --- src/Documentation/doc/en/index.md | 2 +- .../doc/en/programming/{react.md => typescript_react.md} | 8 +++++--- src/Documentation/pages.ts | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) rename src/Documentation/doc/en/programming/{react.md => typescript_react.md} (55%) diff --git a/src/Documentation/doc/en/index.md b/src/Documentation/doc/en/index.md index 5c502b491..37090dbe1 100644 --- a/src/Documentation/doc/en/index.md +++ b/src/Documentation/doc/en/index.md @@ -50,7 +50,7 @@ - [Learn to program](programming/learn.md) - [Remote API](programming/remote_api.md) - [Game frozen or stuck?](programming/game_frozen.md) -- [React](programming/react.md) +- [TypeScript and React](programming/typescript_react.md) - [Tools & Resources](help/tools_and_resources.md) - [Changelog](changelog.md) - [Changelog - Legacy v1](changelog-v1.md) diff --git a/src/Documentation/doc/en/programming/react.md b/src/Documentation/doc/en/programming/typescript_react.md similarity index 55% rename from src/Documentation/doc/en/programming/react.md rename to src/Documentation/doc/en/programming/typescript_react.md index 6e0c36fb2..a680c77f2 100644 --- a/src/Documentation/doc/en/programming/react.md +++ b/src/Documentation/doc/en/programming/typescript_react.md @@ -1,6 +1,8 @@ -# How to use React in game +# How to use TypeScript and React in game -Since v2.7.0, Bitburner supports React and TypeScript out of the box. You can use the jsx syntax inside `.jsx` and `.tsx` files. +Bitburner supports TypeScript and React out of the box. + +You can write TypeScript scripts in `.ts` files and use the jsx syntax inside `.jsx` and `.tsx` files. You can run them with the `run` CLI as if they are normal JS files. For example, you can run the `timer.tsx` file in the next section by running `run timer.tsx` in the terminal tab. ## Example @@ -22,7 +24,7 @@ function Timer() { } export async function main(ns: NS) { - ns.tail(); + ns.ui.openTail(); ns.printRaw(); await ns.asleep(10000); } diff --git a/src/Documentation/pages.ts b/src/Documentation/pages.ts index b7896e824..becb426a4 100644 --- a/src/Documentation/pages.ts +++ b/src/Documentation/pages.ts @@ -61,8 +61,8 @@ import file58 from "./doc/en/programming/game_frozen.md?raw"; import file59 from "./doc/en/programming/go_algorithms.md?raw"; import file60 from "./doc/en/programming/hackingalgorithms.md?raw"; import file61 from "./doc/en/programming/learn.md?raw"; -import file62 from "./doc/en/programming/react.md?raw"; -import file63 from "./doc/en/programming/remote_api.md?raw"; +import file62 from "./doc/en/programming/remote_api.md?raw"; +import file63 from "./doc/en/programming/typescript_react.md?raw"; import nsDoc_bitburner__valueof_md from "../../markdown/bitburner._valueof.md?raw"; import nsDoc_bitburner_activefragment_highestcharge_md from "../../markdown/bitburner.activefragment.highestcharge.md?raw"; import nsDoc_bitburner_activefragment_id_md from "../../markdown/bitburner.activefragment.id.md?raw"; @@ -1560,8 +1560,8 @@ AllPages["en/programming/game_frozen.md"] = file58; AllPages["en/programming/go_algorithms.md"] = file59; AllPages["en/programming/hackingalgorithms.md"] = file60; AllPages["en/programming/learn.md"] = file61; -AllPages["en/programming/react.md"] = file62; -AllPages["en/programming/remote_api.md"] = file63; +AllPages["en/programming/remote_api.md"] = file62; +AllPages["en/programming/typescript_react.md"] = file63; AllPages["nsDoc/bitburner._valueof.md"] = nsDoc_bitburner__valueof_md; AllPages["nsDoc/bitburner.activefragment.highestcharge.md"] = nsDoc_bitburner_activefragment_highestcharge_md; AllPages["nsDoc/bitburner.activefragment.id.md"] = nsDoc_bitburner_activefragment_id_md;