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

fix(typescript): fix cyclic type false positive #1117

Conversation

ruipserra
Copy link
Contributor

This fixes a false positive that was reported when linting recursive type definitions such as these:

type Last<T extends Array<any>> =
  T extends [infer Head] ?
    Head :
    T extends [infer _, ...infer Tail] ?
      Last<Tail> :
      unknown;

This fixes a false positive that was reported when linting recursive type
definitions such as these:

```ts
type Last<T extends Array<any>> =
  T extends [infer Head] ?
    Head :
    T extends [infer _, ...infer Tail] ?
      Last<Tail> :
      unknown;
```
@ruipserra
Copy link
Contributor Author

Oh, I think this was just fixed in e25d030 🙌

@ruipserra ruipserra closed this Dec 16, 2023
@strager
Copy link
Collaborator

strager commented Dec 17, 2023

Yes, it was fixed. (Apparently I squashed two commits together by mistake. Oops!)

I initially had your idea of not reporting if it was generic. However, that still reports false positives such as in type T = number extends string ? T : false; (because the false branch is taken).

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

Successfully merging this pull request may close these issues.

2 participants