-
Notifications
You must be signed in to change notification settings - Fork 28
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
Update documentation in regard to new Babel macro #30
base: master
Are you sure you want to change the base?
Conversation
@dsagal Did you get a chance to take a look at this yet? Any thoughts? Don't worry about hurting my feelings or anything if you don't like it lol You can be blunt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder! It reads quite well. Including a couple of fairly minor suggestions.
const fooTypeSuite = getTypeSuite('./foo.ts', { /* options */ }); | ||
``` | ||
|
||
The code above would be transpiled into: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd skip this block. It's long, the details are mostly internal. How about something more illustrative. Maybe mention that the runtime description is generated from the interfaces found in './foo.ts'
, so that this becomes roughly equivalent to:
const fooTypeSuite = {
Square: t.iface([], {
"size": "number",
"color": t.opt("string")
})
};
See [ts-interface-checker documentation](https://github.com/gristlabs/ts-interface-checker#readme) for how to use the returned type suite in your code. | ||
|
||
The `getCheckers` macro function is also exported, as a convenience, to get a checker suite (with validator functions) directly | ||
instead of first getting a type suite and then creating a checker suite from it (using `ts-interface-checker`s `createCheckers` function). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd insert after "as a convenience" a colon and a code block with an example of how to call it, and a one-liner example how to use it.
|
||
The `getCheckers` macro function is also exported, as a convenience, to get a checker suite (with validator functions) directly | ||
instead of first getting a type suite and then creating a checker suite from it (using `ts-interface-checker`s `createCheckers` function). | ||
As with `getTypeSuite`, repeated calls to `getCheckers` using the same arguments will return the same object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: "For both getTypeSuite
and getCheckers
, "...
This PR:
@dsagal Are you ok with how I handled the 2nd point? I'm happy to change the organization however you like. Also you can feel free to take this PR and quickly change the organization however you like yourself.
Cheers 🍻