Дано:
interface Abc {
abcmethod: 'one' | 'two';
}
эта строка вызовет ошибку
const obj: Observable<Abc> = of({ abcmethod: 'one' });
где
import { of } from 'rxjs';
Ошибка:
TS2322:
Type 'Observable<{ abcmethod: string; }>' is not assignable to type 'Observable<Abc>'.
Type '{ abcmethod: string; }' is not assignable to type 'Abc'.
Types of property 'abcmethod' are incompatible.
Type 'string' is not assignable to type '"one" | "two"'.
пока без наблюдаемого все нормально
const obj: Abc = { abcmethod: 'one' };