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,
});
}
};
}
TypeError: Cannot read properties of undefined (reading 'kind')
No crash is expected, some type errors should be found instead.
π 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
π Actual behavior
running
tscresults in a crash:π Expected behavior
No crash is expected, some type errors should be found instead.
Additional information about the issue
No response