-
Notifications
You must be signed in to change notification settings - Fork 24
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
(BSR) refactor(typescript): delete some noUncheckedIndexedAccess #7466
base: master
Are you sure you want to change the base?
Conversation
8847450
to
91db858
Compare
const ACCESS_FINE_LOCATION = 'android.permission.ACCESS_FINE_LOCATION' | ||
const ACCESS_COARSE_LOCATION = 'android.permission.ACCESS_COARSE_LOCATION' | ||
|
||
const requestGeolocPermissionSystem: AskGeolocPermission = async () => { | ||
const permissions = await PermissionsAndroid.requestMultiple([ | ||
// @ts-expect-error: because of noUncheckedIndexedAccess | ||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, | ||
// @ts-expect-error: because of noUncheckedIndexedAccess | ||
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION, | ||
ACCESS_FINE_LOCATION, | ||
ACCESS_COARSE_LOCATION, | ||
]) |
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.
le type de PermissionsAndroid.PERMISSIONS
est un record qui a comme valeurs des strings (très permissif) donc on ne peut pas compter dessus pour un fort typage.
PermissionsAndroid.requestMultiple
a un typage fort sur le tableau de permissions qui peut lui être passés mais ne fourni pas d'enum de ces strings :(
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.
est-ce qu'il serait facile, rapide et pertinent de faire une PR pour améliorer le typage de react-native ?
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.
Il y a une possibilité de créer cet Enum dans notre projet, à voire ensuite pour la maintenabilité.
Avec la méthode ci-dessus, si une autorisation change ou n'existe plus, Typescript ne sera pas content des paramètres qui lui seront passés, même si à priori ça a l'air d'être des plain strings
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.
je proposais de faire une PR sur le projet upstream react-native (pour faire par exemple un enum)
@@ -111,7 +111,7 @@ export function CulturalSurveyQuestions({ route }: CulturalSurveyQuestionsProps) | |||
const navigateToNextQuestion = () => { | |||
if (isCurrentQuestionLastQuestion) { | |||
postCulturalSurveyAnswers({ answers }) | |||
} else { | |||
} else if (nextQuestion) { |
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.
il se passe quoi si isCurrentQuestionLastQuestion
est falsy et que nextQuestion
est aussi falsy ?
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.
rien ne se passe, le type n'autorisait pas de push une nextQuestion à undefined, il y a peut-être du métier à revoir, en cas de doute je peux revert ce code
src/features/offer/components/VenueSelectionListItem/VenueSelectionListItem.web.tsx
Outdated
Show resolved
Hide resolved
const ACCESS_FINE_LOCATION = 'android.permission.ACCESS_FINE_LOCATION' | ||
const ACCESS_COARSE_LOCATION = 'android.permission.ACCESS_COARSE_LOCATION' | ||
|
||
const requestGeolocPermissionSystem: AskGeolocPermission = async () => { | ||
const permissions = await PermissionsAndroid.requestMultiple([ | ||
// @ts-expect-error: because of noUncheckedIndexedAccess | ||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, | ||
// @ts-expect-error: because of noUncheckedIndexedAccess | ||
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION, | ||
ACCESS_FINE_LOCATION, | ||
ACCESS_COARSE_LOCATION, | ||
]) |
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.
est-ce qu'il serait facile, rapide et pertinent de faire une PR pour améliorer le typage de react-native ?
Quality Gate passedIssues Measures |
Quality Gate passedIssues Measures |
// @ts-expect-error: because of noUncheckedIndexedAccess | ||
isSelected={data.selectedItem === data.items[index].offerId} | ||
onSelect={() => data.onItemSelect(item.offerId)} | ||
isSelected={data.selectedItem === item?.offerId} |
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.
pourquoi a-t-on besoin de ce ?
?
No description provided.