Skip to content

Commit 289ba80

Browse files
committed
Accept new baselines
1 parent 2eb3111 commit 289ba80

7 files changed

+155
-266
lines changed

tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt

Lines changed: 31 additions & 130 deletions
Large diffs are not rendered by default.

tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
7979
>ComponentType : ComponentType<P>
8080

8181
export type Shared<
82-
>Shared : Shared<InjectedProps, DecorationTargetProps>
82+
>Shared : any
8383

8484
InjectedProps,
8585
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(3,6): error TS2456: Type alias 'Shared' circularly references itself.
2+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(5,35): error TS2313: Type parameter 'DecorationTargetProps' has a circular constraint.
3+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(5,35): error TS2315: Type 'Shared' is not generic.
4+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(7,15): error TS2313: Type parameter 'P' has a circular constraint.
5+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(7,75): error TS2536: Type 'P' cannot be used to index type 'InjectedProps'.
6+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(7,100): error TS2536: Type 'P' cannot be used to index type 'DecorationTargetProps'.
7+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(7,127): error TS2536: Type 'P' cannot be used to index type 'DecorationTargetProps'.
8+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(15,16): error TS2315: Type 'Shared' is not generic.
9+
tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts(17,37): error TS2315: Type 'Shared' is not generic.
10+
11+
12+
==== tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts (9 errors) ====
13+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
14+
15+
type Shared< // Circularly self constraining type, defered thanks to mapping
16+
~~~~~~
17+
!!! error TS2456: Type alias 'Shared' circularly references itself.
18+
InjectedProps,
19+
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>
20+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21+
!!! error TS2313: Type parameter 'DecorationTargetProps' has a circular constraint.
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
!!! error TS2315: Type 'Shared' is not generic.
24+
> = {
25+
[P in Extract<keyof InjectedProps, keyof DecorationTargetProps>]: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never;
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27+
!!! error TS2313: Type parameter 'P' has a circular constraint.
28+
!!! related TS2751 tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts:5:35: Circularity originates in type at this location.
29+
~~~~~~~~~~~~~~~~
30+
!!! error TS2536: Type 'P' cannot be used to index type 'InjectedProps'.
31+
~~~~~~~~~~~~~~~~~~~~~~~~
32+
!!! error TS2536: Type 'P' cannot be used to index type 'DecorationTargetProps'.
33+
~~~~~~~~~~~~~~~~~~~~~~~~
34+
!!! error TS2536: Type 'P' cannot be used to index type 'DecorationTargetProps'.
35+
};
36+
37+
interface ComponentClass<P> {
38+
defaultProps?: Partial<P>; // Inference target is also mapped _and_ optional
39+
}
40+
41+
interface InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> {
42+
<P extends Shared<TInjectedProps, P>>(
43+
~~~~~~~~~~~~~~~~~~~~~~~~~
44+
!!! error TS2315: Type 'Shared' is not generic.
45+
component: ComponentClass<P>
46+
): ComponentClass<Omit<P, keyof Shared<TInjectedProps, P>> & TNeedsProps> & { WrappedComponent: ComponentClass<P> }
47+
~~~~~~~~~~~~~~~~~~~~~~~~~
48+
!!! error TS2315: Type 'Shared' is not generic.
49+
} // Then intersected with and indexed via Omit and &
50+
51+
interface Connect { // Then strictly compared with another signature in its context
52+
<TStateProps, TOwnProps>(
53+
mapStateToProps: unknown,
54+
): InferableComponentEnhancerWithProps<TStateProps, TOwnProps>;
55+
56+
<TDispatchProps, TOwnProps>(
57+
mapStateToProps: null | undefined,
58+
mapDispatchToProps: unknown,
59+
mergeProps: null | undefined,
60+
options: unknown
61+
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
62+
}
63+
64+
declare var connect: Connect;
65+
66+
const myStoreConnect: Connect = function(
67+
mapStateToProps?: any,
68+
mapDispatchToProps?: any,
69+
mergeProps?: any,
70+
options: unknown = {},
71+
) {
72+
return connect(
73+
mapStateToProps,
74+
mapDispatchToProps,
75+
mergeProps,
76+
options,
77+
);
78+
};
79+
80+
export {};
81+

tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
33
>Omit : Pick<T, Exclude<keyof T, K>>
44

55
type Shared< // Circularly self constraining type, defered thanks to mapping
6-
>Shared : Shared<InjectedProps, DecorationTargetProps>
6+
>Shared : any
77

88
InjectedProps,
99
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>

tests/baselines/reference/infiniteConstraints.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
tests/cases/compiler/infiniteConstraints.ts(3,37): error TS2536: Type '"val"' cannot be used to index type 'Extract<B[Exclude<keyof B, K>], { val: string; }>'.
12
tests/cases/compiler/infiniteConstraints.ts(4,37): error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.
23
tests/cases/compiler/infiniteConstraints.ts(31,43): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
34
tests/cases/compiler/infiniteConstraints.ts(31,63): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
45
tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
56
tests/cases/compiler/infiniteConstraints.ts(48,16): error TS2589: Type instantiation is excessively deep and possibly infinite.
67

78

8-
==== tests/cases/compiler/infiniteConstraints.ts (5 errors) ====
9+
==== tests/cases/compiler/infiniteConstraints.ts (6 errors) ====
910
// Both of the following types trigger the recursion limiter in getImmediateBaseConstraint
1011

1112
type T1<B extends { [K in keyof B]: Extract<B[Exclude<keyof B, K>], { val: string }>["val"] }> = B;
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
!!! error TS2536: Type '"val"' cannot be used to index type 'Extract<B[Exclude<keyof B, K>], { val: string; }>'.
1215
type T2<B extends { [K in keyof B]: B[Exclude<keyof B, K>]["val"] }> = B;
1316
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1417
!!! error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.

0 commit comments

Comments
 (0)