diff --git a/src/types/__tests__/effector/fork.test.ts b/src/types/__tests__/effector/fork.test.ts index b2b156d12..a84a0cf50 100644 --- a/src/types/__tests__/effector/fork.test.ts +++ b/src/types/__tests__/effector/fork.test.ts @@ -144,8 +144,11 @@ describe('fork values', () => { Type '[StoreWritable, number] | [StoreWritable, string]' is not assignable to type 'readonly [StoreWritable, number]'. Type '[StoreWritable, string]' is not assignable to type 'readonly [StoreWritable, number]'. Type at position 0 in source is not compatible with type at position 0 in target. - Type 'StoreWritable' is not assignable to type 'StoreWritable'. - Type 'string' is not assignable to type 'number'. + The types of 'on' are incompatible between these types. + Type '{ (trigger: Unit, reducer: (state: string, payload: E) => string | void): StoreWritable; (triggers: Unit[], reducer: (state: string, payload: E) => string | void): StoreWritable<...>; >(triggers: E, reducer: (state: string, payload: InferValueFromTupleOfUnits<...>) => string ...' is not assignable to type '{ (trigger: Unit, reducer: (state: number, payload: E) => number | void): StoreWritable; (triggers: Unit[], reducer: (state: number, payload: E) => number | void): StoreWritable<...>; >(triggers: E, reducer: (state: number, payload: InferValueFromTupleOfUnits<...>) => number ...'. + Types of parameters 'reducer' and 'reducer' are incompatible. + Types of parameters 'state' and 'state' are incompatible. + Type 'string' is not assignable to type 'number'. " `) }) diff --git a/src/types/__tests__/effector/forward.test.ts b/src/types/__tests__/effector/forward.test.ts index 5db9f97f9..2afd7f47b 100644 --- a/src/types/__tests__/effector/forward.test.ts +++ b/src/types/__tests__/effector/forward.test.ts @@ -132,11 +132,7 @@ describe('forward with subtyping', () => { forward({from: strOrNum, to: str}) expect(typecheck).toMatchInlineSnapshot(` " - Type 'EventCallable' is not assignable to type 'UnitTarget | readonly UnitTarget[]'. - Type 'EventCallable' is not assignable to type 'EventCallable'. - Types of parameters 'payload' and 'payload' are incompatible. - Type 'string | number' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. + no errors " `) }) @@ -219,21 +215,17 @@ describe('any to void support', () => { Type 'EventCallable' is not assignable to type 'Unit'. Types of property '__' are incompatible. Type 'string' is not assignable to type 'void'. - Type 'EventCallable' is not assignable to type 'UnitTarget'. - Type 'EventCallable' is not assignable to type 'EventCallable'. - Types of property 'prepend' are incompatible. - Types of parameters 'fn' and 'fn' are incompatible. - Type 'void' is not assignable to type 'string'. + Type 'EventCallable' is not assignable to type 'UnitTargetable'. + Types of property '__' are incompatible. + Type 'string' is not assignable to type 'void'. No overload matches this call. The last overload gave the following error. Type 'EventCallable' is not assignable to type 'Unit'. Types of property '__' are incompatible. Type 'string' is not assignable to type 'void'. - Type 'EventCallable' is not assignable to type 'UnitTarget'. - Type 'EventCallable' is not assignable to type 'EventCallable'. - Types of property 'prepend' are incompatible. - Types of parameters 'fn' and 'fn' are incompatible. - Type 'void' is not assignable to type 'string'. + Type 'EventCallable' is not assignable to type 'UnitTargetable'. + Types of property '__' are incompatible. + Type 'string' is not assignable to type 'void'. " `) }) @@ -298,18 +290,8 @@ test('edge case #1 (should fail)', () => { " No overload matches this call. The last overload gave the following error. - Type 'EventCallable' is not assignable to type 'Unit<{ value: { value: string; }; }>'. - Types of property '__' are incompatible. - Type 'string' is not assignable to type '{ value: { value: string; }; }'. - Type 'Event<{ value: { value: string; }; }>' is not assignable to type 'UnitTarget<{ value: { value: string; }; }> | readonly UnitTarget<{ value: { value: string; }; }>[]'. - Property 'prepend' is missing in type 'Event<{ value: { value: string; }; }>' but required in type 'EventCallable<{ value: { value: string; }; }>'. - No overload matches this call. - The last overload gave the following error. - Type 'EventCallable' is not assignable to type 'Unit<{ value: { value: string; }; }>'. - Types of property '__' are incompatible. - Type 'string' is not assignable to type '{ value: { value: string; }; }'. - Type 'Event<{ value: { value: string; }; }>' is not assignable to type 'UnitTarget<{ value: { value: string; }; }> | readonly UnitTarget<{ value: { value: string; }; }>[]'. - Property 'prepend' is missing in type 'Event<{ value: { value: string; }; }>' but required in type 'EventCallable<{ value: { value: string; }; }>'. + Type 'Event<{ value: { value: string; }; }>' is not assignable to type 'UnitTargetable | readonly UnitTargetable[]'. + Type 'Event<{ value: { value: string; }; }>' is missing the following properties from type 'readonly UnitTargetable[]': length, concat, join, slice, and 24 more. " `) }) @@ -365,7 +347,7 @@ describe('array support', () => { The last overload gave the following error. Type 'EventCallable' is not assignable to type 'UnitTargetable'. Types of property '__' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. " `) }) diff --git a/src/types/__tests__/effector/generated/sampleArrayTarget.test.ts b/src/types/__tests__/effector/generated/sampleArrayTarget.test.ts index 799a5e2ff..c5630478d 100644 --- a/src/types/__tests__/effector/generated/sampleArrayTarget.test.ts +++ b/src/types/__tests__/effector/generated/sampleArrayTarget.test.ts @@ -1065,12 +1065,16 @@ const typecheck = '{global}' Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number]; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, string]>[]; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: (EventCallable<[number]> | EventCallable<[number, string]>)[]; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string] | [number]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string] | [number]; }[]; }'. Argument of type '{ source: readonly [StoreWritable, StoreWritable]; target: EventCallable<[number]>[]; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number]; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number]>[]; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number]; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, string]>[]; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: (EventCallable<[number]> | EventCallable<...>)[]; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string] | [number]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string] | [number]; }[]; }'. Argument of type '{ source: readonly [StoreWritable, StoreWritable]; clock: EventCallable; target: EventCallable<[number]>[]; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number]; }[]; }'. " @@ -1279,10 +1283,14 @@ const typecheck = '{global}' Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AN; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable[]; fn: ([a, b]: (string | number)[]) => { a: string | number; b: string | number; }; }' is not assignable to parameter of type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AB; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AB; }[]; }'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: (EventCallable | EventCallable)[]; fn: ([a, b]: (string | number)[]) => { ...; }; }' is not assignable to parameter of type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AN; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AN; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable[]; fn: ([a, b]: (string | number)[]) => { ...; }; }' is not assignable to parameter of type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AN; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AN; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable[]; fn: ([a, b]: (string | number)[]) => { ...; }; }' is not assignable to parameter of type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AB; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AB; }[]; }'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: (EventCallable | EventCallable<...>)[]; fn: ([a, b]: (string | number)[]) => { ...; }; }' is not assignable to parameter of type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AN; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"fn result should extend target type\\"; targets: { fnResult: { a: string | number; b: string | number; }; targetType: AN; }[]; }'. " `) }) diff --git a/src/types/__tests__/effector/generated/sampleFilter.test.ts b/src/types/__tests__/effector/generated/sampleFilter.test.ts index a3f3445f2..53b578445 100644 --- a/src/types/__tests__/effector/generated/sampleFilter.test.ts +++ b/src/types/__tests__/effector/generated/sampleFilter.test.ts @@ -1843,8 +1843,16 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, string]>[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: (EventCallable | EventCallable<[number, string]>)[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, string]>[]; filter: StoreWritable; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: (EventCallable | EventCallable<[number, string]>)[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. " `) }) @@ -1872,8 +1880,12 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, number]>[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: (EventCallable | EventCallable<[number, number]>)[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, number]>[]; filter: StoreWritable; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: (EventCallable | EventCallable<[number, number]>)[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. @@ -1903,10 +1915,24 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, string]>[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: (EventCallable | EventCallable<...>)[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, string]>[]; filter: (val: (string | number)[], n: number) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: (EventCallable | EventCallable<...>)[]; filter: (val: (string | number)[], n: number) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, string]>[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: (EventCallable | EventCallable<...>)[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. " `) }) @@ -1934,8 +1960,12 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, number]>[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: (EventCallable | EventCallable<...>)[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, number]>[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: (EventCallable | EventCallable<...>)[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. @@ -1965,10 +1995,24 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, string]>[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: (EventCallable | EventCallable<...>)[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: (StoreWritable | EventCallable)[]; target: EventCallable<...>[]; filter: (val: (string | number)[], n: number) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: (StoreWritable | EventCallable)[]; target: (EventCallable<...> | EventCallable<...>)[]; filter: (val: (string | number)[], n: number) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, string]>[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }[]; }'. + Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: (EventCallable | EventCallable<...>)[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. + Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, string]; }[]; }'. " `) }) @@ -1996,8 +2040,12 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, number]>[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: (EventCallable | EventCallable<...>)[]; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, number]>[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }[]; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: (EventCallable | EventCallable<...>)[]; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: void | [number, number]; }[]; }'. @@ -2031,6 +2079,9 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, string]>; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, string]>; filter: StoreWritable; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Argument of type '{ source: StoreWritable[]; target: EventCallable<[number]>; filter: (val: number[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: number[]; targetType: [number]; }; }'. @@ -2064,6 +2115,7 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, number]>; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: readonly [StoreWritable, StoreWritable]; target: EventCallable<[number, number]>; filter: (val: readonly [number, string]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number, number]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number, number]; }; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; target: EventCallable<[number, number]>; filter: StoreWritable; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. @@ -2115,8 +2167,14 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, string]>; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, string]>; filter: (val: (string | number)[], n: number) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, string]>; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Argument of type '{ source: StoreWritable[]; clock: EventCallable; target: EventCallable<[number]>; filter: (val: number[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: number[]; targetType: [number]; }; }'. @@ -2152,6 +2210,7 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, number]>; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: readonly [StoreWritable, StoreWritable]; clock: EventCallable; target: EventCallable<[number, number]>; filter: (val: readonly [...]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number, number]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number, number]; }; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable; target: EventCallable<[number, number]>; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. @@ -2203,8 +2262,14 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, string]>; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: (StoreWritable | EventCallable)[]; target: EventCallable<...>; filter: (val: (string | number)[], n: number) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, string]>; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, string]; }; }'. Argument of type '{ source: StoreWritable[]; clock: EventCallable[]; target: EventCallable<[number]>; filter: (val: number[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: number[]; targetType: [number]; }; }'. @@ -2240,6 +2305,7 @@ describe('tuple source', () => { " Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, number]>; filter: (val: (string | number)[]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. + Operator '>' cannot be applied to types 'string | number' and 'number'. Argument of type '{ source: readonly [StoreWritable, StoreWritable]; clock: EventCallable[]; target: EventCallable<[number, number]>; filter: (val: readonly [...]) => boolean; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number, number]; }; }'. Object literal may only specify known properties, and 'source' does not exist in type '{ error: \\"source should extend target type\\"; targets: { sourceType: readonly [number, string]; targetType: [number, number]; }; }'. Argument of type '{ source: (StoreWritable | StoreWritable)[]; clock: EventCallable[]; target: EventCallable<[number, number]>; filter: StoreWritable<...>; }' is not assignable to parameter of type '{ error: \\"source should extend target type\\"; targets: { sourceType: (string | number)[]; targetType: [number, number]; }; }'. diff --git a/src/types/__tests__/effector/guard.test.ts b/src/types/__tests__/effector/guard.test.ts index 13de84b52..c154e4468 100644 --- a/src/types/__tests__/effector/guard.test.ts +++ b/src/types/__tests__/effector/guard.test.ts @@ -102,10 +102,7 @@ describe('explicit generics', () => { Type 'Target' is not assignable to type 'Unit'. Type 'Tuple' is not assignable to type 'Unit'. Type 'Target' is not assignable to type 'Unit'. - No overload matches this call. - The last overload gave the following error. - Argument of type '{ source: EventCallable; filter: (e: string | null) => boolean; target: EventCallable; }' is not assignable to parameter of type '{ clock: Clock; filter: GuardFilterC>; name?: string | undefined; greedy?: boolean | undefined; }'. - Object literal may only specify known properties, and 'source' does not exist in type '{ clock: Clock; filter: GuardFilterC>; name?: string | undefined; greedy?: boolean | undefined; }'. + Type 'Tuple' is not assignable to type 'Unit'. Type 'Target' is not assignable to type 'Unit'. Type 'Tuple' is not assignable to type 'Unit'. " @@ -144,6 +141,7 @@ describe('explicit generics', () => { expect(typecheck).toMatchInlineSnapshot(` " Type 'Target' is not assignable to type 'Unit'. + Type 'Tuple' is not assignable to type 'Unit'. " `) }) diff --git a/src/types/__tests__/effector/guard/guardWideNarrow.test.ts b/src/types/__tests__/effector/guard/guardWideNarrow.test.ts index fd85d2e5b..957d69a29 100644 --- a/src/types/__tests__/effector/guard/guardWideNarrow.test.ts +++ b/src/types/__tests__/effector/guard/guardWideNarrow.test.ts @@ -74,8 +74,8 @@ test('narrow union (should pass)', () => { " No overload matches this call. The last overload gave the following error. - Type 'Event<{ a: 1; } | { a: 2; } | { a: 3; }>' is not assignable to type 'UnitTarget | [any?, ...any[]]'. - Property 'prepend' is missing in type 'Event<{ a: 1; } | { a: 2; } | { a: 3; }>' but required in type 'EventCallable'. + Type 'Event<{ a: 1; } | { a: 2; } | { a: 3; }>' is not assignable to type 'UnitTargetable | [any?, ...any[]]'. + Type 'Event<{ a: 1; } | { a: 2; } | { a: 3; }>' is not assignable to type '[any?, ...any[]]'. No overload matches this call. The last overload gave the following error. Type 'Event<{ a: 1; } | { a: 2; } | { a: 3; }>' is not assignable to type '\\"non-unit item in target\\"'. @@ -151,8 +151,8 @@ test('unknown type in target (should pass)', () => { " No overload matches this call. The last overload gave the following error. - Type 'Event' is not assignable to type 'UnitTarget | [any?, ...any[]]'. - Property 'prepend' is missing in type 'Event' but required in type 'EventCallable'. + Type 'Event' is not assignable to type 'UnitTargetable | [any?, ...any[]]'. + Type 'Event' is not assignable to type '[any?, ...any[]]'. No overload matches this call. The last overload gave the following error. Type 'Event' is not assignable to type '\\"non-unit item in target\\"'. @@ -231,8 +231,8 @@ test('wide object (should pass)', () => { " No overload matches this call. The last overload gave the following error. - Type 'Event<{ a: 1; }>' is not assignable to type 'UnitTarget | [any?, ...any[]]'. - Property 'prepend' is missing in type 'Event<{ a: 1; }>' but required in type 'EventCallable'. + Type 'Event<{ a: 1; }>' is not assignable to type 'UnitTargetable | [any?, ...any[]]'. + Type 'Event<{ a: 1; }>' is not assignable to type '[any?, ...any[]]'. No overload matches this call. The last overload gave the following error. Type 'Event<{ a: 1; }>' is not assignable to type '\\"non-unit item in target\\"'. @@ -328,8 +328,8 @@ test('wide tuple (should pass)', () => { " No overload matches this call. The last overload gave the following error. - Type 'Event<[1, 2]>' is not assignable to type 'UnitTarget | [any?, ...any[]]'. - Property 'prepend' is missing in type 'Event<[1, 2]>' but required in type 'EventCallable'. + Type 'Event<[1, 2]>' is not assignable to type 'UnitTargetable | [any?, ...any[]]'. + Type 'Event<[1, 2]>' is not assignable to type '[any?, ...any[]]'. No overload matches this call. The last overload gave the following error. Type 'Event<[1, 2]>' is not assignable to type '\\"non-unit item in target\\"'. @@ -439,8 +439,8 @@ test('narrow union in array (should pass)', () => { " No overload matches this call. The last overload gave the following error. - Type 'Event<(string | number | boolean)[]>' is not assignable to type 'UnitTarget | [any?, ...any[]]'. - Property 'prepend' is missing in type 'Event<(string | number | boolean)[]>' but required in type 'EventCallable'. + Type 'Event<(string | number | boolean)[]>' is not assignable to type 'UnitTargetable | [any?, ...any[]]'. + Type 'Event<(string | number | boolean)[]>' is not assignable to type '[any?, ...any[]]'. No overload matches this call. The last overload gave the following error. Type 'Event<(string | number | boolean)[]>' is not assignable to type '\\"non-unit item in target\\"'.