-
Notifications
You must be signed in to change notification settings - Fork 379
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
Add typescript types to knockout validation #670
base: master
Are you sure you want to change the base?
Conversation
Sorry @SomaticIT. I got distracted with getting a feature done and I didn't give you all the comments. I added 4 more comments that I missed the first time I provided comments. |
@gregveres, no problem! |
@SomaticIT @gregveres |
@SomaticIT @gregveres |
Would love to see this merge |
Hi, what's the status of this pull? I took the knockout.validation.d.ts file from these commits but found I had to make some small type parameter changes to make it work with the latest knockout code Extender now has a parameter |
@jeremycrippsbf, do not hesitate to create a patch file, I will integrate it in this PR and give some advices to help users waiting for this PR. |
I've seen two of the points made by @jeremycrippsbf but don't see the SubscribableFunctions not having a parameter in the current KO source. I also had to add another parent class to ObservableExtenderOptions to lose the compiler error. Patch below:
|
Hello, I fixed the knockout validation types based on knockout 3.5.1. Can you confirm? |
Hi, Looks good, works in my project when included directly (as does your related PR in knockout.mapping). Because you don't seem to get much traction getting these PRs merged, might I suggest making equivalent PRs into DefinitelyTyped, so people can make use of these before the library authors respond? If they do merge your PR then the DT definition for that library can be removed, but until that point these become a lot more useful :) |
Found another problem (I'm currently converting a large codebase!). The message property of a rule can be a string, or a function. The function part isn't shown in the examples, but can be seen here. I added:
then used this as the type of message on |
Since
knockout
3.5
is now publishing Typescript types in its own repository, I suggest to do the same here inknockout.validation
.This types are using the
knockout
embedded types as a base and extend them to addknockout.validation
features.Linked issue: knockout/knockout#2353