I have an external type that comes from the library:
type Anything = Record<string, any>;
I want to override it and not allow usage of a specific key c
.
Results that I want to achieve:
type CustomAnything = Anything & { c?: never } // This is what I was able to come to, but it does not completely forbid the usage of the `c`. Undefined is allowed in this case
const a: CustomAnything = { a: 1, b: 2} // OK
const b: CustomAnything = { a: 1, c: undefined } // Error, because I want to prevent the use of `c` key
const c: CustomAnything = { a: 1, c: 2 } // Error, because I want to prevent the use of `c` key
const d: CustomAnything = { a: 1} // OK
Here is a playground. Any ideas how to achieve this?