-
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(iam): conditions
parameters accept array values
#21009
Conversation
Because of the type declaration of `Conditions`, which was `{ [key: string}: any }`, and the way TypeScript interprets `any`, it was possible to pass arrays in where maps/objects were expected. Tighten up the type, which is now possible because of a change in jsii. Closes #20974.
// need to emit the type as `Map<String, ? extends Object>`. | ||
// | ||
// Feature request in https://github.com/aws/jsii/issues/1517 | ||
export type Condition = Record<string, unknown>; |
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 has all my non-full-context alarms blaring: is this a victimless change of 1 line, no dependencies?
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.
It should have been, but it doesn't work.
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.
Looking good now!
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Because of the type declaration of `Conditions`, which was `{ [key: string]: any }`, and the way TypeScript interprets `any`, it was possible to pass arrays in where maps/objects were expected. Change the type of `Condition` to `unknown`, which makes the type of `Conditions == { [key: string]: unknown }`. This makes TypeScript no longer accept arrays where objects were expected. Would love loved to make the type of `Condition == { [key: string]: unknown }` as well to be even tighter, but apparently we rely on being able to pass `CfnJson` in where a condition goes, which is an object. Closes aws#20974. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Because of the type declaration of
Conditions
, which was{ [key: string]: any }
, and the way TypeScript interpretsany
, it was possible to pass arrays in where maps/objects were expected.Change the type of
Condition
tounknown
, which makes the type ofConditions == { [key: string]: unknown }
. This makes TypeScript no longer accept arrays where objects were expected.Would love loved to make the type of
Condition == { [key: string]: unknown }
as well to be even tighter, but apparently we rely on being able to passCfnJson
in where a condition goes, which is an object.Closes #20974.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license