1756 - Fix TypeScript Namespace Import Generation #1
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.
This was made in error!
Fixes #1756. Adds support to the TypeScript Visitor to generate import statements for property types in other namespaces in other generated files.
Checklist
Issue/User story
Steps to Reproduce
composer generator create
.Existing issues
When asking about the issue in Rocket Chat it was recommended to submit a GitHub Issue.
Design of the fix
The high level design of the fix is to find all non primitive property types within the class declarations, except enums, within a specific model and index them. Then the namespace imports for the specific model are also indexed and the types that aren't in the current file are added as TypeScript import statements importing the type from the file it is located in.
Validation of the fix
I've included the before and after generated files along with a diff of one of the files generated.
Automated Tests
Not sure what tests I should create for this, any suggestions are welcome and I will update accordingly.
What documentation has been provided for this pull request
Not sure what documentation I should generate, any suggestions are welcome.