-
Notifications
You must be signed in to change notification settings - Fork 763
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
User-defined types - Conflicting types #10237
Comments
@slavizh Correct me if I'm wrong, but I think what you need here is a way to make the type of You can suppress the warning with If #9230 were in place, you could use a discriminated union to capture both states. Something along the lines of: type existingResourceGroupsType = {
variant: 'existing'
name: string
}
type newResourceGroupsType = {
variant: 'new'
name: string
location: string
tags: object
}
type resourceGroupsType = existingResourceGroupsType | newResourceGroupsType But that feature and the syntax that would be used have not been started. |
Yes, correct that is what I want ideally is to require certain parameters based on the value of another parameter. |
Not yet, but I believe it should be up soon since #9832 is tagged for the 0.16 release. The short version is that the postfix Upvotes and discussion for conditionally requiring properties is tracked in #9641, so I'm going to close this as a duplicate. The discriminated union feature (#9230) doesn't have finalized syntax yet but is being actively worked on. |
Bicep version
Bicep CLI version 0.15.31 (3ba6e06)
Describe the bug
I have the following code:
On the location value of the for the resourceGroupsRes I get warning like:
I am not sure how this can be resolved exactly but it seems cases like this could be quite common where user-defined types conflict with types on actual resources. As you can see location is not mandatory in my defined type as basically it is required only when create is set to true otherwise the resource is not deployed at all.
To Reproduce
Steps to reproduce the behavior:
shown
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: