2016-06-15 2 views
0

나는 다음과 같은 타이프 스크립트 오류가 발생합니다 :관찰 가능한 타이프 라이터 오류

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]);