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

"Extending kysely" example doesn't compile #1052

Closed
Andrey36652 opened this issue Jun 22, 2024 · 3 comments · Fixed by #1058
Closed

"Extending kysely" example doesn't compile #1052

Andrey36652 opened this issue Jun 22, 2024 · 3 comments · Fixed by #1058
Labels
documentation Improvements or additions to documentation

Comments

@Andrey36652
Copy link

Example https://kysely.dev/docs/recipes/extending-kysely#a-more-complex-example does not compile with error

src/db/kysely-helpers.ts:30:5 - error TS2322: Type 'AliasedRawBuilder<unknown, A>' is not assignable to type 'AliasedRawBuilder<R, A>'.
  Type 'unknown' is not assignable to type 'R'.
    'R' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.

30     return sql`(values ${values})`.as<A>(aliasSql)

kysely 0.27.3
typescript 5.4.4
ts-node 10.9.2

This error can be fixed by replacing string return sql`(values ${values})`.as<A>(aliasSql) with return sql`(values ${values})`.as<A>(aliasSql) as as AliasedRawBuilder<R, A>

@igalklebanov igalklebanov added the documentation Improvements or additions to documentation label Jun 23, 2024
@igalklebanov
Copy link
Member

Hey 👋

This is resolved with sql<R> instead of sql.

@Andrey36652
Copy link
Author

@igalklebanov can docs be fixed?

@igalklebanov
Copy link
Member

Yeah, should be resolved now.

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

Successfully merging a pull request may close this issue.

2 participants