fastify / fastify-caching

A Fastify plugin to facilitate working with cache headers
MIT License
201 stars 26 forks source link

cache::get returns void in typescript #132

Closed juancarlovieri closed 11 months ago

juancarlovieri commented 11 months ago

Prerequisites

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

Uzlopak commented 11 months ago

@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

Uzlopak commented 11 months ago

nevermind. tested

juancarlovieri commented 11 months ago

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