๐ Search Terms
Mapped type
unknown
๐ Version & Regression Information
- This changed between versions 4.7.4 and 4.8.4
โฏ Playground Link
https://www.typescriptlang.org/play?ts=5.4.0-dev.20231206#code/CYUwxgNghgTiAEYD2A7AzgF3gVwFw5QGsUkB3FAbgCgqMBPABwQEF4BeeAbwG0BpeAJYp4KEADcQMALr4oKOgF8qAemXx1APQD8NVfABySeAFEYMJDCrJ0WKPhTYIEeAB8CoAGZCQwV1wXsONR66vDaumqm5pbWmPAARvaOzm7YKJ7evm6sHNjBaqHhQA
๐ป Code
declare const u: unknown;
type A = {[K in never]: any}
// ^?
// No Error
const a: null | undefined | {} = u;
// ^?
// Error
const b: null | undefined | A = u;
// ^?
๐ Actual behavior
The types a and b appear to be the same, but only the assignment to b causes an error.
๐ Expected behavior
I'm not sure which is better, I think it's either no error or both errors.
Additional information about the issue
Both were errors in version 4.7.4
๐ Search Terms
Mapped type
unknown
๐ Version & Regression Information
โฏ Playground Link
https://www.typescriptlang.org/play?ts=5.4.0-dev.20231206#code/CYUwxgNghgTiAEYD2A7AzgF3gVwFw5QGsUkB3FAbgCgqMBPABwQEF4BeeAbwG0BpeAJYp4KEADcQMALr4oKOgF8qAemXx1APQD8NVfABySeAFEYMJDCrJ0WKPhTYIEeAB8CoAGZCQwV1wXsONR66vDaumqm5pbWmPAARvaOzm7YKJ7evm6sHNjBaqHhQA
๐ป Code
๐ Actual behavior
The types
aandbappear to be the same, but only the assignment tobcauses an error.๐ Expected behavior
I'm not sure which is better, I think it's either no error or both errors.
Additional information about the issue
Both were errors in version 4.7.4