Comments (6)
what do you think of having the decorator handling the return (as opposed to just checking it)?
class T {
@chainable
add(number) {
this.total += number;
}
}
from decoratethis.
Interesting. I guess so, why not
from decoratethis.
Actually, I've been thinking about this, and here is an opinion... Having a decorator called chainable
feels like a small piece of automation that doesn't actually add much value (it's just as easy and more explicit to return this
). And it feels like it's straying from the 'type-checking' purpose of this library. In fact, I think you should consider refocusing the whole library so it's not just a "mixed bag" of decorators, and instead it's purely decorators for adding type-checking to JS. In other words, get rid of "debounce", "curry" etc. (or put them in a separate lib). And change the name to something like "type-decorators" or "strict-type". The library is already 90% about type-checking anyway, and I think it might have more appeal if it was completely focused on it. You may disagree though.
from decoratethis.
did you mean to close this?
from decoratethis.
yeah, wont be adding it
from decoratethis.
any particular reason? do you have another way for verifying that a method returns this
?
from decoratethis.
Related Issues (11)
- SetOf(type) and other collection checkers HOT 3
- Decorator for type-checking 'rest parameters' HOT 1
- Multiple arguments in a single decorator HOT 1
- Optional function arguments support HOT 1
- Multi args @param validations HOT 1
- Generate documentations through `param` and `return`
- Instance specific HOT 2
- import examples seem to be wrong? HOT 1
- Build this before uploading HOT 1
- Type-checking for promise fulfillment values HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from decoratethis.