Referencing module functions in typealias
type constraints?
#208
Unanswered
James-Ansley
asked this question in
Q&A
Replies: 1 comment
-
This reads like a straightforward name resolution issue, which #144 should indeed fix for you. Type aliases were being inlined entirely, without resolving names used in the constraints in their definition scope, leaving them to be resolved in their use site scope. Can you try the post-#144 version on your Pkl code? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am playing around with a package to validate strings against the New Zealand NHI standard. Ideally, I would like an importable type alias that encapsulates the validation logic.
Within one module (
nhi.pkl
), I have the type aliastypealias Nhi = ...
and a functionisValid
that checks if a string satisfies the standard. However, when I try to do:I get the error
Cannot find method `isValid`.
when I try to use this type alias in another moduleHowever, if I dynamically import the nhi module (from within itself), it works:
Based on #144 it seems type aliases are just inlined wherever they're used. But, Is this the intended way to create importable type aliases that reference other functions within a module? Not sure if I'm missing something in the docs.
Beta Was this translation helpful? Give feedback.
All reactions