New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make jsHandle and elementHandle container types #91

Merged
merged 3 commits into from Sep 14, 2018

Conversation

Projects
None yet
1 participant
@zploskey
Copy link
Owner

zploskey commented Sep 12, 2018

These are wrappers around javascript objects and dom elements,
respectively. By passing a type in their constructors we can track
this and it allows us to infer the return types of many of the eval
functions that return handles.

Make jsHandle and elementHandle container types
These are wrappers around javascript objects and dom elements,
respectively. By passing a type in their constructors we can track
this and it allows us to infer the return types of many of the eval
functions that return handles.
@zploskey
Copy link
Owner Author

zploskey left a comment

There are still a few things to think about before wrapping this one up.

@@ -21,4 +21,6 @@ external name: t => string = "";
* prototype. Returns a handle to an array of objects with this prototype.
*/
[@bs.send]
external queryObjects: (t, ~prototypeHandle: JSHandle.t) => JSHandle.t = "";
external queryObjects:
(t, ~prototypeHandle: JSHandle.t('a)) => JSHandle.t(array(Js.t({..}))) =

This comment has been minimized.

@zploskey

zploskey Sep 13, 2018

Author Owner

The inner return type here can be any object. Not sure typing it as a Js.t is appropriate. Maybe it should be left as 'b a just let the user specify the type rather than possibly forcing them to cast.

Show resolved Hide resolved src/FrameBase.re
Show resolved Hide resolved src/Page.re

zploskey added some commits Sep 13, 2018

Reconcile types of two queryObjects functions
Page and ExecutionContext both have a queryObjects function. One
just calls the other internally in in Puppeteer. This changes the
ExecutionContext version to wrap a generic type so that its
signature matches the version in Page.
Make handle types covariant
Like the BuckleScript Js.Promise.t type, we don't need to keep a
reference and just use it for additional type information.

@zploskey zploskey merged commit 703e5c0 into master Sep 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@zploskey zploskey deleted the handleTypes branch Sep 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment