-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type inference limitations #251
Comments
Another issue is branded types. I understand limitations in this area, but working around this is difficult. In the code above, const asd = shopifyOrderLineItemId as (string | null)[]
... ${asd}, ... So the issue here is not really related to branded types, but to type casts inside the substitution template. This is probably similar to #234, as it only correctly considers identifiers (ie the variable) and not expressions (ie the inline type case) |
Getting some issues running the actual queries now. If I do not include type annotations manually,
This even happens for a query that takes two string[] inside of unnest, so a pretty straightforward situation. Update: |
Describe the bug
A clear and concise description of what the bug is.
Not sure if a bug or limitation, but types are not inferred accurately.
I have two ways of providing a
number[]
toUNNEST
, but one of them forces me to cast toint[]
while the other does notTo Reproduce
Steps to reproduce the behavior:
Example setup:
Expected behavior
A clear and concise description of what you expected to happen.
I would expect to not be forced to provide type hints like
:: int[]
. If I remove this cast I get errors. (ESLint: Invalid Query: function pg_catalog.unnest(text) does not exist(@ts-safeql/check-sql)
)However, if I replace
${workOrderId}
with${items.map(item => item.workOrderId)}
I am able to omit the :: int[]. The types of both isnumber[]
, so I would not expect thisScreenshots
If applicable, add screenshots to help explain your problem.
N/A
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: