-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix inferring the correct fn type (#218)
* simplify and make the issue aware by using expectType instead of expectAssignable * fix narrowing partially * fix typings * fix typings * fix * Apply suggestions from code review
- Loading branch information
Showing
4 changed files
with
142 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { FastifyPluginAsync } from "fastify"; | ||
|
||
type FastifyExampleAsync = FastifyPluginAsync<fastifyExampleAsync.FastifyExampleAsyncOptions>; | ||
|
||
declare namespace fastifyExampleAsync { | ||
|
||
export interface FastifyExampleAsyncOptions { | ||
foo?: 'bar' | ||
} | ||
|
||
export interface FastifyExampleAsyncPluginOptions extends FastifyExampleAsyncOptions { | ||
} | ||
export const fastifyExampleAsync: FastifyExampleAsync | ||
export { fastifyExampleAsync as default } | ||
} | ||
|
||
declare function fastifyExampleAsync(...params: Parameters<FastifyExampleAsync>): ReturnType<FastifyExampleAsync> | ||
|
||
export default fastifyExampleAsync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { FastifyPluginCallback } from "fastify"; | ||
|
||
type FastifyExampleCallback = FastifyPluginCallback<fastifyExampleCallback.FastifyExampleCallbackOptions>; | ||
|
||
declare namespace fastifyExampleCallback { | ||
|
||
export interface FastifyExampleCallbackOptions { | ||
foo?: 'bar' | ||
} | ||
|
||
export interface FastifyExampleCallbackPluginOptions extends FastifyExampleCallbackOptions { | ||
} | ||
export const fastifyExampleCallback: FastifyExampleCallback | ||
export { fastifyExampleCallback as default } | ||
} | ||
|
||
declare function fastifyExampleCallback(...params: Parameters<FastifyExampleCallback>): ReturnType<FastifyExampleCallback> | ||
|
||
export default fastifyExampleCallback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters