-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* test(dtslint): add dtslint test for forkjoin obsrevable (#4093) * chore(forkJoin): update dtslint with TODOs for what needs fixed
- Loading branch information
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { of, forkJoin } from 'rxjs'; | ||
|
||
it('should infer correctly with 1 parameter', () => { | ||
const a = of(1, 2, 3); | ||
const res = forkJoin(a); // $ExpectType Observable<number[]> | ||
}); | ||
|
||
it('should infer correctly with 2 parameters', () => { | ||
const a = of(1, 2, 3); | ||
const b = of('a', 'b', 'c'); | ||
const res = forkJoin(a, b); // $ExpectType Observable<[number, string]> | ||
}); | ||
|
||
it('should infer correctly with 3 parameters', () => { | ||
const a = of(1, 2, 3); | ||
const b = of('a', 'b', 'c'); | ||
const c = of(1, 2, 3); | ||
const res = forkJoin(a, b, c); // $ExpectType Observable<[number, string, number]> | ||
}); | ||
|
||
it('should infer correctly with 4 parameters', () => { | ||
const a = of(1, 2, 3); | ||
const b = of('a', 'b', 'c'); | ||
const c = of(1, 2, 3); | ||
const d = of(1, 2, 3); | ||
const res = forkJoin(a, b, c, d); // $ExpectType Observable<[number, string, number, number]> | ||
}); | ||
|
||
it('should infer correctly with 5 parameters', () => { | ||
const a = of(1, 2, 3); | ||
const b = of('a', 'b', 'c'); | ||
const c = of(1, 2, 3); | ||
const d = of(1, 2, 3); | ||
const e = of(1, 2, 3); | ||
const res = forkJoin(a, b, c, d, e); // $ExpectType Observable<[number, string, number, number, number]> | ||
}); | ||
|
||
it('should infer correctly with 6 parameters', () => { | ||
const a = of(1, 2, 3); | ||
const b = of('a', 'b', 'c'); | ||
const c = of(1, 2, 3); | ||
const d = of(1, 2, 3); | ||
const e = of(1, 2, 3); | ||
const f = of(1, 2, 3); | ||
const res = forkJoin(a, b, c, d, e, f); // $ExpectType Observable<[number, string, number, number, number, number]> | ||
}); | ||
|
||
// TODO(benlesh): this needs to be fixed as well | ||
// it('should infer of type any for more than 6 parameters', () => { | ||
// const a = of(1, 2, 3); | ||
// const b = of('a', 'b', 'c'); | ||
// const c = of(1, 2, 3); | ||
// const d = of(1, 2, 3); | ||
// const e = of(1, 2, 3); | ||
// const f = of(1, 2, 3); | ||
// const g = of(1, 2, 3); | ||
// const res = forkJoin(a, b, c, d, e, f, g); // $ExpectType Observable<{}> | ||
// }); | ||
|
||
it('should infer correctly for array of 1 observable', () => { | ||
const a = [of(1, 2, 3)]; | ||
const res = forkJoin(a); // $ExpectType Observable<number[]> | ||
}); | ||
|
||
// TODO(benlesh): We need to fix forkJoin so these pass | ||
// it('should infer correctly for array of 2 observables', () => { | ||
// const a = [of(1, 2, 3), of('a', 'b', 'c')]; | ||
// const res = forkJoin(a); // $ExpectType Observable<[number, string]> | ||
// }); | ||
|
||
// it('should infer correctly for array of 3 observables', () => { | ||
// const a = [of(1, 2, 3), of('a', 'b', 'c'), of(true, true, false)]; | ||
// const res = forkJoin(a); // $ExpectType Observable<[number, string, boolean]> | ||
// }); | ||
|
||
// it('should infer correctly for array of 4 observables', () => { | ||
// const a = [of(1, 2, 3), of('a', 'b', 'c'), of(1, 2, 3), of(1, 2, 3)]; | ||
// const res = forkJoin(a); // $ExpectType Observable<[number, string, number, number]> | ||
// }); | ||
|
||
// it('should infer correctly for array of 5 observables', () => { | ||
// const a = [of(1, 2, 3), of('a', 'b', 'c'), of(1, 2, 3), of(1, 2, 3), of(1, 2, 3)]; | ||
// const res = forkJoin(a); // $ExpectType Observable<[number, string, number, number, number]> | ||
// }); | ||
|
||
// it('should infer correctly for array of 6 observables', () => { | ||
// const a = [of(1, 2, 3), of('a', 'b', 'c'), of(1, 2, 3), of(1, 2, 3), of(1, 2, 3), of(1, 2, 3)]; | ||
// const res = forkJoin(a); // $ExpectType Observable<[number, string, number, number, number, number]> | ||
// }); | ||
|
||
// it('should force user cast for array of 6+ observables', () => { | ||
// const a = [of(1, 2, 3), of('a', 'b', 'c'), of(1, 2, 3), of(1, 2, 3), of(1, 2, 3), of(1, 2, 3), of(1, 2, 3)]; | ||
// const res = forkJoin(a); // $ExpectType Observable<{}> | ||
// }); |