Closed
Description
Bug Report
Current Behavior
Type 'Observable<unknown>' is not assignable to type 'Observable<string>'.
Type 'unknown' is not assignable to type 'string'.ts(2322)
Reproduction
function asObservable(input: string | ObservableInput<string>): Observable<string> {
return typeof input === 'string' ? of(input) : from(input)
}
Expected behavior
Should compile
Environment
- RxJS version: 6.5.2
- TS version: 3.6.2
Possible Solution
Instead of using ObservedValueOf<T>
:
export declare function from<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>
declare from
like:
export declare function from<O>(input: ObservableInput<O>): Observable<O>
this seems to work.
Metadata
Metadata
Assignees
Labels
No labels