-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Typedefs don't support propertyName
#301
Comments
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
I can try... |
I think the only thing what we can do is to export something like interface PointOfViewRouteSpecificOptions {
layout?: string;
}
export type PointOfViewProperty<K extends string = 'view', T extends { [key: string]: any } = { [key: string]: any }, R = Promise<string>> =
Record<K, (page: string, data: T, opts?: PointOfViewRouteSpecificOptions) => R> And you have then to do in your own Project: declare module "fastify" {
interface RouteSpecificOptions extends
PointOfViewRouteSpecificOptions { }
interface FastifyReply extends
PointOfViewProperty<'render', object, FastifyReply>{
view: never;
}
interface FastifyInstance extends
PointOfViewProperty<'render', object, Promise<string>>{ {
view: never;
}
} |
Has anyone attempted this yet? I'm running my head into the wall trying to get this to work... |
Did you read my post? |
I did. I haven't attempted to change anything in If no one has attempted to get it to work, maybe I'll fork it and give it a shot tomorrow. That's why I was asking. |
what do you think about reply.render("propertyName", "/templates/index.ejs", { text: "text" }); |
Prerequisites
Fastify version
N/A
Plugin version
N/A
Node.js version
N/A
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
N/A
Description
In the
index.d.ts
file, I noticed that they extend theFastifyReply
type forview
, which doesn't take into account other property names (eg. I might chooserender
instead).Steps to Reproduce
N/A
Expected Behavior
The
d.ts
file should somehow account for custom property names.The text was updated successfully, but these errors were encountered: