-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merges into TKO #25
Comments
absolutely. The utils and observable functions are probably the most useful. |
Awesome, that's exactly what I was thinking. It shouldn't be hard; the one caveat is that I'd like to keep tko properly ES6 (i.e. not Typescript). It might be a good test case for how we set up descriptors. How do you think we should pick-and-choose what to merge? |
The existing utils/observble.fn packages are all small and can easily have the types stripped out and we should be left with idiomatic ES6; we'll just have to ensure that they get added to DefinitelyTyped for us in TS-land. I'm not sure what you mean by descriptors. This is probably going to be pretty subjective. I'd target anything that
|
I agree. By descriptors, speaking as someone quite Typescript illiterate, the files that I gather go alongside the .js files that add type-checking to existing functionality. (Is that a thing? .ds files?) |
Ahh, the declarations files, Having them alongside the source instead of in DefinitelyTyped could definitely help with making sure they get updated; things in DefinitelyTyped usually aren't updated right away. If you'd be willing to look at moving the tests — but not the source — to TS and using a hand written declaration file, then it'd become a lot more difficult to end up with declarations that don't match the source if you're updating the test every time you make a change to the module's exposed api. |
@brianmhunt Would you like me to play around with tko and experiment with the best way to go about this? I'm thinking utils.merge, utils.fromJS, and observable.fn.subscribeOnce are good candidates to begin with. Do you have any thoughts on observable.fn.increment and observable.fn.toString? toString could (should?) probably be added to the observable package directly. |
@caseyWebb Thanks, yes feel free to play around. I agree on the As for >>> x = ko.observable(4)
>>> x.modify(y => y + 5)
9
>>> x()
9 Then modify (fn, peek) { return this(fn(peek ? this.peek() : this())) } Thoughts? |
I wasn't aware of the new observable functions; I'm glad I looked because I was planning on implementing a few of those 😅 . I like |
@brianmhunt I'm coming back around to tko/knockout on the long arc of my todo list. I've started work on a branch in The first is adding a single definition file to each package, e.g.
The second is to add ts definition files alongside each source file, e.g.
Q: Why use the latter, more verbose, setup if the project isn't actually written in TypeScript? A: You can enable basic type-checking in JS files (in VS Code) by adding The modular setup would allow using the aformentioned |
Thanks @caseyWebb. I like the latter approach, too - great suggestion. |
Would you be interested in contributing some of this to tko / ko4?
The text was updated successfully, but these errors were encountered: