mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
fix enzyme CommonWrapper.reduce function to return R instead of R[] (#13763)
This commit is contained in:
@@ -277,14 +277,14 @@ namespace ShallowWrapperTest {
|
||||
}
|
||||
|
||||
function test_reduce() {
|
||||
const total: number[] =
|
||||
const total: number =
|
||||
shallowWrapper.reduce(
|
||||
(amount: number, n: ShallowWrapper<MyComponentProps, MyComponentState>) => amount + n.props().numberProp
|
||||
);
|
||||
}
|
||||
|
||||
function test_reduceRight() {
|
||||
const total: number[] =
|
||||
const total: number =
|
||||
shallowWrapper.reduceRight<number>(
|
||||
(amount: number, n: ShallowWrapper<MyComponentProps, MyComponentState>) => amount + n.prop('amount')
|
||||
);
|
||||
@@ -557,14 +557,14 @@ namespace ReactWrapperTest {
|
||||
}
|
||||
|
||||
function test_reduce() {
|
||||
const total: number[] =
|
||||
const total: number =
|
||||
reactWrapper.reduce<number>(
|
||||
(amount: number, n: ReactWrapper<MyComponentProps, MyComponentState>) => amount + n.prop('amount')
|
||||
);
|
||||
}
|
||||
|
||||
function test_reduceRight() {
|
||||
const total: number[] =
|
||||
const total: number =
|
||||
reactWrapper.reduceRight<number>(
|
||||
(amount: number, n: ReactWrapper<MyComponentProps, MyComponentState>) => amount + n.prop('amount')
|
||||
);
|
||||
@@ -799,14 +799,14 @@ namespace CheerioWrapperTest {
|
||||
}
|
||||
|
||||
function test_reduce() {
|
||||
const total: number[] =
|
||||
const total: number =
|
||||
cheerioWrapper.reduce<number>(
|
||||
(amount: number, n: CheerioWrapper<MyComponentProps, MyComponentState>) => amount + n.prop('amount')
|
||||
);
|
||||
}
|
||||
|
||||
function test_reduceRight() {
|
||||
const total: number[] =
|
||||
const total: number =
|
||||
cheerioWrapper.reduceRight<number>(
|
||||
(amount: number, n: CheerioWrapper<MyComponentProps, MyComponentState>) => amount + n.prop('amount')
|
||||
);
|
||||
|
||||
4
enzyme/index.d.ts
vendored
4
enzyme/index.d.ts
vendored
@@ -346,7 +346,7 @@ interface CommonWrapper<P, S> {
|
||||
* @param fn
|
||||
* @param initialValue
|
||||
*/
|
||||
reduce<R>(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R[];
|
||||
reduce<R>(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R;
|
||||
|
||||
/**
|
||||
* Applies the provided reducing function to every node in the wrapper to reduce to a single value.
|
||||
@@ -354,7 +354,7 @@ interface CommonWrapper<P, S> {
|
||||
* @param fn
|
||||
* @param initialValue
|
||||
*/
|
||||
reduceRight<R>(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R[];
|
||||
reduceRight<R>(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R;
|
||||
|
||||
/**
|
||||
* Returns whether or not any of the nodes in the wrapper match the provided selector.
|
||||
|
||||
Reference in New Issue
Block a user