fastify/fastify-caching

cache::get returns void in typescript

juancarlovieri opened this issue · 3 comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.23.2

Plugin version

8.3.0

Node.js version

18.0.0

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

22.04

Description

When using local cache (e.g. fastify.cache.set and fastify.cache.get), fastify.cache.get returns void by typescript definition.

Steps to Reproduce

Use typescript and run const res = await fastify.cache.get('something')

res is void according to typescript and will result in compile error.

Expected Behavior

No response

@juancarlovieri

Can you have a look at #133 and maybe give feedback if a fastify.cache.get returns undefined if there is no value for the requested key and if in case without a callback it returns a promise?

Thank you

nevermind. tested

Sorry for the late reply, is it fixed in the PR?