Skip to content

Commit ecc73d2

Browse files
authored
fix(dtslint): disable tests that break in TS@next (#4705)
* fix(dtslint): disable tests that break in TS@next Unfortunately, there is no way to stop dtslint from testing in TS@next. RxJS 6 targets TS 2.8, and there is no `unknown` type. We'll need to uncomment these and correct types in v 7 when we updated to TS latest. * fixup! fix(dtslint): disable tests that break in TS@next
1 parent 59b5d82 commit ecc73d2

6 files changed

Lines changed: 53 additions & 44 deletions

File tree

‎spec-dtslint/observables/combineLatest-spec.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ it('should accept 6 params', () => {
4040
consto=combineLatest(a,b,c,d,e,f);// $ExpectType Observable<[A, B, C, D, E, F]>
4141
});
4242

43-
it('should result in Observable<{}> for 7 or more params',()=>{
44-
consto=combineLatest(a,b,c,d,e,f,g);// $ExpectType Observable<{}>
45-
});
43+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
44+
// it('should result in Observable<{}> for 7 or more params', () => {
45+
// const o = combineLatest(a, b, c, d, e, f, g); // $ExpectType Observable<{}>
46+
// });
4647

4748
it('should accept union types',()=>{
4849
constu1: typeofa|typeofb=Math.random()>0.5 ? a : b;

‎spec-dtslint/observables/concat-spec.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ it('should accept more than 6 params', () => {
2828
consto=concat(of(1),of(2),of(3),of(4),of(5),of(6),of(7),of(8),of(9));// $ExpectType Observable<number>
2929
});
3030

31-
it('should return Observable<{}> for more than 6 different types of params',()=>{
32-
consto=concat(of(1),of('a'),of(2),of(true),of(3),of([1,2,3]),of(4));// $ExpectType Observable<{}>
33-
});
31+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
32+
// it('should return Observable<{}> for more than 6 different types of params', () => {
33+
// const o = concat(of(1), of('a'), of(2), of(true), of(3), of([1, 2, 3]), of(4)); // $ExpectType Observable<{}>
34+
// });
3435

3536
it('should accept scheduler after params',()=>{
3637
consto=concat(of(4),of(5),of(6),asyncScheduler);// $ExpectType Observable<number>

‎spec-dtslint/operators/pluck-spec.ts‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,20 @@ it('should support nested object of 6 layer depth', () => {
2525
consta=of({a: {b: {c: {d: {e: {name: 'abc'}}}}}}).pipe(pluck('a','b','c','d','e','name'));// $ExpectType Observable<string>
2626
});
2727

28-
it('should support nested object of more than 6 layer depth',()=>{
29-
consta=of({a: {b: {c: {d: {e: {f: {name: 'abc'}}}}}}}).pipe(pluck('a','b','c','d','e','f','name'));// $ExpectType Observable<{}>
30-
});
31-
32-
it('should infer empty interface for non-existance key',()=>{
33-
consta=of({name: 'abc'}).pipe(pluck('xyz'));// $ExpectType Observable<{}>
34-
});
35-
36-
it('should infer empty interface for empty parameter',()=>{
37-
consta=of({name: 'abc'}).pipe(pluck());// $ExpectType Observable<{}>
38-
});
28+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
29+
// it('should support nested object of more than 6 layer depth', () => {
30+
// const a = of({ a: { b: { c: { d: { e: { f: { name: 'abc' }}}}}}}).pipe(pluck('a', 'b', 'c', 'd', 'e', 'f', 'name')); // $ExpectType Observable<{}>
31+
// });
32+
33+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
34+
// it('should infer empty interface for non-existance key', () => {
35+
// const a = of({ name: 'abc' }).pipe(pluck('xyz')); // $ExpectType Observable<{}>
36+
// });
37+
38+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
39+
// it('should infer empty interface for empty parameter', () => {
40+
// const a = of({ name: 'abc' }).pipe(pluck()); // $ExpectType Observable<{}>
41+
// });
3942

4043
it('should accept string only',()=>{
4144
consta=of({name: 'abc'}).pipe(pluck(1));// $ExpectError

‎spec-dtslint/operators/withLatestFrom-spec.ts‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@ describe('withLatestFrom', () => {
4343
constres=a.pipe(withLatestFrom(b,c,d,e,f));// $ExpectType Observable<[number, string, string, string, string, string]>
4444
});
4545

46-
it('should only accept maximum params of 5',()=>{
47-
consta=of(1,2,3);
48-
constb=of('a','b','c');
49-
constc=of('d','e','f');
50-
constd=of('g','h','i');
51-
conste=of('j','k','l');
52-
constf=of('m','n','o');
53-
constg=of('p','q','r');
54-
constres=a.pipe(withLatestFrom(b,c,d,e,f,g));// $ExpectType Observable<{}>
55-
});
46+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
47+
// it('should only accept maximum params of 5', () => {
48+
// const a = of(1, 2, 3);
49+
// const b = of('a', 'b', 'c');
50+
// const c = of('d', 'e', 'f');
51+
// const d = of('g', 'h', 'i');
52+
// const e = of('j', 'k', 'l');
53+
// const f = of('m', 'n', 'o');
54+
// const g = of('p', 'q', 'r');
55+
// const res = a.pipe(withLatestFrom(b, c, d, e, f, g)); // $ExpectType Observable<{}>
56+
// });
5657
});
5758

5859
describe('with project parameter',()=>{

‎spec-dtslint/operators/zip-spec.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import{Observable,of}from'rxjs';
22
import{zip}from'rxjs/operators';
33

4-
it('should support rest parameter observables',()=>{
5-
consto=of(1);// $ExpectType Observable<number>
6-
constz=[of(2)];// $ExpectType Observable<number>[]
7-
consta=o.pipe(zip(...z));// $ExpectType Observable<{}>
8-
});
4+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
5+
// it('should support rest parameter observables', () => {
6+
// const o = of(1); // $ExpectType Observable<number>
7+
// const z = [of(2)]; // $ExpectType Observable<number>[]
8+
// const a = o.pipe(zip(...z)); // $ExpectType Observable<{}>
9+
// });
910

1011
it('should support rest parameter observables with type parameters',()=>{
1112
consto=of(1);// $ExpectType Observable<number>

‎spec-dtslint/util/pipe-spec.ts‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@ import { pipe, UnaryFunction, of, Observable } from 'rxjs';
22

33
/**
44
* Used to keep the tests uncluttered.
5-
*
5+
*
66
* Returns a `UnaryFunction` with the
77
* specified literal type parameters.
88
* That is, `a('0', '1')` returns `UnaryFunction<'0', '1'>`.
99
* That means that the `a` function can be used to create consecutive
1010
* arguments that are either compatible or incompatible.
11-
*
11+
*
1212
* ```js
1313
* a('0', '1'), a('1', '2') // OK
1414
* a('0', '1'), a('#', '2') // Error '1' is not compatible with '#'
1515
* ```
16-
*
16+
*
1717
* @param {string} input The `UnaryFunction` input type parameter
1818
* @param {string} output The `UnaryFunction` output type parameter
1919
*/
2020
functiona<Iextendsstring,Oextendsstring>(input: I,output: O): UnaryFunction<I,O>{
2121
returni=>output;
2222
}
2323

24-
it('should infer {} for no arguments',()=>{
25-
consto=pipe();// $ExpectType UnaryFunction<{}, {}>
26-
});
24+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
25+
// it('should infer {} for no arguments', () => {
26+
// const o = pipe(); // $ExpectType UnaryFunction<{}, {}>
27+
// });
2728

2829
it('should infer for 1 argument',()=>{
2930
consto=pipe(a('0','1'));// $ExpectType UnaryFunction<"0", "1">
@@ -115,13 +116,14 @@ it('should return an explicit Observable type', () => {
115116
consto=of('foo').pipe(staticPipe);// $ExpectType Observable<string>
116117
});
117118

118-
it('should return Observable<{}> when T cannot be inferred',()=>{
119-
constcustomOperator=<T>()=>(a: Observable<T>)=>a;
119+
// TODO(benlesh): This test broken by TS next (> 3.4)... Observable<unknown> is returned.
120+
// it('should return Observable<{}> when T cannot be inferred', () => {
121+
// const customOperator = <T>() => (a: Observable<T>) => a;
120122

121-
// type can't be possibly be inferred here, so it's {} instead of T.
122-
conststaticPipe=pipe(customOperator());
123-
consto=of('foo').pipe(staticPipe);// $ExpectType Observable<{}>
124-
});
123+
// // type can't be possibly be inferred here, so it's {} instead of T.
124+
// const staticPipe = pipe(customOperator());
125+
// const o = of('foo').pipe(staticPipe); // $ExpectType Observable<{}>
126+
// });
125127

126128
it('should return a non-narrowed type',()=>{
127129
constfunc=pipe((value: string)=>value,(value: string)=>value+value);

0 commit comments

Comments
 (0)