How do I require an Any? #316
Answered
by
ericzbeard
ericzbeard
asked this question in
Q&A
-
I need to define a class with a required property that can be anything, but open class Test {
hidden Foo: Any
// This works
// hidden Foo: Any?
hidden Str: String
Props {
["Foo"] = Foo
["Str"] = Str
}
}
t = new Test {
Foo {
Bar = "Baz"
}
// This works
// Foo = ""
Str = ""
} |
Beta Was this translation helpful? Give feedback.
Answered by
ericzbeard
Mar 15, 2024
Replies: 2 comments 7 replies
-
Ok I think I figured this out.. just need to replace |
Beta Was this translation helpful? Give feedback.
0 replies
-
You want
|
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think Dynamic is what I need. I'm modeling AWS CloudFormation registry schemas, which sometimes define properties as "object", which can be any valid YAML/JSON.