Prepare for TS #32558 (#37167)

This commit is contained in:
Anders Hejlsberg 2019-07-29 11:33:53 -07:00 committed by GitHub
parent 579970f8b7
commit 47b7924a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -252,19 +252,20 @@ function CombiningMultipleStreamsAndProperties() {
{
// To calculate the current sum of three numeric Properties, you can do:
var property = Bacon.constant(1),
stream = Bacon.once(2),
// (NOTE: combineWith requires the first type argument to be ErrorEvent, but the constant
// and once methods default to unknown, so we're forced to manually specify it)
let property = Bacon.constant<ErrorEvent, number>(1),
stream = Bacon.once<ErrorEvent, number>(2),
constant = 3;
// NOTE: had to explicitly specify the typing for `x:number, y:number, z:number`
Bacon.combineWith((x:number, y:number, z:number) => x + y + z, property, stream, constant);
Bacon.combineWith((x, y, z) => x + y + z, property, stream, constant);
}
{
// Assuming you've got streams or properties named `password`, `username`, `firstname` and `lastname`, you can do:
var password = Bacon.constant("easy"),
username = Bacon.constant("juha"),
firstname = Bacon.constant("juha"),
lastname = Bacon.constant("paananen"),
let password = Bacon.constant<ErrorEvent, string>("easy"),
username = Bacon.constant<ErrorEvent, string>("juha"),
firstname = Bacon.constant<ErrorEvent, string>("juha"),
lastname = Bacon.constant<ErrorEvent, string>("paananen"),
// NOTE: you should provide `combineTemplate` typing explicitly!
loginInfo = Bacon.combineTemplate<string, {
magicNumber:number; userid:string; passwd:string;