From 63722c2417dbcbff7ca3b62e1b63389d47768aac Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Mon, 10 May 2021 18:00:57 +0200 Subject: [PATCH] fix some ts errors --- src/components/Home/FeedItem.tsx | 2 +- .../Lists/DashboardEdit/DashboardEditAccordion.tsx | 2 +- src/components/Lists/PlanexGroups/GroupListAccordion.tsx | 2 +- src/components/Overrides/CustomHTML.tsx | 6 +++--- src/managers/ConnectionManager.ts | 6 +++--- src/screens/Amicale/Clubs/ClubAboutScreen.tsx | 2 +- src/screens/Amicale/Clubs/ClubListScreen.tsx | 2 +- src/screens/Home/ScannerScreen.tsx | 7 ++++++- src/screens/Planning/PlanningScreen.tsx | 4 ++-- 9 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/components/Home/FeedItem.tsx b/src/components/Home/FeedItem.tsx index 49ecef4..bbd1147 100644 --- a/src/components/Home/FeedItem.tsx +++ b/src/components/Home/FeedItem.tsx @@ -113,7 +113,7 @@ function FeedItem(props: PropsType) { ) : null} {item.message !== undefined ? ( - + | null | undefined, + _data: Array | null | undefined, index: number ): { length: number; offset: number; index: number } => ({ length: LIST_ITEM_HEIGHT, diff --git a/src/components/Lists/PlanexGroups/GroupListAccordion.tsx b/src/components/Lists/PlanexGroups/GroupListAccordion.tsx index e73a100..dd18927 100644 --- a/src/components/Lists/PlanexGroups/GroupListAccordion.tsx +++ b/src/components/Lists/PlanexGroups/GroupListAccordion.tsx @@ -88,7 +88,7 @@ class GroupListAccordion extends React.Component { } itemLayout = ( - data: Array | null | undefined, + _data: Array | null | undefined, index: number ): { length: number; offset: number; index: number } => ({ length: LIST_ITEM_HEIGHT, diff --git a/src/components/Overrides/CustomHTML.tsx b/src/components/Overrides/CustomHTML.tsx index 948912f..dc9f70e 100644 --- a/src/components/Overrides/CustomHTML.tsx +++ b/src/components/Overrides/CustomHTML.tsx @@ -30,14 +30,14 @@ type PropsType = { * Abstraction layer for Agenda component, using custom configuration */ function CustomHTML(props: PropsType) { - const openWebLink = (event: GestureResponderEvent, link: string) => { + const openWebLink = (_event: GestureResponderEvent, link: string) => { Linking.openURL(link); }; const getBasicText = ( - htmlAttribs: any, + _htmlAttribs: any, children: any, - convertedCSSStyles: any, + _convertedCSSStyles: any, passProps: any ) => { return {children}; diff --git a/src/managers/ConnectionManager.ts b/src/managers/ConnectionManager.ts index 12227d8..fa12c07 100644 --- a/src/managers/ConnectionManager.ts +++ b/src/managers/ConnectionManager.ts @@ -67,9 +67,9 @@ export default class ConnectionManager { /** * Tries to recover login token from the secure keychain * - * @returns Promise + * @returns Promise */ - async recoverLogin(): Promise { + async recoverLogin(): Promise { return new Promise((resolve: () => void) => { const token = this.getToken(); if (token != null) { @@ -103,7 +103,7 @@ export default class ConnectionManager { * @param token * @returns Promise */ - async saveLogin(email: string, token: string): Promise { + async saveLogin(_email: string, token: string): Promise { return new Promise((resolve: () => void, reject: () => void) => { Keychain.setGenericPassword('token', token) .then(() => { diff --git a/src/screens/Amicale/Clubs/ClubAboutScreen.tsx b/src/screens/Amicale/Clubs/ClubAboutScreen.tsx index 45a2ef0..a477d27 100644 --- a/src/screens/Amicale/Clubs/ClubAboutScreen.tsx +++ b/src/screens/Amicale/Clubs/ClubAboutScreen.tsx @@ -69,7 +69,7 @@ function ClubAboutScreen() { /> {i18n.t('screens.clubs.about.message')} - + { keyExtractor = (item: ClubType): string => item.id.toString(); itemLayout = ( - data: Array | null | undefined, + _data: Array | null | undefined, index: number ): { length: number; offset: number; index: number } => ({ length: LIST_ITEM_HEIGHT, diff --git a/src/screens/Home/ScannerScreen.tsx b/src/screens/Home/ScannerScreen.tsx index 5a48331..944221c 100644 --- a/src/screens/Home/ScannerScreen.tsx +++ b/src/screens/Home/ScannerScreen.tsx @@ -61,7 +61,12 @@ const styles = StyleSheet.create({ }, }); -type PermissionResults = 'unavailable' | 'denied' | 'blocked' | 'granted'; +type PermissionResults = + | 'unavailable' + | 'denied' + | 'blocked' + | 'granted' + | 'limited'; class ScannerScreen extends React.Component<{}, StateType> { constructor(props: {}) { diff --git a/src/screens/Planning/PlanningScreen.tsx b/src/screens/Planning/PlanningScreen.tsx index b2dd409..50e5f1a 100644 --- a/src/screens/Planning/PlanningScreen.tsx +++ b/src/screens/Planning/PlanningScreen.tsx @@ -174,8 +174,8 @@ class PlanningScreen extends React.Component { if (canRefresh) { this.setState({ refreshing: true }); - readData(Urls.amicale.events) - .then((fetchedData: Array) => { + readData>(Urls.amicale.events) + .then((fetchedData) => { this.setState({ refreshing: false, agendaItems: generateEventAgenda(fetchedData, AGENDA_MONTH_SPAN),