-
Notifications
You must be signed in to change notification settings - Fork 90
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
refactor: add no-unsafe-call
lint and improve types
#461
Conversation
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.
Great PR, thank you!
You can fix the suggestion, or alternatively merge it as-is
}) | ||
|
||
const res = relevant.reduce((acc: Operator[], name: string): Operator[] => { | ||
return agencyMap.has(name) | ||
? [...acc, { name, id: agencyMap.get(name)?.operator_ref.toString() }] | ||
? [...acc, { name, id: (agencyMap.get(name) as Agency).operator_ref.toString() }] |
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.
is as Agency
necessary?
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.
If we leave it as is it won't be assignable:
Type '{ name: string; id: string | undefined; }[]' is not assignable to type 'Operator[]'.
Type '{ name: string; id: string | undefined; }' is not assignable to type 'Operator'.
Types of property 'id' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
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.
? [...acc, { name, id: (agencyMap.get(name) as Agency).operator_ref.toString() }] | |
? [...acc, { name, id: (agencyMap.get(name)!).operator_ref.toString() }] |
will tell it that it can't be undefined
no-unsafe-call
lint and improve types
Co-authored-by: Noam Gaash <noam.gaash@gmail.com>
Thank you ! |
Description
fixed linting issues after removing:
'@typescript-eslint/no-unsafe-call': 'off'
issue #450
What I did:
eslint-disable-next-line @typescript-eslint/no-unsafe-call
for two lines in the utils.ts file due to special cases.There might be a need to change the config to exempt js files from eslint
@NoamGaash
screenshots