Skip to content

Instantly share code, notes, and snippets.

@johnlokerse
Created November 2, 2023 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnlokerse/1618ce4322d06d17c19b02dc9c849cec to your computer and use it in GitHub Desktop.
Save johnlokerse/1618ce4322d06d17c19b02dc9c849cec to your computer and use it in GitHub Desktop.
Learn how to enhance objects with User-Defined Types in Azure Bicep blog
// Enforce string to be either 'This', 'Is' or 'Awesome'
type stringType = 'This' | 'Is' | 'Awesome'
// Enforce number to be either 1, 2, 3, 4 or 5
type intType = 1 | 2 | 3 | 4 | 5
// Enforce boolean to be true
type boolType = true
// Enforce to be an array of type string (look at the way of writing!)
type arrayType = string[]
// Enforce to be an array of allowed values: 'This', 'Is' or 'Awesome'
type arrayType2 = ('This' | 'Is' | 'Awesome')[]
// Enforcing to be an array of either 'This is awesome', 5, true or {}
type arrayMixedType = ('This is awesome' | 5 | true | {})[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment