DOCUMENTATION: Mention TypeScript support and update example in React docs (#2263)

This commit is contained in:
catloversg
2025-07-23 03:25:00 +07:00
committed by GitHub
parent 1ac95144be
commit 85094d4fb4
3 changed files with 10 additions and 8 deletions

View File

@@ -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)

View File

@@ -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(<Timer />);
await ns.asleep(10000);
}

View File

@@ -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;