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
100 stars 14 forks source link

Cannot use with Typescript #371

Closed bennypowers closed 9 months ago

bennypowers commented 9 months ago
mkdir -p /tmp/hc
cd /tmp/hc
npm init -y
npm i typescript @hebcal/core @hebcal/noaa tslib
echo "export * from '@hebcal/core'" > index.ts
cat >tsconfig.json <<EOL
{
  "include": ["index.ts"],
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "declaration": true,
    "moduleResolution": "NodeNext",
    "importHelpers": true,
    "sourceMap": true,
    "inlineSources": true
  }
}
EOL
npx tsc

node_modules/@hebcal/core/hebcal.d.ts:1:29 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@hebcal/noaa")' call instead.

1 import { GeoLocation } from '@hebcal/noaa';



Found 1 error in node_modules/@hebcal/core/hebcal.d.ts:1

See #365

mjradwin commented 9 months ago

This issue appears to be fixed now. Tested with current versions @hebcal/core@5.0.3 and @hebcal/noaa@0.8.11

bennypowers commented 8 months ago

Confirmed this is working. @shul/elements@0.0.31 uses this. Thank you! מי שברך אבותינו הוא יברך אותך על זה שאתה מזכה את הרבים, הקב׳׳ה ישלם שכרך ויסיר ממך כל מחלה וירפא לגופך ויסלח לכל העוונות וישלח ברכה והצלחה בכל מעשה ידך עם כל ישראל אחיך אמן