node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Typescript: function returning string | {}?

Open cesco69 opened this issue 1 year ago • 5 comments

Why the get return type is string | {} ?

Image

cesco69 avatar Jul 09 '25 13:07 cesco69

@cesco69 can you provide more details about your environment, ts version, node version, node-redis version, etc..

nkaradzhov avatar Jul 10 '25 08:07 nkaradzhov

Hi, I have tried to make a replicable example, but with only node-redis it works, probably it is a third party dependencies...

cesco69 avatar Jul 10 '25 10:07 cesco69

Ok, closing this for now then

nkaradzhov avatar Jul 11 '25 08:07 nkaradzhov

If anyone stumbles upon this in the future, I had the same problem which I narrowed down to tsconfig. I needed to set strict true in order to make this error go away.

FYI @cesco69 @nkaradzhov

MxKaras avatar Aug 13 '25 10:08 MxKaras

// 关闭严格的空值检查(允许 null/undefined 赋值给非空类型,降低开发门槛;严谨项目可设为 true) "strictNullChecks": true,

Ace627 avatar Dec 07 '25 05:12 Ace627