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

more explicit type exports #1307

Merged
merged 14 commits into from
Oct 24, 2022
Merged

more explicit type exports #1307

merged 14 commits into from
Oct 24, 2022

Conversation

turadg
Copy link
Member

@turadg turadg commented Sep 30, 2022

Progress on #1254

Copy link
Contributor

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

Thanks for this!

"downlevelIteration": true,
"strictNullChecks": true,
"moduleResolution": "node",
"types": []
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious what motivated this. It seems about right, but I would not have thought of changing this.

Copy link
Member Author

@turadg turadg Oct 1, 2022

Choose a reason for hiding this comment

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

Without it there are errors from node_modules/events,

../../node_modules/events/events.js:53:3 - error TS2323: Cannot redeclare exported variable 'defaultMaxListeners'.

 53   Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 54     enumerable: true,
    ~~~~~~~~~~~~~~~~~~~~~
...
 64     }
    ~~~~~
 65   });
    ~~~~

../../node_modules/events/events.js:67:3 - error TS2323: Cannot redeclare exported variable 'defaultMaxListeners'.

67   EventEmitter.defaultMaxListeners = defaultMaxListeners;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/events/events.js:165:11 - error TS2339: Property 'context' does not exist on type 'Error'.

165       err.context = er;
              ~~~~~~~

I think because https://www.npmjs.com/package/@types/events is very stale. Even https://www.npmjs.com/package/events targets Node 11 API.

I looked into removing it but most ses-integration-test builders depend on it.

@@ -40,6 +43,7 @@
"devDependencies": {
"@endo/eslint-config": "^0.5.1",
"@endo/ses-ava": "^0.2.33",
"@types/node": ">=11.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be ok with bumping this up to 14.0

Copy link
Member Author

Choose a reason for hiding this comment

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

done. and since that still resolves to 14 that was available in yarn.lock, I also did a yarn upgrade.

Comment on lines +25 to +26
/** @type {typeof rawTest} */
// @ts-expect-error cast
Copy link
Contributor

Choose a reason for hiding this comment

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

I wish we could type wrapTest correctly to avoid this.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah. part of #1235

@@ -58,7 +60,7 @@ function testRacePromise(t, candidate) {
const result = Promise.resolve(candidate);

bothResults = Promise.allSettled([raced, result]);
fr.register(raced, collected.resolve);
fr.register(raced, () => collected.resolve(undefined));
Copy link
Contributor

Choose a reason for hiding this comment

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

Nothing to do with this really, but it's one of my biggest nit with tsc that () => void is incompatible with () => any. If it wasn't a test, I'd have asked for correcting the type of collected to PromiseKit<void> instead as I dislike changing runtime for types.

Copy link
Member

@kriskowal kriskowal left a comment

Choose a reason for hiding this comment

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

Typing and typing!

@@ -30,6 +30,9 @@
},
"scripts": {
"build": "exit 0",
"clean": "tsc --build jsconfig.build.json --clean",
Copy link
Member

Choose a reason for hiding this comment

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

This is fine, but it may be good to manually verify that this works. The last Endo publish didn’t clean up after itself and I’m suspicious. I did not look deeply into why. It may be a problem higher up the foodchain, like lerna not running postpack.

Copy link
Member Author

Choose a reason for hiding this comment

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

when I ran yarn clean it didn't remove the generated files. blocker? seems out of scope to me.

Copy link
Member

Choose a reason for hiding this comment

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

Let’s remove the ineffective script and proceed. The work around for now is an additional step in the release process that involves nuking files that are not checked in. That carries some risk that I’ll bear going forward, until we find a better way.

Copy link
Member Author

@turadg turadg Oct 5, 2022

Choose a reason for hiding this comment

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

I haven't removed it yet because, from what I've read, it sometimes works. It's just very cautious to never delete if some files have been touched. If this is a blocker lemme know

Copy link
Member

Choose a reason for hiding this comment

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

This is not a blocker.

@turadg turadg enabled auto-merge October 24, 2022 19:44
@turadg turadg merged commit e2da887 into master Oct 24, 2022
@turadg turadg deleted the ta/promise-kit-types branch October 24, 2022 19:48
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.

3 participants