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

Return type of flatten/unflatten #179

Open
stychu opened this issue Sep 4, 2024 · 5 comments
Open

Return type of flatten/unflatten #179

stychu opened this issue Sep 4, 2024 · 5 comments
Labels

Comments

@stychu
Copy link

stychu commented Sep 4, 2024

How Do i get the result type being properly typed?? Instead I get unknown as a result of flatter/unflatten

unflatten(values);

function unflatten<{
    "locationDetails. id": string;
    "locationDetails. name": string;
    "locationDetails. storeFormat": {
        label: string;
        value: string;
    } | null;
    ... 40 more ...;
}, unknown>(     target: {},     options?: UnflattenOptions): unknown
@jonkoops
Copy link
Collaborator

jonkoops commented Sep 4, 2024

Can you provide a minimal and reproducible example of your issue?

@jonkoops jonkoops added the bug label Sep 4, 2024
@stychu
Copy link
Author

stychu commented Sep 4, 2024

Repro

@stychu
Copy link
Author

stychu commented Sep 4, 2024

This seem to work as I would expect the unflatten to work but do I need type casting for this library to work like this ?

UnFlatten type

@jonkoops
Copy link
Collaborator

jonkoops commented Sep 5, 2024

This seem to work as I would expect the unflatten to work but do I need type casting for this library to work like this ?

No you should not need to, this is certainly a bug of some sort.

@timvandam
Copy link

@jonkoops have you ever had this working? Judging by the code in previous releases this has never been a thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants