2016-06-15 11 views
0

私は、次のtypescriptですエラーが発生します。観察可能typescriptですエラー([])

Error:(34, 20) TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'number | Scheduler'. Type 'undefined[]' is not assignable to type 'Scheduler'. Property 'now' is missing in type 'undefined[]'.

この文脈でstartWithを使用して:

避けるためにキャストする方法を疑問に思っ
items$:any = Observable 
     .interval(250) 
     .map((_:any) => Math.random()) 
     .startWith([]) 
     .scan((acc:any, curr:any)=> [...acc, curr]); 

エラー?

よろしく

ショーンいずれかのトリックをした追加

答えて

4
show = false; 
items$:any = Observable 
    .interval(500) 
    .delay(500) 
    .map((_:any) => Math.random()) 
    .startWith(<any>[]) 
    .scan((acc:any, curr:any)=> [...acc, curr]); 

関連する問題