Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema
https://github.com/Meteor-Community-Packages/meteor-simple-schema
MIT License
919 stars 161 forks source link

Typescript error when importing SimpleSchema #742

Open bruceborrett opened 5 months ago

bruceborrett commented 5 months ago

I just installed this package and when I try to import SimpleSchema I get the following Typescript error:

image

github-actions[bot] commented 5 months ago

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously. Our goal is to provide long-term lifecycles for packages and keep up with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time. Therefore, we can't guarantee your issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit a pull request, too! We will accompany you in the process with reviews and hints on how to get development set up.

Please also consider sponsoring the maintainers of the package. If you don't know who is currently maintaining this package, just leave a comment and we'll let you know

jankapunkt commented 5 months ago

Hi @bruceborrett there is not types definition yet. Are you experienced with TypeScript? I am not yet so I need help to provide one. If you would consider adding one then feel free to open a PR

bruceborrett commented 5 months ago

Well, the simpl-schema NPM package is written completely in Typescript, so the definitions are already there, for some reason they just not being made available when installed as part of this Meteor package.

jankapunkt commented 5 months ago

@bruceborrett ah I see now. The Simple Schema NPM package dropped Meteor support in their 3.x major release, which is why this package is a hard-fork of the latest Meteor compatible version 1.13.1 which at that time did not contain any typescript code.

This also why we just can't copy the type definitions from the NPM repo as they are not reflecting the code in this Meteor package.

Edit_ Note, that with the dropped Meteor support there will also be trouble with async in Meteor 3.0 if you continue to use the npm package as we need basically all computable fields to be async-compatible in order to support any validations or computed properties that involve Mongo Collection calls.

bruceborrett commented 5 months ago

I see, so then, in my opinion, this package should never have been forked, the latest simpl-schema is still perfectly compatible with Meteor (its framework agnostic now) and is being well maintained. It is in fact the Collection2 package which is no longer compatible with simpl-schema, and Collection2 acts as the glue between simpl-schema and Meteor. In my opinion Collection2 should rather be updated to work with the latest simpl-schema, perhaps it can even be extended to support other validation libraries such as Zod and Yup etc.

bruceborrett commented 4 months ago

I want to close this ticket and rather look at updating the collection2 package to support the latest simpl-schema, unless anyone can tell me why thats the wrong approach?