Closed
Description
Bug Report
text[key]
on left infer tonever
??? but whytext[key]
on right infer tostring | number
?
π Search Terms
π Version & Regression Information
typescript - 4.5.0
- This is a crash
β― Playground Link
π» Code
interface Item {
id: number;
name: string;
age: number;
}
const form: Item = {
id: 99,
name: 'k',
age: 99,
};
const text: Item = {
id: 1,
name: 'εΌ δΈ',
age: 18,
};
(['id','name','age'] as const).forEach(key => {
text[key] = text[key];
});
// Type 'string | number' is not assignable to type 'never'.
// Type 'string' is not assignable to type 'never'.
π Actual behavior
bug occured
π Expected behavior
no bug