Skip to content

How to amend in a for generator #718

Answered by HT154
djarnis73 asked this question in Q&A
Oct 21, 2024 · 1 comments · 7 replies
Discussion options

You must be logged in to vote

Gotcha, that makes a lot of sense. What you're doing is an application of the Class-as-a-function pattern!

I took a few minutes to digest your example and revise it a bit in a way that solves your immediate problem and here's what I came up with:

module Application

name: String
deployment: Deployment
// lots of fields and defaults has been removed for brevity

// this is purely for IDE autocomplete, you can add any common/frequent target names here but still accept any string
typealias Target = "prod"|"staging"|"test"|String

class Deployment {
  targets: Listing<Target>
  monitors: Listing<DatadogMonitor>
}

class DatadogMonitor {
  application_name_with_deploy_target: String
  name: St…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@djarnis73
Comment options

@HT154
Comment options

Answer selected by djarnis73
@djarnis73
Comment options

@holzensp
Comment options

@holzensp
Comment options

@HT154
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants