[fixed] types in combineLatest
ClosedPublic

Authored by appsforartists on Sep 25 2017, 11:39 PM.

Details

Summary

combineLatest takes either an Array of observables or an object literal of them. The values it emits are the same shape as its input.

const dict$ = combineLatest({
	a: 5,
	b: number$,
});

const array$ = combineLatest([ 5, number$ ]);

I'm trying to express this in TypeScript.

Diff Detail

Repository
R13 material-motion/material-motion-js
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a reviewer: O2: Material Motion. · View Herald TranscriptSep 25 2017, 11:40 PM
Restricted Application added a project: Material Motion. · View Herald Transcript
Restricted Application added a reviewer: O3: Material JavaScript platform reviewers. · View Herald Transcript
Restricted Application added a reviewer: Material Motion. · View Herald Transcript
appsforartists planned changes to this revision.Sep 25 2017, 11:40 PM
packages/core/src/combineLatest.ts
47–49
TS2322: Type 'never[]' is not assignable to type 'U'.
49
TS2322: Type '{}' is not assignable to type 'U'.
Restricted Application failed to build Restricted Buildable!Sep 25 2017, 11:42 PM

Figured out how overloads work.

Restricted Application completed building Restricted Buildable.Sep 26 2017, 12:49 AM
Restricted Application failed to build Restricted Buildable!Sep 26 2017, 12:52 AM
featherless accepted this revision.Oct 6 2017, 2:00 PM
This revision is now accepted and ready to land.Oct 6 2017, 2:00 PM
This revision was automatically updated to reflect the committed changes.