apify / apify-storage-local-js

Local emulation of the apify-client NPM package, which enables local use of Apify SDK.
3 stars 4 forks source link

chore: migrate database_connection_cache to TS #17

Closed vladfrangu closed 3 years ago

vladfrangu commented 3 years ago

Notes

B4nan commented 3 years ago

Apparently it does not work as you'd expect (TS is on my side and wants .d.ts file too! :D), here is what happens when required in the SDK:

> apify@1.1.1 clean
> rm -rf ./build ./types

Error: node_modules/@apify/storage-local/dist/database_connection_cache.d.ts(1,35): error TS7016: Could not find a declaration file for module 'better-sqlite3-with-prebuilds'. '/home/runner/work/apify-js/apify-js/node_modules/better-sqlite3-with-prebuilds/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/better-sqlite3-with-prebuilds` if it exists or add a new declaration (.d.ts) file containing `declare module 'better-sqlite3-with-prebuilds';`
npm ERR! code 2

https://github.com/apify/apify-js/pull/971/checks?check_run_id=2168177002

vladfrangu commented 3 years ago

Apparently it does not work as you'd expect (TS is on my side and wants .d.ts file too! :D), here is what happens when required in the SDK:

> apify@1.1.1 clean
> rm -rf ./build ./types

Error: node_modules/@apify/storage-local/dist/database_connection_cache.d.ts(1,35): error TS7016: Could not find a declaration file for module 'better-sqlite3-with-prebuilds'. '/home/runner/work/apify-js/apify-js/node_modules/better-sqlite3-with-prebuilds/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/better-sqlite3-with-prebuilds` if it exists or add a new declaration (.d.ts) file containing `declare module 'better-sqlite3-with-prebuilds';`
npm ERR! code 2

apify/apify-js#971 (checks)

That... kinda makes sense since the module itself lacks typings. I'll look into PR-ing the types to the prebuilds repo, that should fix it!

mnmkng commented 3 years ago

@vladfrangu no need. @B4nan will do it tomorrow. He just finished some other work on the prebuilds package so he's familiar with it.

B4nan commented 3 years ago

better-sqlite3-with-prebuilds@7.1.7 now includes the typings, already updated it here, looks like its working fine

https://github.com/apify/apify-js/pull/971

vladfrangu commented 3 years ago

Awesome! Thanks a lot @B4nan! 🎉