Open
Description
Currently, toTyped
is shallow. For example, given
class Bird {
name: String
diet: Listing<String>
}
local example: Dynamic = new {
name = "Pigeon"
diet {
"seeds"
"fast food"
}
}
succeeds = example.toTyped(Bird).name
fails = example.toTyped(Bird)
would correctly produce
succeeds = "Pigeon"
if it did not throw on fails
:
–– Pkl Error ––
Expected value of type Listing, but got type Dynamic.
Value: new Dynamic { ?; ? }
3 | diet: Listing<String>
^^^^^^^^^^^^^^^
at repl#Bird.diet (repl:pkl0)
This is why deepToTyped
was developed. However, toTyped
should recursively convert to the required typed structure.
By default this should retain laziness.
Metadata
Assignees
Labels
No labels