-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(cdk): don't use instanceof in App #1249
Conversation
Make the Stack instance test no longer use instanceof, which doesn't work properly in case of multiple installed copies of the library. This does not resolve but helps with #1245.
Not a fix but addresses the immediate symptoms |
@@ -438,7 +438,7 @@ export abstract class Referenceable extends StackElement { | |||
* | |||
* We do attribute detection since we can't reliably use 'instanceof'. | |||
*/ | |||
function isStack(construct: Construct): construct is Stack { | |||
export function isStack(construct: Construct): construct is Stack { |
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.
Can we make it a static method? Stack.isStack
(like Array.isArray
)?
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.
I wanted to do that, but I was worried it will conflict with stack.isStack = true
.
I didn't test, though, so I could.
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.
Worries unfounded, it does work.
Wouldn'tya know it, it's our friend C# again:
|
Maybe deprecate the public |
Make the Stack instance test no longer use instanceof, which doesn't
work properly in case of multiple installed copies of the library.
This does not resolve but helps with #1245.
Pull Request Checklist
Please check all boxes (including N/A items)
Testing
tests
manually executed (paste output to the PR description)
(currently maintained in a private repo).
Documentation
Title and description
fix(module): <title>
bug fix (patch)feat(module): <title>
feature/capability (minor)chore(module): <title>
won't appear in changelogbuild(module): <title>
won't appear in changelogBREAKING CHANGE: <describe exactly what changed and how to achieve similar behavior + link to documentation/gist/issue if more details are required>
Fixes #xxx
orCloses #xxx
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.