In my base class, I'm instantiating something that I call BuildEnvironment. It's an @object() that takes a Directory when instantiated and provides some functions to get different variants of my build environment (e.g. with one toolchain installed or another). While preparing those Containers, it is supposed to copy some files in the from the Directory.
Now, when invoked directly, it works just fine. I have it saved in a @func() env: BuildEnvironment in the root object, so I can invoke it via dagger call env base just fine.
Instead, when I pass it to a third class in the constructor (which is actually building something with those toolchains), the BuildEnvironment object complains that this.myDirectory.file is not a function. Hard-enough to debug, I ended up doing throw new Error(this.myDirectory) in the constructor and a quite long base64 string got printed. If I print its typeof, it is also string.
My guess, without knowing your engine codebase, is that the directory is serialized while being passed across objects, but on the deser phase it is not correctly restored as Directory, and just left as a string representing its runtime state.
Any clues?