You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on moving my Hapi server code to TS for many days now, and I'm stuck on cache migration, which is code that uses Catbox (redis).
Specifically, the problem is in registering the generateFunc method with a parameter other than Catbox.Id. I can't get the code to let me explicitly specify the type of the Id parameter, and I want the type because I'm pulling specific data from it in this method.
backend | Compilation error in /usr/src/app/src/datasource/cache/cache.layer.core.ts
backend | [ERROR] 10:33:14 ⨯ Unable to compile TypeScript:
backend | src/datasource/cache/cache.layer.core.ts(158,9): error TS2322: Type '(id: MyCacheId) =>
Promise<DataResultsObject>' is not assignable to type 'GenerateFunc<DataResultsObject>'.
backend | Types of parameters 'id' and 'id' are incompatible.
backend | Type 'Id' is not assignable to type 'MyCacheId'.
backend | Type 'string' is not assignable to type 'MyCacheId'.
The text was updated successfully, but these errors were encountered:
Runtime
Node
Runtime version
18
Module version
12.1.1
Used with
Hapi Server
Any other relevant information
I use TS 5 and latest catbox-redis
How can we help?
I'm working on moving my Hapi server code to TS for many days now, and I'm stuck on cache migration, which is code that uses Catbox (redis).
Specifically, the problem is in registering the generateFunc method with a parameter other than Catbox.Id. I can't get the code to let me explicitly specify the type of the Id parameter, and I want the type because I'm pulling specific data from it in this method.
I get error:
The text was updated successfully, but these errors were encountered: