hebcal / hebcal-es6

perpetual Jewish Calendar with holidays, Shabbat and holiday candle lighting and havdalah times, Torah readings, and more
https://hebcal.github.io/api/core/
GNU General Public License v2.0
98 stars 14 forks source link

Typescript #444

Closed YizYah closed 3 months ago

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
5 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

YizYah commented 3 months ago

@mjradwin This pr appears to me to succeed at generating all of the TS types automatically rather than manually.

In addition, I took two liberties:

The update can be done one file at a time, but it must be done top-down. So, again, we will need to create holiday.ts before staticHolidays.js.

The tests are, of course, all passing. And I confirmed that I could import EventCalendar and Event without difficulty. But, I have not confirmed that other types are imported without a problem. Normally, this wouldn't be a concern. It's just that you are using the jsdoc directives, which are influencing tsc. I don't feel confident that I know all of your objects, so I can't be sure. It should be very easy to check, because any issues will be static. So you can just import into a "hello world" ts file and see what you get. But if there were a problem, someone would probably raise an issue almost immediately. I'm not sure what to advise for that.

YizYah commented 3 months ago

@mjradwin I wanted to change this to draft, don't think I can now that I've created it. The only issue is the final paragraph in the last comment. I am actually linked to my local version of this branch, and it's working well.

I just thought of a very simple way to check this--look through the manual hebcal.d.ts and confirm that everything in it appears correctly in the generated d.ts files in dist. I don't have time today. Could do it Sunday if you'd like.

YizYah commented 3 months ago

fixes #442

mjradwin commented 3 months ago

Reviewing. One quick question: is there a reason why the tslib in package.json is listed in dependencies and not devDependencies?

YizYah commented 3 months ago

I'm not sure. It could be that we could move it to devdependencies, because the importHelpers flag is not set. I added it because I saw a claim that it was needed to get the rollup working. We could try removing it or moving it.