PREreview / prereview

MIT License
9 stars 0 forks source link

Adopt TypeScript #398

Open thewilkybarkid opened 3 years ago

thewilkybarkid commented 3 years ago

Currently, TypeScript is partially used on the backend, without type checking (@parcel/validator-typescript is a dependency, but isn't enabled). All files should be TypeScript (including the frontend etc), with strict mode enabled and types actually checked.

thewilkybarkid commented 3 years ago

One particularly troublesome line is https://github.com/PREreview/prereview/blob/d5422411d180b8ffc508bf09d5d516a72740005b/src/backend/utils/getFields.ts#L9

It seems to be relying on the ORM having added a __meta property to the prototype, which is all completely untyped (and so clearly a hack). It seems possible to find it for an entity (using wrap()), but not for the prototype. It's possible you could find it out through the ORM's metadata storage (not tried yet), but I haven't really got a clue what this code is trying to achieve anyway. It feels like there's a far bigger problem to solve.