Skip to content

Update documentation in regard to new Babel macro #30

Open
zenflow wants to merge 2 commits into
gristlabs:masterfrom
zenflow:patch-1
Open

Update documentation in regard to new Babel macro #30
zenflow wants to merge 2 commits into
gristlabs:masterfrom
zenflow:patch-1

Conversation

@zenflow

@zenflow zenflow commented Oct 23, 2020

Copy link
Copy Markdown
Contributor

This PR:

  1. Adds README documentation for the Babel macro added in PR Add babel macro #24
  2. Reorganizes the README to separate general info vs cli info vs macro info

@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 🍻

@zenflow

zenflow commented Nov 24, 2020

Copy link
Copy Markdown
Contributor Author

@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

@dsagal dsagal left a comment

Copy link
Copy Markdown
Member

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.

Comment thread README.md
const fooTypeSuite = getTypeSuite('./foo.ts', { /* options */ });
```

The code above would be transpiled into:

Copy link
Copy Markdown
Member

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")
    })
  };

Comment thread README.md
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).

Copy link
Copy Markdown
Member

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.

Comment thread README.md

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.

Copy link
Copy Markdown
Member

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, "...

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

Successfully merging this pull request may close these issues.

2 participants