Replies: 2 comments 1 reply
-
You probably can make use of
class Container {
dir: String(read*(this).keys.length > 0)
file: String(read?(dir + "/" + this) != null)
}
container: Container = new {
dir = "../workflows"
file = "x.pkl"
}
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the pointers. I experimented a bit. I could not get the "directory exist" feature to work (I did not try very hard so it is probably possible), but the following typealias works nice with files:
I can use it like:
And it will fail with:
If the file does not exist locally. This is good enough for my current needs. One tiny annoyance is that the intellij plugin is clever enough to determine that the expression |
Beta Was this translation helpful? Give feedback.
-
It would be nice to be able to check for existence of a file or directory as a type constraint check.
I was thinking something in the line of:
My use case is that I try to build a bunch of deployment config files (mix of kubernetes/drone) where some values point to files/directories where it would be nice to tell the user if file/dir could not be found.
Beta Was this translation helpful? Give feedback.
All reactions