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

After upgrading from v4.2 to v4.3, same code reports [2589] #44787

Closed
zhaoyao91 opened this issue Jun 28, 2021 · 2 comments
Closed

After upgrading from v4.2 to v4.3, same code reports [2589] #44787

zhaoyao91 opened this issue Jun 28, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@zhaoyao91
Copy link

Bug Report

πŸ”Ž Search Terms

v4.3.4 2589

πŸ•— Version & Regression Information

  • This changed between versions v4.2.3 and 4.3.4

⏯ Playground Link

πŸ’» Code

type Ensure<X, Y> = X extends Y ? X : never;
type SafeKey<T> = T extends string | number ? `${T}` : never;
type SafeValue<O, K> = K extends keyof O ? O[K] : never;

export type Paths<O, P = ""> = O extends object
  ? {
      [K in keyof O]:
        | (P extends "" ? K : `${SafeKey<P>}.${SafeKey<K>}`)
        | Paths<O[K], P extends "" ? K : `${SafeKey<P>}.${SafeKey<K>}`>;
    }[keyof O]
  : never;

export type Get<O, P extends Paths<O>> = P extends `${infer X}.${infer XS}`
  ? Get<SafeValue<O, X>, Ensure<XS, Paths<SafeValue<O, X>>>>
  : SafeValue<O, P>;

πŸ™ Actual behavior

line 14 errored: Type instantiation is excessively deep and possibly infinite.(2589)

πŸ™‚ Expected behavior

all work

@zhaoyao91 zhaoyao91 changed the title After upgrade from v4.2 to v4.3, same code report [2589] After upgrading from v4.2 to v4.3, same code reports [2589] Jun 28, 2021
@andrewbranch
Copy link
Member

Duplicate of #43877

@andrewbranch andrewbranch marked this as a duplicate of #43877 Jun 28, 2021
@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Jun 28, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants