DEV Community

Discussion on: Top JavaScript Trends of 2020

Collapse
 
aumayeung profile image
John Au-Yeung

At least there's this scaffold to start github.com/Microsoft/TypeScript-No...

Collapse
 
mateiadrielrafael profile image
Matei Adriel

Thats not what I was talking about, but take for example req.data, you can't safely use it, a good example of how to do things is koa, where Middleware is generic amd takes a type for your state so you dont have to worry about combinding middleware in wromg ways

Thread Thread
 
aumayeung profile image
John Au-Yeung

I think you have to make your own interfaces and type aliases to type the objects and return types of middleware the way you want. You can have dynamic properties in interfaces.

It's probably not as good as types built into libraries but at least it's an option.

Thread Thread
 
mateiadrielrafael profile image
Matei Adriel

I wasnt saying you cant do it, but its harder than it needs to be and not as flexible