fix ts errors

This commit is contained in:
Bruno Windels 2022-01-28 16:40:32 +01:00
parent a97d235cf5
commit d9e6164a5c

View File

@ -217,7 +217,7 @@ export function tests() {
}, },
"flatMap.get": assert => { "flatMap.get": assert => {
const a = new ObservableValue<undefined | {count: ObservableValue<number>}>(undefined); const a = new ObservableValue<undefined | {count: ObservableValue<number>}>(undefined);
const countProxy = a.flatMap(a => a.count); const countProxy = a.flatMap(a => a!.count);
assert.strictEqual(countProxy.get(), undefined); assert.strictEqual(countProxy.get(), undefined);
const count = new ObservableValue<number>(0); const count = new ObservableValue<number>(0);
a.set({count}); a.set({count});
@ -226,7 +226,7 @@ export function tests() {
"flatMap update from source": assert => { "flatMap update from source": assert => {
const a = new ObservableValue<undefined | {count: ObservableValue<number>}>(undefined); const a = new ObservableValue<undefined | {count: ObservableValue<number>}>(undefined);
const updates: (number | undefined)[] = []; const updates: (number | undefined)[] = [];
a.flatMap(a => a.count).subscribe(count => { a.flatMap(a => a!.count).subscribe(count => {
updates.push(count); updates.push(count);
}); });
const count = new ObservableValue<number>(0); const count = new ObservableValue<number>(0);
@ -236,7 +236,7 @@ export function tests() {
"flatMap update from target": assert => { "flatMap update from target": assert => {
const a = new ObservableValue<undefined | {count: ObservableValue<number>}>(undefined); const a = new ObservableValue<undefined | {count: ObservableValue<number>}>(undefined);
const updates: (number | undefined)[] = []; const updates: (number | undefined)[] = [];
a.flatMap(a => a.count).subscribe(count => { a.flatMap(a => a!.count).subscribe(count => {
updates.push(count); updates.push(count);
}); });
const count = new ObservableValue<number>(0); const count = new ObservableValue<number>(0);