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

AutoPath not working? #287

Open
yaquawa opened this issue Jan 11, 2022 · 3 comments
Open

AutoPath not working? #287

yaquawa opened this issue Jan 11, 2022 · 3 comments

Comments

@yaquawa
Copy link

yaquawa commented Jan 11, 2022

I've just tried the code exactly as same as in the doc, but seems like it won't work.

declare function get<O extends object, P extends string>(
    object: O, path: AutoPath<O, P>
): Path<O, Split<P, '.'>>

declare const user: User

type User = {
    name: string
    friends: User[]
}

// works
const friendName = get(user, 'FFFFFFFFF') // this won't give any error
const friendFriendName = get(user, 'friends.40.friends.12.name')

// errors
const friendNames = get(user, 'friends.40.names')
const friendFriendNames = get(user, 'friends.40.friends.12.names')
@yaquawa yaquawa changed the title AutoPath not working? AutoPath not working? Jan 11, 2022
@omerman
Copy link

omerman commented Feb 4, 2022

#280

I have a code sandbox with examples of some more non working cases ;)

@manojdcoder
Copy link

Try using v9.3.0, that helped.

@omerman
Copy link

omerman commented May 11, 2022

@manojdcoder This lib is kind of dead. and it doesn't work. It helps on some cases.
Thanks for the suggestion anyways :)

https://codesandbox.io/s/immutable-cookies-iko29?file=/src/index.ts:125-157 (Taken from #280 )
If you modify here to 9.3 it will solve 1 issue out of 3.

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

3 participants