You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working as intended as per #46429; the check needed for this to work does very bad things to compiler performance.
P extends T ? null : Omit<T, keyof P> is a distributive conditional type, so TS doesn't try to do it. If you can make it non-distributive like [P] extends [T] ? null : Omit<T, keyof P> then it should start working for you. If not, just use a type assertion and move on.
π Search Terms
"conditional type equality", "transitive generic type equality"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240926#code/C4TwDgpgBAKhC2YA2BDYEA8MB8UC8UAFGCgE4rwDOAXLAJT64BuA9gJYAmA3AFA9sA7dKQBmKAMbQAQoI6CA5gAUyFSlADePKFHgRKlFPIi1KwUgt4BfPoOFjJUAEoQBHCOYFKVVDVqhgPYABZPQMjWjhEVHQMAQBXJCRsKz5xFgFTKAAjWQVI5DRjWAQCmJlXBWVyKlw8P2JvGihyuU8q1QY8XDSMliQIADokFnkG6soB3X1DCDpeHh7M0hc3D3l86KKNwoxnV3dKxtr6knHaPdXD8c7cU9UBgNsQ6aNCeMS5vhE4gXFgNnS2VkWAANFBFFAIAAPdCuNRVf4oJBYbDYQjACIlTYosFgWiKBiabSLYDZFg-DjbdD4Ig3DSWXjaZbAOKkARkilU6AoNQ-ADWAhYAHd2TzilEdhDobCOGoYFAAPxQd5IKC0ADy8DYwFBUD5EBALBE4NRKR431+-0By32pBR6MxEpiOFxETotFYnF82mAxE+1nNPz+APZNtWAHEXAdxEikCB7RjxaVMC7-G7vVASRzXFyaTlXOjcZ8mSt3IQwwdPFywepHkJnmEillyTmsYVLP6vkGraHS6QAMqQcRsERsGOJECEQl+LPNzlt6kEfMcQjLvILiA1qaN2gAchELBYu47jKgFdI5b766dm40deCoRmtDnrZvJ54AfPkYE0djk7XVYbluj7hFA+6HsenznoOEDDqO45xlOXBAA
π» Code
π Actual behavior
Got the error:
Seems like the TS compiler should be able to figure out that
T extends T
istrue
?π Expected behavior
No error. Since
T extends T
should betrue
,null
should be assignable tonull
Additional information about the issue
This may be related to #27024 (comment) (?)
The text was updated successfully, but these errors were encountered: