-
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(sfn) Pass: support more types for result #2811
Conversation
Not sure how I should interpret this error (from Travis build log):
|
Union types are not supported in jsii (which is the tech we use to package the CDK code to multiple programming languages), because it's impossible to express union types in most languages. What we normally do in those cases is implement a "union-like class". For example see the |
@@ -51,7 +51,7 @@ export interface PassProps { | |||
* | |||
* @default No injected result | |||
*/ | |||
readonly result?: {[key: string]: any}; | |||
readonly result?: {[key: string]: any} | string | number | boolean | null | any[]; |
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.
We can't use type unions, at least not like this.
Is this actually blocking you somewhere?
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.
My previous state machine (0.33.0) was using result: true
, which I had to modify to result: {something: true}
when upgrading to 0.34.0.
My intuition was that if CFN supports a feature (in this case, result
can be {[key: string]: any} | string | number | boolean | null | any[]
), the CDK should allow it. Correct me if I'm wrong here :)
I can explore going down the "union-like class" path if you prefer.
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.
Yes, that will have to be the solution then.
8e9ec3d
to
b5794ad
Compare
Brings back compatibility for some types that were deleted by #2701
These types are supported, as exemplified by the following stack:
BREAKING CHANGE:
Pass.result
needs to be built usingsfn.Result.fromXXX()
Pull Request Checklist
design
folderBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.