-
Notifications
You must be signed in to change notification settings - Fork 8
JS TS Upgrade Recommendations
Faris Durrani edited this page Mar 22, 2023
·
1 revision
- Remove all PropTypes. TS already does this job for us
- Use interfaces when possible, not types. See https://stackoverflow.com/a/65948871/11031425
- Abstract types for simplicity.
// don't do this if the type is too complex
const MyComponent = (props: {
propA: string,
propB: string,
propC: string,
propD: string
}) {return </>}
// instead do this
interface MyComponentProps {
propA: string,
propB: string,
propC: string,
propD: string
}
const MyComponent = (props: MyComponentProps) {return </>}
-
Use lint. Install the
ESLint
extension and follow its recommendations -
Avoid any if possible. For objects, try
{ [key: string]: any }
instead of justany
. Or use typeunknown
-
Finding the type of
e
is hard. Try to not. Instead, pass in the value frome
you want, likee.target.value
inonClick={(e) => handleClick(e.target.value)}
- Home
- Terraform
- Bearer-Token-Gen-Script
- Frontend-Backend Communication Documentation
- Backend Documentation (backend)
-
driver.py
- AWS Helper Files (backend.aws_helpers)
- Dynamo DB Utility Files (aws_helpers.dynamo_db_utils)
- AWS Secrets Utility Files (aws_secrets_utils)
- AWS Batch Utility Files (aws_batch_utils)
- Firebase Helper Files (backend.firebase_helpers)
- Common Files (backend.common)
-
constants.py
-
dataset.py
-
default_datasets.py
-
email_notifier.py
-
loss_functions.py
-
optimizer.py
-
utils.py
- Deep Learning Files (backend.dl)
- Machine Learning Files (backend.ml)
- Frontend Documentation
- Bug Manual
- Developer Runbook
- Examples to locally test DLP
- Knowledge Share