-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix: correct type definition for genReqId argument #4784
Changes from 4 commits
4d79842
811f327
ffec2d0
a2d04cd
8bed4ee
235ba7a
4c9533d
f98c4ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ expectAssignable<FastifyInstance>(fastify({ serverFactory: () => http.createServ | |
expectAssignable<FastifyInstance>(fastify({ caseSensitive: true })) | ||
expectAssignable<FastifyInstance>(fastify({ requestIdHeader: 'request-id' })) | ||
expectAssignable<FastifyInstance>(fastify({ requestIdHeader: false })) | ||
expectAssignable<FastifyInstance>(fastify({ genReqId: () => 'request-id' })) | ||
expectAssignable<FastifyInstance>(fastify({ genReqId: (req) => req.rawHeaders[1] || 'foo' })) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The actual typing test needs to be something like this: fastify({ genReqId: (req) => {
expectType<RawRequestDefaultExpression>(req)
}}) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this? expectAssignable<FastifyInstance>(fastify({ genReqId: (req) => {
expectType<RawRequestDefaultExpression>(req)
return 'foo'
} }))
expectAssignable<FastifyInstance<http.Server>>(fastify({ genReqId: (req) => {
expectType<http.IncomingMessage>(req)
return 'foo'
} }))
expectAssignable<FastifyInstance<http2.Http2Server>>(fastify({ http2: true, genReqId: (req) => {
expectType<http2.Http2ServerRequest>(req)
return 'foo'
} })) Are the other two checks completely redundant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I think they are unrelated to this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'll remove them |
||
expectAssignable<FastifyInstance>(fastify({ trustProxy: true })) | ||
expectAssignable<FastifyInstance>(fastify({ querystringParser: () => ({ foo: 'bar' }) })) | ||
expectAssignable<FastifyInstance>(fastify({ querystringParser: () => ({ foo: { bar: 'fuzz' } }) })) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So raw is false or undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, this way is more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, better