-
Notifications
You must be signed in to change notification settings - Fork 245
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
Reject Props arguments that have a property with the same name as a function parameter #268
Comments
rix0rrr
pushed a commit
that referenced
this issue
Oct 22, 2018
Restrict the usage of datatype parameters in functions, so that languages with keyword argument support can inline datatype parameters into the function declaration. This means it cannot share any field names with remaining function argument names. Fixes #268.
rix0rrr
added a commit
that referenced
this issue
Oct 23, 2018
Restrict the usage of datatype parameters in functions, so that languages with keyword argument support can inline datatype parameters into the function declaration. This means it cannot share any field names with remaining function argument names. Fixes #268.
rix0rrr
pushed a commit
that referenced
this issue
Oct 23, 2018
* **jsii:** use base interfaces for 'datatype' property ([#265](#265)) ([1c56902](1c56902)), closes [#264](#264) * **jsii:** use default jsx compiler options ([#261](#261)) ([bf1f586](bf1f586)), closes [aws/aws-cdk#830](aws/aws-cdk#830) * match behavioral interface to 'I'-prefix ([#271](#271)) ([03103f3](03103f3)) * require distinct argument and property names ([#272](#272)) ([4d2f268](4d2f268)), closes [#268](#268)
Merged
rix0rrr
added a commit
that referenced
this issue
Oct 23, 2018
Bug Fixes ======= * **jsii:** use base interfaces for 'datatype' property ([#265](#265)) ([1c56902](1c56902)), closes [#264](#264) * **jsii:** use default jsx compiler options ([#261](#261)) ([bf1f586](bf1f586)), closes [aws/aws-cdk#830](aws/aws-cdk#830) * match behavioral interface to 'I'-prefix ([#271](#271)) ([03103f3](03103f3)) * require distinct argument and property names ([#272](#272)) ([4d2f268](4d2f268)), closes [#268](#268)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given a signature like:
That works fine in TypeScript, but in languages where we want to "lift" a final props parameter into arguments to the function itself (like for example, keyword arguments in Python), this will fail because it will generate code like:
Which is an error, because there is a collision on the "real" function parameter names, and the lifted parameter names, and you can't have two parameters with the same name.
Ideally the JSII compiler would reject this method signature, and require one of the two names to change. Alternatively, if there were a way to either opt-in or opt-out of the lifting of
MyProps
into keyword arguments, that could also allow people a way to resolve this without requiring them to choose different names, they would just not lift that particular data type into keyword arguments.The text was updated successfully, but these errors were encountered: