Loading the Kaya editor…
type Email = string + {email: true}
type Score = number + {int: true, min: 0, max: 100}
type User = {
  name: string + {min: 1},
  email: Email,
  score: Score
}

// Try changing the score to 150 to see validation in action.
let user: User = {
  name: "Alice",
  email: "alice@example.com",
  score: 95
}
"Validated user: {{user | json}}"