Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Accessing Data on Void #94

Closed
bezreyhan opened this issue Aug 26, 2019 · 1 comment
Closed

Accessing Data on Void #94

bezreyhan opened this issue Aug 26, 2019 · 1 comment

Comments

@bezreyhan
Copy link

I get type errors when trying to access nested data on a value that could be void.

For example:

const fetchData: Promise<void | {data: {nested: 1}}>;
const response = await fetchData();
const nested = idx(response, _ => _.data.nested);

I get the following error from TypeScript: Property 'data' does not exist on type 'void'

Since the type void will always be undefined or null, shouldn't the code above pass the type checker?

Btw, thanks for this tool!

@yungsters
Copy link
Contributor

There is no active development on this project. If you are interested in fixing this, you are encouraged to send a pull request with tests. I can help review (or find reviewers) and merge, then publish.

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

No branches or pull requests

2 participants