Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Small improvements in the documentation #3565

Merged
merged 1 commit into from Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Guides/Testing.md
Expand Up @@ -49,7 +49,7 @@ const server = require('./app')({

server.listen(3000, (err, address) => {
if (err) {
console.log(err)
server.log.error(err)
process.exit(1)
}
})
Expand Down
12 changes: 6 additions & 6 deletions docs/Reference/TypeScript.md
Expand Up @@ -51,16 +51,16 @@ in a blank http Fastify server.
}
```

*Note: Set `target` property in `tsconfig.json` to `es2017` or greater to avoid
[FastifyDeprecation](https://github.com/fastify/fastify/issues/3284) warning.*

3. Initialize a TypeScript configuration file:
```bash
npx tsc --init
```
or use one of the [recommended
ones](https://github.com/tsconfig/bases#node-10-tsconfigjson).

*Note: Set `target` property in `tsconfig.json` to `es2017` or greater to avoid
[FastifyDeprecation](https://github.com/fastify/fastify/issues/3284) warning.*

4. Create an `index.ts` file - this will contain the server code
5. Add the following code block to your file:
```typescript
Expand Down Expand Up @@ -228,16 +228,16 @@ can do it as follows:
},
},
},
(req, rep) => {
const { body: user } = req;
(request, reply) => {
const { body: user } = request;
/* user has type
* const user: StaticProperties<{
* name: TString;
* mail: TOptional<TString>;
* }>
*/
//...
rep.status(200).send(user);
reply.status(200).send(user);
}
);
```
Expand Down