Skip to content

Commit 0caab70

Browse files
committed
Adjusted docs text
1 parent bbb2749 commit 0caab70

File tree

6 files changed

+8
-39
lines changed

6 files changed

+8
-39
lines changed

docs/caveats.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Caveats
33
---
44

5-
Luckily, for most use-cases, you can write modern, idiomatic TypeScript, and TSTL will produce transpiled Lua that will work flawlessly. In other words, you probably will not have to worry about the idiomatic quirks of Lua or the internal decisions that TSTL makes when converting code.
5+
TSTL aims to support almost all modern, idiomatic TypeScript without any modifications. In other words, you probably will not have to worry about the idiomatic quirks of Lua or other internal decisions that TSTL makes when converting code.
66

77
With that said, TSTL does have some "gotchas" that you might run into. This page covers some of those edge-cases.
88

@@ -21,7 +21,7 @@ With that said, TSTL does have some "gotchas" that you might run into. This page
2121

2222
## Differences from JavaScript
2323

24-
This project aims for both compilation results to have the same behavior as much as possible, but not at all costs. Since TypeScript is based on JavaScript, it also inherited some of the quirks in JavaScript that are not present in Lua. This is where behavior between Lua and JavaScript compilation targets diverge. TypeScriptToLua aims to keep identical behavior as long as **sane** TypeScript is used: if JavaScript-specific quirks are used, behavior might differ.
24+
This project aims for JavaScript and Lua compilation results to have the same runtime behavior as much as possible, but not at all costs. Since TypeScript is based on JavaScript, it also inherited some of the quirks in JavaScript that are not present in Lua. This is where behavior between Lua and JavaScript compilation targets diverge. TypeScriptToLua aims to keep identical behavior as long as **sane** TypeScript is used: if JavaScript-specific quirks are used, behavior might differ.
2525

2626
Below are some of the cases where resulting Lua intentionally behaves different from compiled JS.
2727

@@ -118,7 +118,7 @@ A sorting algorithm is [said to be stable](https://stackoverflow.com/questions/1
118118

119119
TypeScriptToLua relies on the Lua standard library for sorting. In other words, it transpiles `[1, 2, 3].sort();` to `table.sort({1, 2, 3})`. So beware that your sorts will no longer be stable!
120120

121-
If you need stable sorting, you have to manually use a custom sorting function. For some examples of this, see the [sorting helper functions from `isaacscript-common`](https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-common/src/functions/sort.ts).
121+
If you need stable sorting, you will have to implement your own sorting algorithm or find a library that provides one.
122122

123123
### Local Variable Limit
124124

docs/external-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: External Code
33
---
44

5-
In your `tstl` project, you might want to import some existing Lua code. Or, you might want to import a library from [npm](https://www.npmjs.com/). This page describes how to use external code.
5+
In your `tstl` project, you might want to use some existing Lua code. Or you might want to import a Lua library from [npm](https://www.npmjs.com/). This page describes how to use external Lua with your TypeScript code and TSTL.
66

77
:::note
88
This page is about importing code that **actually executes something**. In a `tstl` project, it is common to depend on external library that provide type declarations. Type declaration libraries only provide types: they do not contribute any code to your actual program output. Thus, they work a little differently from what is discussed on this page. For information on how type declarations work, see the [type declarations page](advanced/writing-declarations.md).

docs/getting-started.md

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ Note that we assume that you are already familiar with how TypeScript works. If
1111
TypeScriptToLua is built using [Node.js](https://nodejs.org/) and distributed via [npm](https://www.npmjs.com/). To install it, you need to create a `package.json` file in the root of your project, containing at least `{}`. Then, you can add the latest version of TypeScriptToLua to your project:
1212

1313
```bash
14-
# If you use npm:
15-
npm install --save-dev typescript-to-lua
16-
17-
# If you use yarn:
18-
yarn add --dev typescript-to-lua
19-
20-
# If you use pnpm:
21-
pnpm add --save-dev typescript-to-lua
14+
npm install --save-dev typescript-to-lua typescript
2215
```
2316

2417
(If you don't know the difference between the package managers, choose `npm`.)
@@ -49,39 +42,22 @@ TypeScriptToLua is configured using a `tsconfig.json` file. (This is the same fi
4942
}
5043
```
5144

52-
If your target Lua environment is not [LuaJIT](https://luajit.org/), make sure to change the value of `luaTarget`. Valid values are `JIT`, `5.3`, `5.2`, `5.1`, `5.0`, and `universal`.
45+
Make sure to set the value of `luaTarget` to the Lua version of your environment. Valid values are `JIT`, `5.4`, `5.3`, `5.2`, `5.1`, `5.0`, and `universal`.
5346

5447
:::note
5548
You can find out the version of your Lua environment by running: `print(_VERSION)`
5649
:::
5750

5851
Check out [configuration page](configuration.md) for more information.
5952

60-
### Strictest Configuration
61-
62-
If you want the TypeScript compiler to be as strict as possible, then you need to enable some additional flags. Handily, we can extend from [the "strictest" TypeScript community config](https://github.com/tsconfig/bases/blob/main/bases/strictest.json) to abstract this away by adding this to top of the `tsconfig.json` file:
63-
64-
```json
65-
// We extend the strictest base config:
66-
// https://github.com/tsconfig/bases/blob/main/bases/strictest.json
67-
"extends": "@tsconfig/strictest/tsconfig.json",
68-
```
69-
7053
## Building your project
7154

7255
Our command line interface is called `tstl` and it works almost exactly the same as TypeScript's `tsc`.
7356

7457
Since `tstl` is installed locally to your project, you cannot run it as a bare command in your terminal. Instead, use:
7558

7659
```bash
77-
# If you use npm:
78-
npx tstl
79-
80-
# If you use yarn (yarn also uses npx):
8160
npx tstl
82-
83-
# If you use pnpm:
84-
pnpm exec tstl
8561
```
8662

8763
:::note

docs/publishing-modules.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ Note that:
6161

6262
When you are ready to publish:
6363

64-
- Use `npm login` to cache your npm credentials.
6564
- Use `npm publish --dry-run` to see what files would be published without actually uploading anything.
6665
- Use `npm publish` to actually upload it.
6766

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"scripts": {
44
"start": "docusaurus start",
55
"build": "docusaurus build",
6-
"serve": "docusaurus serve",
76
"lint": "npm run lint:prettier",
87
"lint:prettier": "prettier --check .",
98
"fix:prettier": "prettier --write .",

sidebars.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"configuration",
99
"caveats",
1010
"the-self-parameter",
11+
"advanced/writing-declarations",
1112
"external-code",
1213
"publishing-modules",
1314
"editor-support"
@@ -16,13 +17,7 @@
1617
{
1718
"type": "category",
1819
"label": "Advanced",
19-
"items": [
20-
"advanced/writing-declarations",
21-
"advanced/compiler-annotations",
22-
"advanced/language-extensions",
23-
"json-modules",
24-
"jsx"
25-
]
20+
"items": ["advanced/language-extensions", "json-modules", "jsx", "advanced/compiler-annotations"]
2621
},
2722
{
2823
"type": "category",

0 commit comments

Comments
 (0)