Repository navigation
fix(lib/es5): Preserve Omit in output - #35889
ExE Boss (ExE-Boss) wants to merge 2 commits into
Conversation
|
I am pretty sure this option was considered when Since your type maps over type Omit2<T, K extends keyof any> = {
[P in Exclude<keyof T, K>]: T[P];
};
type U = {
a: number,
readonly b?: number
}
type R = Omit2<U, 'a'> // has b: number | undefined;
type R2 = Omit<U, 'a'> // has readonly b?: number | undefined; |
|
That is probably also why auto‑fix is broken with this. |
|
FYI: The documentation for "homomorphic" and Pick is here: https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types #35889 (comment) I tried but does not solve the problem 😂 |
|
Then my question is: why |
|
The reason is probably because this is the more correct declare function __assign<T, S>(target: T, source: S): Omit<T, keyof S> & S;To be 100% correct, the result should include properties from |
I’ve been using this without problems in my local version of the TypeScript library.
Fixes #34793