Closed
Description
Bug Report
π Search Terms
key remapping, error message, 2345
π Version & Regression Information
- This is the behavior in every version I tried since key remapping was introduced in TS4.1; I don't see relevant FAQ entries
β― Playground Link
Playground link with relevant code
π» Code
function foo<T extends { [K in keyof T as `${Extract<K, string>}Oops`]: T[K] }>(x: T) { }
const x = { prop: 123 };
foo(x); // error!
// ~ <-- Argument of type '{ prop: number; }' is not assignable to parameter of type '{ propOops: number; }'.
// Property 'prop' is missing in type '{ prop: number; }' but required in type '{ propOops: number; }'. (2345)
π Actual behavior
The last line of the error message says that the property prop
is missing in the type { prop: number }
, but it's not.
π Expected behavior
The error should probably say
Property 'propOops' is missing in type '{ prop: number; }' but required in type '{ propOops: number; }'.
I guess the error message is using the original key when it should be using the remapped key? π€·ββοΈ