You can accept two generic type parameters and forward one to the interface that you extend:
interface Props<T> {
property: T;
}
declare const props1: Props<string>;
props1.property; // string
// Forward the generic parameter T to the generic interface that it extends:
interface Extended<T, U> extends Props<T> {
another: U;
}
declare const props2: Extended<string, number>;
props2.property; // string
props2.another; // number
Or, make the base interface generic type fixed when using the extending interface:
// Only use one generic parameter and decide in advance that
// this interface will always use `string` for the base interface:
interface ExtendedAndPropertyIsString<U> extends Props<string> {
another: U;
}
declare const props3: ExtendedAndPropertyIsString<number>;
props2.property; // string
props2.another; // number
TS Playground
Ucompletely independent ofT? So then doesinterface PropChild<T, U> extends IProps<T> {propertyChild: U}meet your needs? If not, then please elaborate on what's missing.