first draft of typings for typescript #69#71
Merged
amitguptagwl merged 2 commits intoNaturalIntelligence:masterfrom Apr 2, 2018
Merged
first draft of typings for typescript #69#71amitguptagwl merged 2 commits intoNaturalIntelligence:masterfrom
amitguptagwl merged 2 commits intoNaturalIntelligence:masterfrom
Conversation
needed for automatic discovery
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose / Goal
Some type definitions for external API, attempt to fix #69.
This PR doesn't change anything at runtime, it's only typing support for users use typescript.
It's not yet complete, but it is a start and better than nothing.
A different approach to create a separate typings file would be to convert the whole project to typescript. That would be a pretty big step and would also influence further development workflow, build process etc.
Outlook
Besides filling the gaps of this type definitions, it might be interesting to provide a second signature to
parsewhich takes a generic type. This could then be used as the return value.Thus, when the developer knows that the parsed XML will be in a certain structure,
It might look something like this, but I didn't try it:
Usage would then be
parse<Whatever>(myXmlData). In this case, Typescript would know that the output is of typeWhateverinstead of any. Without this extra definition, a similar result can be achieved withparse(myXmlData) as Whatever. Neither of those has any runtime impact, it's just at development time. I'm not sure if it is good practice, so I left it out for now.Type
[ ]Bug Fix
[ ]Refactoring / Technology upgrade
[x]New Feature