Skip to content
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

Documentation stats wrong #69

Closed
Kanti opened this issue Mar 17, 2017 · 6 comments
Closed

Documentation stats wrong #69

Kanti opened this issue Mar 17, 2017 · 6 comments

Comments

@Kanti
Copy link

Kanti commented Mar 17, 2017

@Iridium.Validate('myValidator', x => x === 42)

Error:(12, 29) TS2345:Argument of type '(this: { validator: IValidationHandler; skmatc: Skmatc; fail(message?: string | undefined): Resul...' is not assignable to parameter of type 'IValidationHandler'.
Type 'boolean' is not assignable to type 'Result'.

@notheotherben
Copy link
Member

Thanks for bringing this discrepancy to my attention, I'll only be able to address it early next week but please let me know if you haven't managed to figure out how to actually declare validations and would like some help.

@Kanti
Copy link
Author

Kanti commented Mar 17, 2017

@Iridium.Validate( 'myValidator', function ( schema: any, data: any, path: string ) {
  return this.assert( data === 42 );
} )

Worked for me.

@jsdream
Copy link

jsdream commented Mar 28, 2017

Hi Benjamin!

Did you have an opportunity to take a look at this issue?

@notheotherben
Copy link
Member

Hi Vladyslav, yeah I'm actually planning on tackling both this and docs for #70 this evening - I just need to try and make sure the docs build correctly, sometimes a bit of a hassle when I update TypeScript.

@notheotherben
Copy link
Member

Hi @Kanti, do you mind reviewing the updates to the docs - specifically the README - and letting me know the changes clarify things for you satisfactorily?

One little note, you don't need to specify the types for the parameters on your decorator function - TypeScript will infer them correctly and also give you type suggestions for the this context, making it relatively easy to discover what functions are available for you to use. I've updated the README example to remove those as well, as I'm sure it may lead to some confusion.

@Kanti
Copy link
Author

Kanti commented Mar 28, 2017

Yes this clarifies it.

And thank you for your little note. 😉

@Kanti Kanti closed this as completed Mar 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants