mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Using type alias causes error where directly using the type doesn't #96
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 @jfharden on GitHub (Feb 29, 2024).
It is surprising (at least to me) that in the following pkl definition:
An error is thrown for prop1 on the PutStep saying:
However if instead of the typealias, I use the value of the typealias directly it is fine:
It seems I should be able to use a typealias anywhere I would use a type and get the same result.
I can't see in the documentation for type alias where this is mentioned.
Clearly the workaround is to not use a type alias and instead just redefine the complex type everywhere which is ok for now, but it's a surprising limitation.
Versions:
@stackoverflow commented on GitHub (Mar 1, 2024):
We are discussing the possibility to create recursive type aliases. But, indeed, this is not currently supported.