Skip to content

Commit 43e39bf

Browse files
author
alex
committed
docs(microservices): add typings to Metadata and call
1 parent c2cb6ab commit 43e39bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/microservices/grpc.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Next, we need to implement the service. To define a handler that fulfills this d
123123
@Controller()
124124
export class HeroesController {
125125
@GrpcMethod('HeroesService', 'FindOne')
126-
findOne(data: HeroById, metadata: any, call: any): Hero {
126+
findOne(data: HeroById, metadata: Metadata, call: ServerUnaryCall<any>): Hero {
127127
const items = [
128128
{ id: 1, name: 'John' },
129129
{ id: 2, name: 'Doe' },
@@ -160,7 +160,7 @@ Both `@GrpcMethod()` decorator arguments are optional. If called without the sec
160160
@Controller()
161161
export class HeroesController {
162162
@GrpcMethod('HeroesService')
163-
findOne(data: HeroById, metadata: any, call: any): Hero {
163+
findOne(data: HeroById, metadata: Metadata, call: ServerUnaryCall<any>): Hero {
164164
const items = [
165165
{ id: 1, name: 'John' },
166166
{ id: 2, name: 'Doe' },
@@ -189,7 +189,7 @@ You can also omit the first `@GrpcMethod()` argument. In this case, Nest automat
189189
@Controller()
190190
export class HeroesService {
191191
@GrpcMethod()
192-
findOne(data: HeroById, metadata: any, call: any): Hero {
192+
findOne(data: HeroById, metadata: Metadata, call: ServerUnaryCall<any>): Hero {
193193
const items = [
194194
{ id: 1, name: 'John' },
195195
{ id: 2, name: 'Doe' },
@@ -456,7 +456,7 @@ You can send metadata from `@GrpcMethod()` using the function `sendMetadata()` w
456456
@Controller()
457457
export class HeroesService {
458458
@GrpcMethod()
459-
findOne(data: HeroById, metadata: any, call: any): Hero {
459+
findOne(data: HeroById, metadata: Metadata, call: ServerUnaryCall<any>): Hero {
460460
const srvMetadata = new Metadata();
461461
const items = [
462462
{ id: 1, name: 'John' },

0 commit comments

Comments
 (0)