You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, toTypedshould recursively convert to the required typed structure.
By default this should retain laziness.
The text was updated successfully, but these errors were encountered:
Currently,
toTyped
is shallow. For example, givenwould correctly produce
if it did not throw on
fails
:This is why
deepToTyped
was developed. However,toTyped
should recursively convert to the required typed structure.By default this should retain laziness.
The text was updated successfully, but these errors were encountered: