Open Rafael-006 opened 3 years ago
Not maintaining TypeScript myself, fastify was probably not respected when #30 was introduced. Can you have a look at it @fominua?
Hey!
Haven't worked with fastify before, I need some time to get familiar with this and remember the changes in this merge.
@fominua @Rafael-006, did you find a solution?
I'm having typing issues in this same snippet.
No overload matches this call.
Overload 1 of 3, '(plugin: FastifyPluginCallback<HandleOptions & { i18next?: i18n | undefined; }, Server>, opts?: FastifyRegisterOptions<HandleOptions & { ...; }> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type '(instance: any, options: HandleOptions & { i18next?: i18n | undefined; }, next: NextFunction) => Handler' is not assignable to parameter of type 'FastifyPluginCallback<HandleOptions & { i18next?: i18n | undefined; }, Server>'.
Types of parameters 'next' and 'done' are incompatible.
Type '(err?: Error | undefined) => void' is not assignable to type 'NextFunction'.
Types of parameters 'err' and 'deferToNext' are incompatible.
Type 'string' is not assignable to type 'Error'.
Overload 2 of 3, '(plugin: FastifyPluginAsync<HandleOptions & { i18next?: i18n | undefined; }, Server>, opts?: FastifyRegisterOptions<HandleOptions & { ...; }> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type '(instance: any, options: HandleOptions & { i18next?: i18n | undefined; }, next: NextFunction) => Handler' is not assignable to parameter of type 'FastifyPluginAsync<HandleOptions & { i18next?: i18n | undefined; }, Server>'.
Overload 3 of 3, '(plugin: FastifyPluginCallback<HandleOptions & { i18next?: i18n | undefined; }, Server> | FastifyPluginAsync<HandleOptions & { ...; }, Server> | Promise<...> | Promise<...>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type '(instance: any, options: HandleOptions & { i18next?: i18n | undefined; }, next: NextFunction) => Handler' is not assignable to parameter of type 'FastifyPluginCallback<HandleOptions & { i18next?: i18n | undefined; }, Server> | FastifyPluginAsync<HandleOptions & { ...; }, Server> | Promise<...> | Promise<...>'.
Type '(instance: any, options: HandleOptions & { i18next?: i18n | undefined; }, next: NextFunction) => Handler' is not assignable to type 'FastifyPluginCallback<HandleOptions & { i18next?: i18n | undefined; }, Server>'.
@g7fernandes same problem this fixed ?
🐛 Bug Report
I am using this middleware in fastify application with typescript.
When i do compilation using tsc for my application, the type definition of 18next-http-middleware in node_modules throws error as mentioned below,
Expected behavior
I've registered this middleware in fastify and typescript configuration are done which includes node_modules to the outDir.
When i run tsc, expected the compilation to run successfully and output the js files in outDir.
Your Environment