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

Add documentation for adding TypeScript type to a custom type #379

Closed
thesunny opened this issue Jun 9, 2020 · 3 comments
Closed

Add documentation for adding TypeScript type to a custom type #379

thesunny opened this issue Jun 9, 2020 · 3 comments
Labels

Comments

@thesunny
Copy link
Collaborator

thesunny commented Jun 9, 2020

SuperStruct is able to return the proper typing information for a custom type but the documentation does not indicate how to do this.

Currently the documentation shows this:

const Email = struct('Email', isEmail)

Augment the documentation to show generics, possibly as a second example for TypeScript users only so as not to confuse JavaScript users:

const Email = struct<string>('Email', isEmail)
@thesunny
Copy link
Collaborator Author

thesunny commented Jun 9, 2020

Hi @ianstormtaylor,

I will PR most of these when I have time.

@ianstormtaylor
Copy link
Owner

@thesunny nice, that would be great!

I think maybe there should be an additional section in the guide called something like "Using TypeScript" and it would have these kinds of things. The other one is the StructType inferring utility.

@thesunny
Copy link
Collaborator Author

PR #393

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants