quantified-uncertainty / metaforecast

Fetch forecasts from prediction markets/forecasting platforms to make them searchable. Integrate these forecasts into other services.
https://metaforecast.org/
MIT License
56 stars 5 forks source link

Strict typescript #79

Closed berekuk closed 2 years ago

berekuk commented 2 years ago

Finally :) 500+ errors cleaned up, "strict": true is now enabled in tsconfig.json.

Also:

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
metaforecast ✅ Ready (Inspect) Visit Preview May 12, 2022 at 2:00PM (UTC)
NunoSempere commented 2 years ago

Is this ready to be merged?

berekuk commented 2 years ago

Is this ready to be merged?

Almost, I wanted to figure out #80 first.

berekuk commented 2 years ago

One more significant change which I implemented as a side effect of smarkets investigation: platform fetchers now can return partial results, while the CLI tool can accept platform-specific arguments.

Example: npm run cli -- smarkets --eventId 34757345 --verbose 1

Platforms specify the list of arguments they accept, and there's some checking going on, both in runtime and with typescript (typescript side is a bit messy, but better than nothing).

Technical note: I had to expand on Platform type for this: there's now a version field on every platform object, and smarkets code uses v2 while everything else is still on v1. v2 platforms return { questions: [...], partial: true/false } objects, where partial flag being set means that old questions shouldn't be removed from the database.

berekuk commented 2 years ago

Rolling back temporarily due to 500 error on frontpage. Investigating.

berekuk commented 2 years ago

It was a dumb circular dependency bug, fixed in master and re-deployed.

And then there was also an issue with replaceAll, which was missing in Node 14, and I had to switch Vercel to Node 16; @NunoSempere, please let me know if you think replaceAll polyfill is still necessary (I removed it), I think it's supported well enough by all modern browsers (maybe we should still support IE 11 or Edge <85 for some reason?..)

NunoSempere commented 2 years ago

let me know if you think replaceAll polyfill is still necessary

Doesn't seem necessary; legacy from the netlify days.