-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt TypeScript #398
Comments
Remove use of a forked dependency. The fork appears to add in an 'optional' option, which is undocumented and seemingly untested. It seems to work without it too. The dependency has seen some updates, too, including TypeScript changes required for using strict mode (CyriacBr/class-fixtures-factory#10). Refs #406, #398
This change resolves some incorrect types, which don't trigger problems unless TypeScript is in a stricter mode. Refs #398
One particularly troublesome line is
It seems to be relying on the ORM having added a |
Use of the 'any' type is dangerous and can easily result in bugs. Refs #398
The use of 'unknown' is better than 'any' because it's at least type-safe, but this should set the correct type. Note this doesn't fix all the typing problems in this code. Refs #398
The IntlProvider has a required 'locale' setting; this didn't cause an error but make the console noisy while developing. Refs #398
Persona avatars are loaded, but the component expects them to be a data URI string rather than a Buffer object. As a result, the browser tries to load `/[object%20Object]`. Images inlined in the API are one of the leading performance problems. Rather than try and fix the types so that avatars show consistently, this hides them completely where they don't work. As far as I'm aware, there's been no complaints that they're not displayed, and this will help make some of the critical pages a bit less slow. Refs #392, #398
__dirname is a Node.js environment variable that contains the path to the module's directory. It's currently redefined to be the current working directory, which is somewhat unexpected. This change removes it as path.resolve() uses the current working directory anyway. Refs #398
As Parcel processes each file individually, TypeScript needs to be aware to disable incompatible types. Also, ts-jest needs to have type-checking disabled (since they don't currently pass). Refs #398, https://parceljs.org/languages/typescript/#isolatedmodules
I'm not sure why @typescript-eslint/typescript-estree has been used: I can't see any useful information about it. All documentation points to using @typescript-eslint/parser, which has been installed already. The only noticeable difference is that it doesn't understand when a type has been used, leading to @typescript-eslint/no-unused-vars errors. I've added a separate TypeScript config file that includes all files in the codebase, as the new parser will error if it tries to load a file that hasn't been included. Refs #398, #422, ba132cc
Rather than misusing a private decorator-specific API, this change uses the ORM's metadata storage instead. A slight issue here is that accessing the entity manager from a repository is technically not a public API, but the code doing so isn't (yet) TypeScript and needs a lot of work anyway. Refs #398, #399
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.The text was updated successfully, but these errors were encountered: