ajv icon indicating copy to clipboard operation
ajv copied to clipboard

Fix types for NodeNext

Open benasher44 opened this issue 2 years ago • 8 comments

What issue does this pull request resolve?

Closes #2132

What changes did you make?

Changed the way types are exported to improve support for users module: node16/nodenext users.

Is there anything that requires more attention while reviewing?

benasher44 avatar Jan 08 '24 22:01 benasher44

@epoberezkin I think this is ready for review now, and I'm now just hitting the node 14 build issue plaguing the main branch. Maybe we can disable now that node 14 is EOL?

benasher44 avatar Jan 09 '24 00:01 benasher44

Okay yep this is ready. You can see the build passing on the other builds in https://github.com/ajv-validator/ajv/pull/2365/commits/b7b5fd0861baa89d702d7d36e01c0a76eb4b50c3, where the only change I did was temporarily remove 14 from the matrix.

benasher44 avatar Jan 09 '24 00:01 benasher44

Pushed more updates + confirmed the build pass without node 14

benasher44 avatar Jan 12 '24 17:01 benasher44

Thanks @jasoniangreen! Let me know if you have feedback on this PR — would love to move this forward

benasher44 avatar Feb 24 '24 15:02 benasher44

Thanks @jasoniangreen! Let me know if you have feedback on this PR — would love to move this forward

Let me update your branch with master and have a look.

jasoniangreen avatar Feb 28 '24 20:02 jasoniangreen

Something that hasn't been considered with this change is the browser bundles we generate. With this PR the rollup command, which is used to generate browser bundles, doesn't work. Also there are a lot of changes in this PR, and after speaking to epoberezkin there is not a lot appetite for such a large change to resolve this, at least not at this time. He has asked me to explore some alternatives, possible based on this work around.

Either way we have to be wary of the various exports and ways that AJV is used and ensure we don't make life difficult for a lot of people by changing things unnecessarily.

jasoniangreen avatar Feb 29 '24 23:02 jasoniangreen

That's totally fair! Would you consider just adding named exports for the classes alongside the default exports? The main pain point is the default exports. If people have the named exports as an alternative, I think that would satisfy most folks, even if it means the default exports are left clunky.

benasher44 avatar Feb 29 '24 23:02 benasher44

Opened #2389, which is much smaller. NodeNext users can switch to using the named export instead, side-stepping the default import/export issues.

benasher44 avatar Mar 01 '24 03:03 benasher44

Closing in favor of #2389

benasher44 avatar Apr 20 '24 19:04 benasher44