Skip to content

TS 5.8 TypeError: Cannot read properties of undefined (reading 'kind') #61351

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

Open
zxbodya opened this issue Mar 4, 2025 · 1 comment Β· May be fixed by #61352
Open

TS 5.8 TypeError: Cannot read properties of undefined (reading 'kind') #61351

zxbodya opened this issue Mar 4, 2025 · 1 comment Β· May be fixed by #61352
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@zxbodya
Copy link

zxbodya commented Mar 4, 2025

πŸ”Ž Search Terms

TypeError: Cannot read properties of undefined (reading 'kind')

πŸ•— Version & Regression Information

⏯ Playground Link

https://www.typescriptlang.org/dev/bug-workbench/?ts=5.8.2#code/KYDwDg9gTgLgBDAnmYcDKMCGNUF44DeAsAFBxyYBccAdgK4C2ARsFANynlPUDOMUASxoBzDiQC+Y0qEiw4AYwA2mHjzgAVYH2Jk4PYDAzZgACj7HqRnAEoC4zgi3x8J4NUw1E1uLgB8hB3IAM2g4E3kIGj44AG0Aa2BEABo4ADdMRTpgAF04CCC4AHkmACtgeRgAOmAafgEtV2tvHXJWhAALAR5K-UMsHBMWttb4xOzqdMzgJMDW8WsxNvtdSVJl0iA

πŸ’» Code

export type State = {
  a: number;
  b: string;
};

export class Test{
  setState(state: State){}
  test = (e: any) => {
    for (const [key, value] of Object.entries(e)) {
      this.setState({
        [key]: value,
      });
    }
  };
}

πŸ™ Actual behavior

running tsc results in a crash:

TypeError: Cannot read properties of undefined (reading 'kind')

πŸ™‚ Expected behavior

No crash is expected, some type errors should be found instead.

Additional information about the issue

No response

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Mar 28, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants