🔎 Search Terms
type predicate mapped
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about type system behavior
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.2.2#code/IYIwzgLgTsDGEAJYBthjAgglEBLawUAngDwAqAfAgN4BQCCokM8SwAdgMoAWUu7AawDq+bgHsArhADCY9hACmADwgAKAG7BkEhQC4EEwezEB3dgEp9m7QoS4MZANy16jcAVZKiAL2+kAqhjKiuwAJhiGAsZmANoAuhSqrgxK+tQIMQDSduwIAgpEYgBmCIFx+oFZcQgAvgA0rpZYOPgwxCSBFM41LkweiChoGACyRNh4BO2UCMEKYRjjrYSk03QMfSyIXr4BQSpz4QZGpuzxickIqTQZ2fx5BcWlYOVPVbUNDE2Lk7tdtD1AA
💻 Code
abstract class Arbitrary<T> {
abstract canShrinkWithoutContext(value: unknown): value is T;
abstract xyzzy<Us extends unknown[]>(
x: { [K in keyof Us]: Us[K] },
): Arbitrary<Us>;
}
abstract class MyArbitrary<T> extends Arbitrary<T> {
abstract xyzzy<Us extends unknown[]>(
x: { [K in keyof Us]: Us[K] },
): Arbitrary<Us>;
}
🙁 Actual behavior
The compiler reports an error in MyArbitrary unless canShrinkWithoutContext is removed or its return type is changed.
🙂 Expected behavior
The xyzzy method should be overridden in the derived class.
Additional information about the issue
No response
🔎 Search Terms
type predicate mapped
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.2.2#code/IYIwzgLgTsDGEAJYBthjAgglEBLawUAngDwAqAfAgN4BQCCokM8SwAdgMoAWUu7AawDq+bgHsArhADCY9hACmADwgAKAG7BkEhQC4EEwezEB3dgEp9m7QoS4MZANy16jcAVZKiAL2+kAqhjKiuwAJhiGAsZmANoAuhSqrgxK+tQIMQDSduwIAgpEYgBmCIFx+oFZcQgAvgA0rpZYOPgwxCSBFM41LkweiChoGACyRNh4BO2UCMEKYRjjrYSk03QMfSyIXr4BQSpz4QZGpuzxickIqTQZ2fx5BcWlYOVPVbUNDE2Lk7tdtD1AA
💻 Code
🙁 Actual behavior
The compiler reports an error in
MyArbitraryunlesscanShrinkWithoutContextis removed or its return type is changed.🙂 Expected behavior
The
xyzzymethod should be overridden in the derived class.Additional information about the issue
No response