-
Notifications
You must be signed in to change notification settings - Fork 730
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
Automatic type casting in output #725
Labels
question
Further information is requested
Comments
Isn't this dangerous? Would TypeScript do this? I wouldn't think this would be a compile-time type error. If you have a type-error that is a false positive, you can wrap the value in an
I believe we are doing this today with the bits in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
ARM templates often have a mix of integer and number types sprinkled throughout. While it makes sense that a quantity should use an integer, sometimes properties that seem like they would be expressed as strings are actually supposed to be expressed as numbers.
Describe the solution you'd like
It'd be great if Bicep were aware of the expected types for each of the given properties and 1) automatically cast the value to the appropriate type in the output and 2) where that isn't possible, it then fails the build with a clear description of why it wasn't able to cast it (e.g. 'can't transform value with alphabetic characters to an integer'.
To some extent, this may be managed once Intellisense is added as it would presumably be aware that I put a string for a property expecting an integer, but to have logic that specifically cast it would open the door for more elaborate logic within Bicep (e.g. piece a number together by concatenating it as a series of strings, then Bicep automatically cast this string to an integer in the output).
The text was updated successfully, but these errors were encountered: