Skip to content
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

Cannot find module 'slonik/dist/src/types' or its corresponding type declarations. #144

Open
inspiraller opened this issue Sep 27, 2024 · 1 comment

Comments

@inspiraller
Copy link

When I run latest build with updated slonik I get this typescript error:

Cannot find module 'slonik/dist/src/types' or its corresponding type declarations.

I have emulated your code locally and just discovered the type has changed from: SqlTaggedTemplate to SqlTag
Just replace this in your code fixes it:

declare module "fastify" {
interface FastifyRequest {
slonik: {
connect: (connectionRoutine: ConnectionRoutine) => Promise;
pool: DatabasePool;
query: QueryFunction;
};
sql: SqlTag<Record<never, never>>;
}

interface FastifyInstance {
slonik: {
connect: (connectionRoutine: ConnectionRoutine) => Promise;
pool: DatabasePool;
query: QueryFunction;
};
sql: SqlTag<Record<never, never>>;
}
}

@spa5k
Copy link
Owner

spa5k commented Nov 4, 2024

I tried doing that, but there seems to be even more changes in both Slonik and fastify when it comes to such a middleware and it isn't working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants