fix some ts errors

This commit is contained in:
Arnaud Vergnet 2021-05-10 18:00:57 +02:00
parent 2bbb3f60ce
commit 63722c2417
9 changed files with 19 additions and 14 deletions

View file

@ -113,7 +113,7 @@ function FeedItem(props: PropsType) {
) : null}
<Card.Content>
{item.message !== undefined ? (
<Autolink<typeof Text>
<Autolink
text={item.message}
hashtag={'facebook'}
component={Text}

View file

@ -60,7 +60,7 @@ function DashboardEditAccordion(props: PropsType) {
};
const getItemLayout = (
data: Array<ServiceItemType> | null | undefined,
_data: Array<ServiceItemType> | null | undefined,
index: number
): { length: number; offset: number; index: number } => ({
length: LIST_ITEM_HEIGHT,

View file

@ -88,7 +88,7 @@ class GroupListAccordion extends React.Component<PropsType> {
}
itemLayout = (
data: Array<PlanexGroupType> | null | undefined,
_data: Array<PlanexGroupType> | null | undefined,
index: number
): { length: number; offset: number; index: number } => ({
length: LIST_ITEM_HEIGHT,

View file

@ -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 <Text {...passProps}>{children}</Text>;

View file

@ -67,9 +67,9 @@ export default class ConnectionManager {
/**
* Tries to recover login token from the secure keychain
*
* @returns Promise<string>
* @returns Promise<void>
*/
async recoverLogin(): Promise<string> {
async recoverLogin(): Promise<void> {
return new Promise((resolve: () => void) => {
const token = this.getToken();
if (token != null) {
@ -103,7 +103,7 @@ export default class ConnectionManager {
* @param token
* @returns Promise<void>
*/
async saveLogin(email: string, token: string): Promise<void> {
async saveLogin(_email: string, token: string): Promise<void> {
return new Promise((resolve: () => void, reject: () => void) => {
Keychain.setGenericPassword('token', token)
.then(() => {

View file

@ -69,7 +69,7 @@ function ClubAboutScreen() {
/>
<Card.Content>
<Text>{i18n.t('screens.clubs.about.message')}</Text>
<Autolink<typeof Text>
<Autolink
text={CONTACT_LINK}
hashtag={'facebook'}
component={Text}

View file

@ -224,7 +224,7 @@ class ClubListScreen extends React.Component<PropsType, StateType> {
keyExtractor = (item: ClubType): string => item.id.toString();
itemLayout = (
data: Array<ClubType> | null | undefined,
_data: Array<ClubType> | null | undefined,
index: number
): { length: number; offset: number; index: number } => ({
length: LIST_ITEM_HEIGHT,

View file

@ -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: {}) {

View file

@ -174,8 +174,8 @@ class PlanningScreen extends React.Component<PropsType, StateType> {
if (canRefresh) {
this.setState({ refreshing: true });
readData(Urls.amicale.events)
.then((fetchedData: Array<PlanningEventType>) => {
readData<Array<PlanningEventType>>(Urls.amicale.events)
.then((fetchedData) => {
this.setState({
refreshing: false,
agendaItems: generateEventAgenda(fetchedData, AGENDA_MONTH_SPAN),