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

TResult = unknown[] needs extends {} constraint? #5280

Closed
lizthegrey opened this issue Jul 26, 2022 · 2 comments
Closed

TResult = unknown[] needs extends {} constraint? #5280

lizthegrey opened this issue Jul 26, 2022 · 2 comments

Comments

@lizthegrey
Copy link

lizthegrey commented Jul 26, 2022

Environment

Knex version: 2.2.0
Database + version: n/a (type check issue)
OS: Ubuntu 22.04
Typescript version: 4.8.0-beta (works fine with 4.7.4, so regression is from stricter type checking in 4.8)

tagging @lorefnon for typescript issue

Bug

.yarn/__virtual__/knex-virtual-a119e71548/0/cache/knex-npm-2.2.0-54a090c353-eff5161ece.zip/node_modules/knex/types/index.d.ts:453:33 - error TS2344: Type 'TRecord | TResult' does not satisfy the constraint '{}'.
  Type 'TResult' is not assignable to type '{}'.

453             | Knex.QueryBuilder<TRecord | TResult>
                                    ~~~~~~~~~~~~~~~~~

  .yarn/__virtual__/knex-virtual-a119e71548/0/cache/knex-npm-2.2.0-54a090c353-eff5161ece.zip/node_modules/knex/types/index.d.ts:447:38
    447       fn: <TRecord extends {} = any, TResult = unknown[]>(
                                             ~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends {}` constraint.


Found 1 error in .yarn/__virtual__/knex-virtual-a119e71548/0/cache/knex-npm-2.2.0-54a090c353-eff5161ece.zip/node_modules/knex/types/index.d.ts:453

This is probably https://devblogs.microsoft.com/typescript/announcing-typescript-4-8-beta/#unconstrained-generics-no-longer-assignable-to

@lizthegrey
Copy link
Author

Still broken with typescript 4.8 full release (now that it's out of beta)

@lizthegrey
Copy link
Author

Closed by #5279

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

1 participant