Property 'cache' does not exist on type QueryBuilder
Does anyone know what can cause this?
src/datasources/order-api.ts(17,8): error TS2551: Property 'cache' does not exist on type 'QueryBuilder<{}, DeferredKeySelection<{}, string, false, {}, false, {}, undefined>>'. Did you mean 'catch'?
Relevant packages: "knex": "^2.0.0" "datasource-sql": "^2.0.1",
I recently bumped the knex version to 2.0 but I am wondering if maybe the api changed?
Is this fixed or is there a workaround to this issue?
I think this is just a typing issue - typescript isn't seeing the knex type extension declared in index.d.ts, and is instead seeing the vanilla knex QueryBuilder type which doesn't include that function. The workaround that worked for me is just to add // @ts-ignore before the cache line:
.select('*')
.from("thing")
.limit(10)
// @ts-ignore
.cache(MINUTE);
Is there any other fix for this than ignoring the ts issue? Also got this now when I upgraded.
Also looking for a better fix for this. Adding ts-ignore has other side effects.
Is there any fix for this yet?
This should be resolved in 2.1.0 - thanks @daniel-keller