Skip to content
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

Types for join collections not taking transform into account #396

Open
iduuck opened this issue Nov 10, 2024 · 4 comments
Open

Types for join collections not taking transform into account #396

iduuck opened this issue Nov 10, 2024 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@iduuck
Copy link

iduuck commented Nov 10, 2024

When I am trying to include a join in the transform function, everything (when in proper order) will be pulled into the joined collection, but the types are not correctly generated.

The types that are acruing from the transform function are not being pulled into the join collections types.

Here is a CodeSandbox: https://codesandbox.io/p/devbox/xhnr2g

And here is a screenshot of the tsc:
CleanShot 2024-11-10 at 17 05 09@2x

@sdorra
Copy link
Owner

sdorra commented Nov 10, 2024

This is a constraint for joining collections, as described here:

https://www.content-collections.dev/docs/transform#access-other-collections

@iduuck
Copy link
Author

iduuck commented Nov 10, 2024

So this is nothing in the pipeline/fixable right now?

FWIW, the data is actually there (as long as I am placing the joined collection (Post) before the joining collection (Category). I suppose this has something to do with the cache.

I am only speaking of the types, that are being generated.

@sdorra
Copy link
Owner

sdorra commented Nov 11, 2024

The problem are the types. I was not able to infer the types from a transformed collection. This is really difficult, because the types are the result of the transform function and parts of the resulting types are from the transform function. Can you understand my problem? IIf you have a solution to the problem, I'm more than happy to accept a PR.

@sdorra sdorra added enhancement New feature or request help wanted Extra attention is needed labels Nov 13, 2024
@iduuck
Copy link
Author

iduuck commented Nov 14, 2024

Jup, I get it.

The actual problem is, that the joined collections are only transformed, when coming before the joining collection.

I think this is a problem, that needs to be tackled before because otherwise this would result in possibly wrong types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants