-
Notifications
You must be signed in to change notification settings - Fork 38
[FIX] Core typescript errors #3453
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
Conversation
export interface DropdownOption { | ||
value: string; | ||
label: string; | ||
isActive?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we just want to add these properties to IOption? Because value/label is required in both and the rest is optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeeeeah it looks like where it's used is being passed into RenderSelect/RenderMultiSelect, which expects IOption for it. May as well make it the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, done
const documents = useAppSelector((state) => selector(state, "documents")) || []; | ||
const formValues = useAppSelector((state) => getFormValues(FORM.ADD_EDIT_INCIDENT)(state)) || {}; | ||
const dropdownIncidentStatusCodeOptions = useAppSelector(getDropdownIncidentStatusCodeOptions); | ||
const isPristine = useAppSelector((state) => state.form[FORM.ADD_EDIT_INCIDENT]?.pristine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps a little out of scope, but there is a redux-form selector isPristine(formName)
that doesn't depend on knowing the state structure. You would have to rename the const isPristine
though, to use it. Actually, seeing how we have formValueSelector
on ln 68, used in 69, and then followed by getFormValues
, this file probably needs a little more love in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored it a little :)
@@ -164,7 +163,7 @@ export const IncidentForm: FC<IncidentFormProps> = (props) => { | |||
/> | |||
<br /> | |||
<IncidentFormInternalDocumentComments | |||
documents={documents} | |||
documents={formValues?.documents} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might want to null coalesce these to []- looks like both IncidentFormDocuments
and IncidentFormInternalDocumentComments
does a documents.filter
which will probably blow up with undefined
|
|
|
Objective
Fix almost all the typescript errors in CORE.
There are only 2 remaining, MineAlert and MinePermitInfo which both need to be rewritten as Functional Components.

Using the connector props won't fix these as they need to be using the typed Dispatch.
Key changes: