mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 23:23:37 +01:00
🐛fixed properties not respected by toTyped()
#182
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @thomaspurchas on GitHub (Jul 8, 2024).
The
toTypedAPI doesn't respectfixedproperties on classes, resulting in the following unexpected outcome:produces
@hmonfleur commented on GitHub (Jul 10, 2024):
I don't think It's particular to fixed properties. I have the same kind of problem but with "normal" properties :
produces the following error :
Tried to read property `x` but its value is undefined.Which is understandable since :
produces :
If I'm missing something or if there is a way around it I'm interested :)
@holzensp commented on GitHub (Jul 18, 2024):
The point @thomaspurchas is making - I believe - is that he expected
typeto be"Parrot". What isn't being respected here, is thattoTypedignores thefixed-ness of the property.@hmonfleur commented on GitHub (Jul 23, 2024):
Ok, maybe I wrongly made a link between my problem and the one that @thomaspurchas raised.
Still there's a behavior that is not the one I would have expected when using
toTyped, i.e., it does not produce the same object as normal instantiation would have. I have found some partial workaround usingletto force evaluation at some points (I mean I think that's what it does) but it does not entirely solve the problem (in my case for instanciation of objects contained in attributes and produced by the instanciation of an object that are not instanciated when usingtoTypedresulting in empty attributes).Maybe I can sum that up and open a new issue about it.