-
Notifications
You must be signed in to change notification settings - Fork 28
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
--ignore-not-supported, GenericRecords to object, resolve namespaces #28
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing! Could you add tests for your changes? They would also make it easier to see what kinds of usage got fixed.
programPath.scope.rename(tsInterfaceCheckerIdentifier); | ||
programPath.scope.rename(onceIdentifier); | ||
programPath?.scope.rename(tsInterfaceCheckerIdentifier); | ||
programPath?.scope.rename(onceIdentifier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to add these "optional chaining" operators in this file?
With the optional chaining operators, if programPath
is somehow null | undefined
(which it should never be), the calls to .rename()
will be silently skipped, when we actually want an error instead (to let us know something went wrong)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I dont know why, but my Intellij idea tels me error is here. I'll reverted this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hasn't changed yet with your updates. If you want to get rid of the TS errors you can use !
instead of ?
, e.g.:
programPath?.scope.rename(onceIdentifier); | |
programPath!.scope.rename(onceIdentifier); |
and that doesn't change the compiled code.
I'm not sure why the TS error doesn't come up when building.. I guess the build is not using "strict null checks" (--strictNullChecks
), whereas your IDE is using strict null checks for some reason?
Do not throw exception on non supported features. GenericRecords transforms to object Namespaces content are parsed
784daf5
to
2005b68
Compare
5f15938
to
5592848
Compare
@Crusader4Christ It seems the new test ("should compile namespace to runtime code") is also responsible for testing So looking at the test you added, I can see how the "resolve namespaces" feature has been implemented.
Just trying to look at this holistically, in terms of support for namespaces in general. Maybe this is a good stepping stone & these issues can be left for later, since I guess it would be a bit of work between this lib & ts-interface-checker. |
Do not throw exception on non supported features.
GenericRecords transforms to object
Namespaces content are parsed