Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is <x> extends infer X ? <y> : never so used? #5

Closed
millsp opened this issue Jun 26, 2019 · 3 comments
Closed

Why is <x> extends infer X ? <y> : never so used? #5

millsp opened this issue Jun 26, 2019 · 3 comments
Labels
question More info is requested wiki It's nice to learn stuff

Comments

@millsp
Copy link
Owner

millsp commented Jun 26, 2019

馃 Question

Describe your question

The whole codebase is full of <x> extends infer X ? <y>: never

Search tags, topics

#extends #infer #lots #used

@millsp
Copy link
Owner Author

millsp commented Jun 26, 2019

I use this syntax to defer the evaluation of a type... Otherwise TS evaluates all the types in their full depth. This causes performance issues and is irrelevant because we only want to compute when we've received the type parameters. As a result, the ts-toolbelt types load fast.

But it is not the only use case. Like I said above, TS can complain that a type is too deep to compute, then you can force it to compute step by step. So I especially use this on recursive types (which are much deeper because they're recursive).

@millsp millsp closed this as completed Jun 26, 2019
@millsp millsp changed the title Why is <x> extends infer X ? <y>: never so used in the codebase? Why is <x> extends infer X ? <y>: never so used? Jun 26, 2019
@millsp millsp added the question More info is requested label Jun 26, 2019
@millsp millsp changed the title Why is <x> extends infer X ? <y>: never so used? Why is <x> extends infer X ? <y> : never so used? Jun 27, 2019
@millsp millsp added the wiki It's nice to learn stuff label Jun 27, 2019
@ekilah
Copy link

ekilah commented Oct 25, 2019

Can you add an example of real code from this project that does this to this wiki entry? It's hard to understand if/how x and X are related in your pseudocode <x> extends infer X ? <y>: never (or if the x's are even relevant, which I think they aren't)

@millsp
Copy link
Owner Author

millsp commented Oct 25, 2019

You can check this example out

Repository owner locked and limited conversation to collaborators Feb 2, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question More info is requested wiki It's nice to learn stuff
Projects
None yet
Development

No branches or pull requests

2 participants