I am running into a type issue when I try to creat...
# typescript
w
I am running into a type issue when I try to create this IAM policy statement:
Copy code
Type '{ StringEquals: { "s3:prefix": string[]; }; StringLike?: undefined; }' is not assignable to type 'Conditions'.
              Property 'StringLike' is incompatible with index signature.
                Type 'undefined' is not assignable to type 'ConditionArguments'.
I think this is because I have different keys in the condition for each statement:
StringEquals
in one,
StringLike
in the other. Is this a possible bug in the
aws.iam.Conditions
interface? https://github.com/pulumi/pulumi-aws/blob/master/sdk/nodejs/iam/documents.ts#L98 cc @dazzling-memory-8548
w
Yes - this does appear to be a case of TypeScript contextual typing not flowing as well as you might hope. You can fix by inserting a cast - for instance just
as aws.iam.PolicyStatement[]
on the second to last line.
w
ok i'll do that — is there an opportunity for the interface to be improved to accommodate this? or is it purely a TS quirk?
w
I believe this is purely a TS quirk.