Skip to content

Commit 9ed37fd

Browse files
authored
Merge pull request #1045 from milesburton/patch-1
Added additional clarification, fixed typos
2 parents 34a94c6 + fe14467 commit 9ed37fd

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

website/pages/docs/setup.mdx

+11-16
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ yarn typia setup --manager yarn
3131

3232
If you're using standard TypeScript compiler, you can use [transform mode](#transformation).
3333

34-
Just run `npx typia setup` command, then everything be prepared.
34+
Assuming you are using [transformation mode] simply run `npx typia setup` which will provide sane defaults.
3535

3636
- Standard TypeScript Compiler: [Microsoft/TypeScript](https://github.com/microsoft/typescript)
3737

@@ -71,20 +71,13 @@ yarn typia generate \
7171
</Tab>
7272
</Tabs>
7373

74-
Otherwise you are using non-standard TypeScript compiler, then you can't use [transformation](#transformation) mode.
75-
76-
Instead, you can use [generation](#generation) mode.
77-
78-
Run `typia generate` command with `input` directory, then transformed TypeScript files would be generated into the `output` directory.
74+
If you are using a non-standard TypeScript compiler such as the following, you will need to fall back to [generation](#generation) mode
7975

8076
- Non-standard TypeScript Compilers
8177
- [SWC](https://swc.rs)
8278
- [ESBuild](https://esbuild.github.io/)
8379
- [Babel](https://babeljs.io/)
8480

85-
86-
87-
8881
## Transformation
8982
### Concepts
9083
AOT (Ahead of Time) compilation mode.
@@ -192,7 +185,7 @@ yarn add -D typescript ts-patch ts-node
192185

193186
If you want to install `typia` manually, just follow the steps.
194187

195-
At first, install `typia` as dependency. And then, install `typescript`, `ts-patch` and `ts-node` as `devDependencies`.
188+
Firstly install `typia` as a dependency. And then, install `typescript`, `ts-patch` and `ts-node` as `devDependencies`.
196189

197190
```json filename="tsconfig.json" copy showLineNumbers
198191
{
@@ -206,9 +199,9 @@ At first, install `typia` as dependency. And then, install `typescript`, `ts-pat
206199
}
207200
```
208201

209-
At second, open your `tsconfig.json` file and configure like above.
202+
Secondly open your `tsconfig.json` file as shown above.
210203

211-
As `typia` generates optimal operation code through transformation, you've to configure it as a `plugin`. Also, never forget to configure `strict` (or `strictNullChecks`) to be `true`. It is essential option for modern TypeScript development.
204+
As `typia` generates optimal operation code through transformation, it must be configured as a `plugin`. Also, never forget to configure `strict` (or `strictNullChecks`) to be `true` within your tsconfig.json `compilerOptions`. It is essential option for modern TypeScript development.
212205

213206
```json filename="package.json" copy showLineNumbers {2-4}
214207
{
@@ -245,9 +238,9 @@ yarn prepare
245238
</Tab>
246239
</Tabs>
247240

248-
At last, open `package.json` file and configure `npm run prepare` command like above.
241+
Finally open `package.json` file and configure `npm run prepare` command like above.
249242

250-
Of course, you've to run the `npm run prepare` command after the configuration.
243+
Be sure to run `npm run prepare` once you have made these changes
251244

252245
For reference, [`ts-patch`](https://github.com/nonara/ts-patch) is an helper library of TypeScript compiler that supporting custom transformations by plugins. From now on, whenever you run `tsc` command, your `typia` function call statements would be transformed to the optimal operation codes in the compiled JavaScript files.
253246

@@ -313,17 +306,19 @@ yarn typia generate \
313306

314307
For frontend projects.
315308

316-
If you're using non-standard TypeScript compiler, you can't use [transform mode](#transformation)
309+
If you are using a non-standard TypeScript compiler such as the following, you will need to fall back to [generation](#generation) mode
317310

318311
- Non-standard TypeScript compilers:
319312
- [SWC](https://swc.rs/) in Next.JS
320313
- [ESBuild](https://esbuild.github.io/) in Vite
321314
- [Babel](https://babeljs.io/) in Create-React-App
322315

323-
Instead, you should utilize the generation mode.
316+
Instead you should utilise the generation mode.
324317

325318
Install `typia` through `npm install` command, and run `typia generate` command. Then, generator of `typia` reads your TypeScript codes of `--input`, and writes transformed TypeScript files into the `--output` directory, like below.
326319

320+
For clarification, the input directory should contain one or more TypeScript files which define how you want to verify your associated type assertions. Commonly you will import your TypeScript type, then export a function which validates that type. See below.
321+
327322
If you want to specify other TypeScript project file instead of `tsconfig.json`, you can use `--project` option.
328323

329324
<Tabs items={['TypeScript Source Code', 'Generated TypeScript File']}>

0 commit comments

Comments
 (0)