Skip to content
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

Add type file with getMulti #4

Merged
merged 4 commits into from
Mar 29, 2021
Merged

Add type file with getMulti #4

merged 4 commits into from
Mar 29, 2021

Conversation

justjake
Copy link

I don't like the workflow of using patch-package on @types/memjs, it's hard to iterate on that.

@justjake justjake requested a review from blackmad March 29, 2021 15:58
*/
getMulti<Keys extends string>(
keys: Keys[]
): Promise<{ values: { [K in Keys]?: Buffer | null }; flags: Buffer | null }>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're sure? these really seem like strings to me based on the unittests, I think the docs in memjs had been wrong?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  var assertor = function(err, val, flags) {
    console.log('types')
    console.error(val['hello1'])
    console.error(typeof val['hello1'])
    t.deepEqual({
      hello1: 'world1',
      hello3: 'world3',
      hello4: 'world4',
    }, val);
    t.false(flags);
    t.equal(null, err);
  };
  client.getMulti(['hello1', 'hello2', 'hello3', 'hello4'], assertor);
  testAllCallbacksEmpty(t, dummyServer1);
  testAllCallbacksEmpty(t, dummyServer2);

  return client.getMulti(['hello1', 'hello2', 'hello3', 'hello4']).then(function(res) {
    assertor(null, res.values, res.flags);
world1
string
world1
string

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very weird. Here's me, in a nodejs REPL:
image

Test script using promise:

image

@blackmad
Copy link

blackmad commented Mar 29, 2021 via email

@justjake
Copy link
Author

image

@justjake justjake merged commit 65e399f into master Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants