From 98ca7fd538c1f2ebc0ee5d71272d9dcd3f34601b Mon Sep 17 00:00:00 2001 From: Matt Mazzola Date: Tue, 18 Feb 2020 14:10:28 -0800 Subject: [PATCH] docs: fix header and body generic types (#2103) --- docs/TypeScript.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/TypeScript.md b/docs/TypeScript.md index 0cabc5313e..ea5aa35489 100644 --- a/docs/TypeScript.md +++ b/docs/TypeScript.md @@ -110,8 +110,8 @@ const opts: fastify.RouteShorthandOptions = { server.get('/ping/:bar', opts, (request, reply) => { console.log(request.query) // this is of type Query! console.log(request.params) // this is of type Params! - console.log(request.body) // this is of type Body! console.log(request.headers) // this is of type Headers! + console.log(request.body) // this is of type Body! reply.code(200).send({ pong: 'it worked!' }) }) ``` @@ -143,8 +143,8 @@ const opts: fastify.RouteShorthandOptions = { server.get('/ping/:bar', opts, (request, reply) => { console.log(request.query) // this is of type fastify.DefaultQuery! console.log(request.params) // this is of type Params! - console.log(request.body) // this is of type unknown! - console.log(request.headers) // this is of type fastify.DefaultHeader because typescript will use the default type value! + console.log(request.headers) // this is of type unknown! + console.log(request.body) // this is of type fastify.DefaultBody because typescript will use the default type value! reply.code(200).send({ pong: 'it worked!' }) }) @@ -155,8 +155,8 @@ server.get('/ping/:bar', opts, (request, server.get('/ping/:bar', opts, (request, reply) => { console.log(request.query) // this is of type unknown! console.log(request.params) // this is of type Params! - console.log(request.body) // this is of type unknown! console.log(request.headers) // this is of type unknown! + console.log(request.body) // this is of type unknown! reply.code(200).send({ pong: 'it worked!' }) }) ```