Add support for nullable types, map any as default type : fix #19, fix #31 #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for nullable types.
For this, refactor mapTableDefinitionToType() : values in tableDefinition are now objects which store several properties, currently : udtName, nullable, tsType.
It allowed me to store nullable property, and it brings some extensibility to handle future properties for columns (eg comments).
I did not put this behind a flag as initially considered, because I don't see any good reason to lost information about nullable type. If a user don't care about checking null types, he would necessarily have disabled
--strictNullChecks
so this won't disturb him.Considering this brings support for nullable types, I had to enable strictNullChecks and then I ran into null type error in src/index.ts L37 so I also made some changes here.
Also, as of now, SQL types which don't have defined mapping types will be converted to
any
type.NB : this PR is against master, there will be merge conflicts with #32
NB2 : once again, I was unable to make diff test succeed on my PC, although test/artifacts/osm.ts and test/example/osm.ts are identical in VS Code (perhaps a pb related to carriage return encoding ?)