Skip to content

Commit 60aa850

Browse files
committed
Keep test from #53059 (which now fails)
1 parent b454644 commit 60aa850

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// #52399
2+
type DataFetchFns = {
3+
Boat: {
4+
requiresLicense: (id: string) => boolean;
5+
maxGroundSpeed: (id: string) => number;
6+
description: (id: string) => string;
7+
displacement: (id: string) => number;
8+
name: (id: string) => string;
9+
};
10+
Plane: {
11+
requiresLicense: (id: string) => boolean;
12+
maxGroundSpeed: (id: string) => number;
13+
maxTakeoffWeight: (id: string) => number;
14+
maxCruisingAltitude: (id: string) => number;
15+
name: (id: string) => string;
16+
}
17+
}
18+
export type NoTypeParamBoatRequired<F extends keyof DataFetchFns['Boat']> = ReturnType<DataFetchFns['Boat'][F]>;
19+
type TypeHardcodedAsParameterWithoutReturnType<T extends 'Boat', F extends keyof DataFetchFns[T]> = DataFetchFns[T][F];
20+
export type allAreFunctionsAsExpected = TypeHardcodedAsParameterWithoutReturnType<'Boat', keyof DataFetchFns['Boat']>;
21+
export type returnTypeOfFunctions = ReturnType<allAreFunctionsAsExpected>; //string | number | boolean as expected
22+
export type SucceedingCombo = ReturnType<TypeHardcodedAsParameterWithoutReturnType<'Boat', keyof DataFetchFns['Boat']>>;
23+
export type FailingCombo<T extends 'Boat', F extends keyof DataFetchFns[T]> = ReturnType<TypeHardcodedAsParameterWithoutReturnType<T,F>>;
24+
export type TypeHardcodedAsParameter<T extends 'Boat', F extends keyof DataFetchFns[T]> = ReturnType<DataFetchFns[T][F]>;
25+
type VehicleSelector<T extends keyof DataFetchFns> = DataFetchFns[T];
26+
export type TypeHardcodedAsParameter2<T extends 'Boat', F extends keyof DataFetchFns[T]> = ReturnType<VehicleSelector<T>[F]>;
27+
export type TypeGeneric1<T extends keyof DataFetchFns, F extends keyof DataFetchFns[T]> = ReturnType<DataFetchFns[T][F]>;
28+
export type TypeGeneric2<T extends keyof DataFetchFns, F extends keyof DataFetchFns[T]> = ReturnType<DataFetchFns[T][T]>; // error
29+
export type TypeGeneric3<T extends keyof DataFetchFns, F extends keyof DataFetchFns[T]> = ReturnType<DataFetchFns[F][F]>; // error

0 commit comments

Comments
 (0)