π 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