Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote

Pkl doesn't support this today. One way to DRY up your code is to create a typealias that you share in both locations, e.g.

typealias RangeConditionId = "CHECK_RANGE_TO_TARGET"
typealias TargetStatusId = "CHECK_TARGET_STATUS"

typealias TargetedConditionEnum = RangeConditionId | TargetStatusId

class RangeCondition {
  conditionID: RangeConditionId
}

class StatusCondition {
  conditionID: TargetStatusId
}

The type of feature you're looking for (e.g. Scala's type projection, TypeScript's Pick) is quite useful, so, perhaps we can add it to Pkl some day. But right now it's quite unclear when something like this would land.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SublunarSage
Comment options

Answer selected by SublunarSage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants