#Help withsuppressImplicitAnyIndexErrors :(

6 messages · Page 1 of 1 (latest)

lusty night
sour burrow
#

in only narrows the right hand side (the object), not the left hand side (the key). if you hover over path inside the if statement you'll see its type is exactly the same

#

maybe you would benefit from a library like express or fastify (my favourite is zodios) that handles creating api definitions, parsing query params from string literal paths like "/foo/:bar", and a bunch of other stuff that helps with type safety

#

that's not to say you cant make your own way of doing it, it's just not the simplest thing to implement

sour burrow
#

something like this might be a better way to structure things if you want to implement it yourself: