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

Ban Object Values null | undefined | unknown #3

Closed
codyduong opened this issue Mar 20, 2022 · 2 comments
Closed

Ban Object Values null | undefined | unknown #3

codyduong opened this issue Mar 20, 2022 · 2 comments
Assignees

Comments

@codyduong
Copy link
Owner

codyduong commented Mar 20, 2022

I should add docs for banned object key values. This utility is used to parse through known results. As such there should be no point where the object provided returns a null | undefined | unknown | never in a key/value pair. These types all break the inference engine I made.

That or I change the inference engine to work on these. The only problem being is we often use these values as internal delimiters to decide when to stop deeply recursing through the object, soo...

Really, if the user of this library does not know the type, they should instead use any

@codyduong codyduong self-assigned this Mar 20, 2022
@codyduong codyduong changed the title Banned Object Key Values Ban Object Values null | undefined | unknown | never Mar 20, 2022
@codyduong codyduong changed the title Ban Object Values null | undefined | unknown | never Ban Object Values null | undefined | unknown | never | any Mar 20, 2022
@codyduong codyduong changed the title Ban Object Values null | undefined | unknown | never | any Ban Object Values null | undefined | unknown | any Mar 20, 2022
@codyduong
Copy link
Owner Author

Due to the way I wrote the inference engine, any also blows it up.

This may be something I never fix, seeing as most users should know the return of their API data. If they don't, they should instead opt to type something as never.

@codyduong codyduong pinned this issue Mar 20, 2022
@codyduong
Copy link
Owner Author

^ Nevermind, I was prematurely removing node navigations with this line. Even though we check later deeper down in the node if we are any. This should fix #2 and this issue.

nav/src/index.ts

Lines 43 to 44 in 21e7a94

: O extends Record<string, infer OV> | Readonly<Record<string, infer OV>>
? IsStrictlyAny<OV>

@codyduong codyduong changed the title Ban Object Values null | undefined | unknown | any Ban Object Values null | undefined | unknown Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant