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

Support nullable type #19

Closed
abenhamdine opened this issue Dec 25, 2016 · 3 comments
Closed

Support nullable type #19

abenhamdine opened this issue Dec 25, 2016 · 3 comments

Comments

@abenhamdine
Copy link
Contributor

abenhamdine commented Dec 25, 2016

Hi and thx a lot for this module.

I just started to use this module, and I wonder if it's possible to generate typescript nullable type ?
Indeed, for ones who use typescript with --strictNullChecks flag, it would be very useful to generate types nullable with union type.

For example, for a SQL nullable string, it would generate type : string | null, etc.

I think it would be better to have this optional.

@abenhamdine abenhamdine changed the title [Feat. request] Support nullable type Support nullable type Dec 25, 2016
@xiamx
Copy link
Contributor

xiamx commented Dec 25, 2016

An idea would be to modifiy getTableDefinition to include SELECT is_nullable
Then use this information to generate : string | null or : string accordingly.

Hope this information can help you :)

@abenhamdine
Copy link
Contributor Author

OK, i will give a try.
Thx for the guidance.

@abenhamdine
Copy link
Contributor Author

Probably a good idea to try to merge https://github.com/gust/schemats/tree/enumtype first or implementing nullable type at the same time.

@xiamx xiamx closed this as completed in a0499fe Jan 16, 2017
xiamx added a commit that referenced this issue Jan 16, 2017
Add support for nullable types, map any as default type : fix #19, fix #31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants