Skip to content
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

chore: [#174318137] Upgrade typescript to 3.9.7 #2154

Merged
merged 41 commits into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4c432b5
[#173888442] update react-native-webview
fabriziofff Aug 10, 2020
fdcc0cd
[#173917003] upgrade redux saga to 1.1.3
fabriziofff Aug 11, 2020
6e69575
fix all typescript errors
fabriziofff Aug 11, 2020
e67ee75
fix delay
fabriziofff Aug 11, 2020
6251333
Merge branch 'master' into 173888442-update-react-native-webview
fabriziofff Aug 11, 2020
86c2652
Merge remote-tracking branch 'origin/173888442-update-react-native-we…
fabriziofff Aug 11, 2020
4cd6405
Merge branch 'master' into 173888442-update-react-native-webview
fabriziofff Aug 11, 2020
b310136
Merge remote-tracking branch 'origin/173888442-update-react-native-we…
fabriziofff Aug 11, 2020
d07d29f
fix lint
fabriziofff Aug 11, 2020
bc5b85e
fix lint
fabriziofff Aug 11, 2020
a016436
fix saga test
fabriziofff Aug 11, 2020
8a61e00
Merge remote-tracking branch 'origin/master' into 173888442-update-re…
fabriziofff Aug 11, 2020
30a9405
Merge branch '173888442-update-react-native-webview' into 173917003-u…
fabriziofff Aug 11, 2020
c6acf45
Merge remote-tracking branch 'origin/master' into 173888442-update-re…
fabriziofff Aug 11, 2020
6a1611b
Merge branch '173888442-update-react-native-webview' into 173917003-u…
fabriziofff Aug 11, 2020
687c034
Merge branch 'master' into 173888442-update-react-native-webview
fabriziofff Aug 12, 2020
fa27668
Merge branch '173888442-update-react-native-webview' into 173917003-u…
fabriziofff Aug 12, 2020
3de8a69
[#165057751] Migrate Typescript transpile to babel
fabriziofff Aug 12, 2020
daacb06
Merge branch 'master' into 173888442-update-react-native-webview
fabriziofff Aug 13, 2020
c02550f
Merge branch '173888442-update-react-native-webview' into 173917003-u…
fabriziofff Aug 13, 2020
06316b4
Merge branch '173917003-upgrade-redux-saga' into 165057751-transpile-…
fabriziofff Aug 13, 2020
3715c31
Merge branch 'master' into 165057751-transpile-typescript-with-babel
Undermaken Aug 13, 2020
9662a57
[#174318137] upgrade saga signature
fabriziofff Aug 13, 2020
5d97075
fix types for react-native-text--input-mask
fabriziofff Aug 13, 2020
b455131
fix left and right
fabriziofff Aug 14, 2020
b13cd15
fix flagsecure
fabriziofff Aug 14, 2020
5ea2a24
fix cancel task
fabriziofff Aug 14, 2020
24511ea
fix right
fabriziofff Aug 14, 2020
5bb89d0
fix typescript errors
fabriziofff Aug 14, 2020
088e9c3
fix contentRefreshControl type
fabriziofff Aug 14, 2020
709cac4
fix import for babel
fabriziofff Aug 14, 2020
9e509b6
Merge remote-tracking branch 'origin/master' into 165057751-transpile…
fabriziofff Aug 14, 2020
26781f4
Merge remote-tracking branch 'origin/165057751-transpile-typescript-w…
fabriziofff Aug 14, 2020
4201c62
Merge branch '165057751-transpile-typescript-with-babel' into 1743181…
fabriziofff Aug 14, 2020
ebb0b11
fix yarn lock
fabriziofff Aug 14, 2020
e8b7642
remove test on message cache
fabriziofff Aug 14, 2020
e655479
Merge remote-tracking branch 'origin/master' into 165057751-transpile…
fabriziofff Aug 14, 2020
77f805f
Merge branch '165057751-transpile-typescript-with-babel' into 1743181…
fabriziofff Aug 14, 2020
1044b75
Merge branch 'master' into 165057751-transpile-typescript-with-babel
Undermaken Aug 14, 2020
c111f35
Merge remote-tracking branch 'origin/165057751-transpile-typescript-w…
fabriziofff Aug 14, 2020
d5f0c4e
Merge branch 'master' into 174318137-upgrade-typescript
Undermaken Aug 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"ts-jest": "^25.1.0",
"ts-node": "^7.0.1",
"tslint": "5.20.0",
"typescript": "3.4.1"
"typescript": "^3.9.7"
},
"resolutions": {
"@types/react": "16.7.18",
Expand Down
23 changes: 23 additions & 0 deletions patches/@types+react-native-text-input-mask+0.7.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/node_modules/@types/react-native-text-input-mask/index.d.ts b/node_modules/@types/react-native-text-input-mask/index.d.ts
index 4cf4b39..8eacdbc 100644
--- a/node_modules/@types/react-native-text-input-mask/index.d.ts
+++ b/node_modules/@types/react-native-text-input-mask/index.d.ts
@@ -4,6 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

+import {MutableRefObject} from "react";
import * as React from "react";
import * as ReactNative from "react-native";

@@ -221,6 +222,10 @@ export interface TextInputMaskProps extends ReactNative.ViewProps, ReactNative.T
* or set/update maxLength to prevent unwanted edits without flicker.
*/
value?: string;
+
+ // Patch: Adding missing types ref and isNumericSecureKeyboard
+ ref?: ((instance: TextInputMask | null) => void) | MutableRefObject<TextInputMask | null> | null;
+ isNumericSecureKeyboard?: boolean,
}

export default class TextInputMask extends React.Component<TextInputMaskProps> { }
7 changes: 7 additions & 0 deletions patches/patches.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@ Created on **12/08/2020**

#### Reason:
- Use TouchableHighlight instead of TouchableNativeFeedback on Android sdk < 19 to avoid crash.


### @types/react-native-text-input-mask+0.7.2
Created on **13/08/2020**

#### Reason:
- Add missing props types for TextInputMaskProps.
5 changes: 1 addition & 4 deletions ts/components/FlagSecure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,4 @@ const mapStateToProps = (state: GlobalState) => ({
isAllowedSnapshotCurrentScreen: isAllowedSnapshotCurrentScreen(state)
});

export default connect(
mapStateToProps,
null
)(FlagSecureComponent);
export default connect(mapStateToProps)(FlagSecureComponent);
8 changes: 4 additions & 4 deletions ts/components/screens/DarkLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* A component to display a brandDarkGray background color on the screen using it
*/
import { View } from "native-base";
import { Content, View } from "native-base";
import * as React from "react";
import {
Animated,
ImageSourcePropType,
RefreshControlProps,
StyleProp,
StyleSheet,
ViewStyle
} from "react-native";
import { StyleSheet } from "react-native";
import LinearGradient from "react-native-linear-gradient";
import { IconProps } from "react-native-vector-icons/Icon";
import customVariables from "../../theme/variables";
Expand Down Expand Up @@ -41,7 +41,7 @@ type Props = Readonly<{
footerContent?: React.ReactNode;
contextualHelp?: ContextualHelpProps;
contextualHelpMarkdown?: ContextualHelpPropsMarkdown;
contentRefreshControl?: React.ReactElement<RefreshControlProps>;
contentRefreshControl?: Animated.ComponentProps<Content>["refreshControl"];
faqCategories?: ReadonlyArray<FAQsCategoriesType>;
customGoBack?: React.ReactNode;
gradientHeader?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions ts/components/screens/ScreenContent.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Content } from "native-base";
import * as React from "react";
import { NavigationEvents } from "react-navigation";

import { RefreshControlProps, StyleProp, ViewStyle } from "react-native";
import { StyleProp, ViewStyle } from "react-native";
import { NavigationEvents } from "react-navigation";
import { ComponentProps } from "../../types/react";
import { ScreenContentHeader } from "./ScreenContentHeader";

interface OwnProps {
hideHeader?: boolean;
contentStyle?: StyleProp<ViewStyle>;
bounces?: boolean;
contentRefreshControl?: React.ReactElement<RefreshControlProps>;
contentRefreshControl?: ComponentProps<Content>["refreshControl"];
}

type Props = OwnProps & ComponentProps<typeof ScreenContentHeader>;
Expand Down
11 changes: 3 additions & 8 deletions ts/components/wallet/WalletLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
* footer with a button for starting a new payment
*/

import { Text, View } from "native-base";
import { Content, Text, View } from "native-base";
import * as React from "react";
import {
RefreshControlProps,
StyleProp,
StyleSheet,
ViewStyle
} from "react-native";
import { Animated, StyleProp, StyleSheet, ViewStyle } from "react-native";
import I18n from "../../i18n";
import customVariables from "../../theme/variables";
import { FAQsCategoriesType } from "../../utils/faq";
Expand All @@ -36,7 +31,7 @@ type Props = Readonly<{
hideHeader?: boolean;
footerContent?: React.ReactNode;
contentStyle?: StyleProp<ViewStyle>;
refreshControl?: React.ReactElement<RefreshControlProps>;
refreshControl?: Animated.ComponentProps<Content>["refreshControl"];
contextualHelp?: ContextualHelpProps;
contextualHelpMarkdown?: ContextualHelpPropsMarkdown;
faqCategories?: ReadonlyArray<FAQsCategoriesType>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ function* getBonusActivation(
typeof BackendBonusVacanze
>["getLatestBonusVacanzeFromId"],
bonusId: string
): IterableIterator<Effect | Either<Option<Error>, BonusActivationWithQrCode>> {
): Generator<
Effect,
Either<Option<Error>, BonusActivationWithQrCode>,
SagaCallReturnType<typeof getLatestBonusVacanzeFromId>
> {
try {
const getLatestBonusVacanzeFromIdResult: SagaCallReturnType<
typeof getLatestBonusVacanzeFromId
Expand All @@ -49,32 +53,38 @@ function* getBonusActivation(
switch (activation.status) {
// processing -> polling should continue
case BonusActivationStatusEnum.PROCESSING:
return left(none);
return left<Option<Error>, BonusActivationWithQrCode>(none);
case BonusActivationStatusEnum.FAILED:
// blocking error
return left(some(new Error("Bonus Activation failed")));
return left<Option<Error>, BonusActivationWithQrCode>(
some(new Error("Bonus Activation failed"))
);
default:
// active
return right(getLatestBonusVacanzeFromIdResult.value.value);
return right<Option<Error>, BonusActivationWithQrCode>(
getLatestBonusVacanzeFromIdResult.value.value
);
}
}
// Request not found - polling must be stopped
if (getLatestBonusVacanzeFromIdResult.value.status === 404) {
return left(some(new Error("Bonus Activation not found")));
return left<Option<Error>, BonusActivationWithQrCode>(
some(new Error("Bonus Activation not found"))
);
}
// polling should continue
return left(none);
return left<Option<Error>, BonusActivationWithQrCode>(none);
} else {
// we got some error on decoding, stop polling
return left(
return left<Option<Error>, BonusActivationWithQrCode>(
some(
Error(readablePrivacyReport(getLatestBonusVacanzeFromIdResult.value))
)
);
}
} catch (e) {
// polling should continue
return left(none);
return left<Option<Error>, BonusActivationWithQrCode>(none);
}
}

Expand All @@ -87,8 +97,10 @@ export const bonusActivationSaga = (
typeof BackendBonusVacanze
>["getLatestBonusVacanzeFromId"]
) =>
function* startBonusActivationSaga(): IterableIterator<
Effect | ActionType<typeof activateBonusVacanze>
function* startBonusActivationSaga(): Generator<
Effect,
ActionType<typeof activateBonusVacanze>,
any
> {
try {
const startBonusActivationProcedureResult: SagaCallReturnType<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ function* getCheckBonusEligibilitySaga(
getBonusEligibilityCheck: ReturnType<
typeof BackendBonusVacanze
>["getBonusEligibilityCheck"]
): IterableIterator<Effect | Either<Option<Error>, EligibilityCheck>> {
): Generator<
Effect,
Either<Option<Error>, EligibilityCheck>,
SagaCallReturnType<typeof getBonusEligibilityCheck>
> {
try {
const eligibilityCheckResult: SagaCallReturnType<
typeof getBonusEligibilityCheck
Expand All @@ -68,18 +72,18 @@ function* getCheckBonusEligibilitySaga(
// 200 -> we got the check result, polling must be stopped
if (eligibilityCheckResult.value.status === 200) {
const check = eligibilityCheckResult.value.value;
return right(check);
return right<Option<Error>, EligibilityCheck>(check);
}
// polling should continue
return left(none);
return left<Option<Error>, EligibilityCheck>(none);
} else {
// we got some error on decoding, stop polling
return left(
return left<Option<Error>, EligibilityCheck>(
some(Error(readablePrivacyReport(eligibilityCheckResult.value)))
);
}
} catch (e) {
return left(none);
return left<Option<Error>, EligibilityCheck>(none);
}
}

Expand All @@ -105,8 +109,10 @@ export const bonusEligibilitySaga = (
typeof BackendBonusVacanze
>["getBonusEligibilityCheck"]
) =>
function* getBonusEligibilitySaga(): IterableIterator<
Effect | ActionType<typeof checkBonusVacanzeEligibility>
function* getBonusEligibilitySaga(): Generator<
Effect,
ActionType<typeof checkBonusVacanzeEligibility>,
any
> {
try {
const startEligibilityResult: SagaCallReturnType<
Expand Down
10 changes: 6 additions & 4 deletions ts/sagas/backendInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const BACKEND_INFO_LOAD_INTERVAL = 60 * 60 * 1000;
// retry loading backend info every 10 seconds on error
const BACKEND_INFO_RETRY_INTERVAL = 10 * 1000;

function* backendInfoWatcher(): IterableIterator<Effect> {
function* backendInfoWatcher(): Generator<
Effect,
void,
SagaCallReturnType<typeof getServerInfo>
> {
const backendPublicClient = BackendPublicClient(apiUrlPrefix);

function getServerInfo(): Promise<
Expand All @@ -36,9 +40,7 @@ function* backendInfoWatcher(): IterableIterator<Effect> {

while (true) {
try {
const backendInfoResponse: SagaCallReturnType<
typeof getServerInfo
> = yield call(getServerInfo);
const backendInfoResponse = yield call(getServerInfo);
if (
backendInfoResponse.isRight() &&
backendInfoResponse.value.status === 200
Expand Down
9 changes: 3 additions & 6 deletions ts/sagas/backendStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ const BACKEND_SERVICES_STATUS_FAILURE_INTERVAL = (10 * 1000) as Millisecond;
// Return true if it has information (200) false otherwise
export function* backendStatusSaga(
getServicesStatus: ReturnType<typeof CdnBackendStatusClient>["getStatus"]
): IterableIterator<Effect | boolean> {
): Generator<Effect, boolean, SagaCallReturnType<typeof getServicesStatus>> {
try {
const response: SagaCallReturnType<typeof getServicesStatus> = yield call(
getServicesStatus,
{}
);
const response = yield call(getServicesStatus, {});
if (response.isRight() && response.value.status === 200) {
yield put(backendStatusLoadSuccess(response.value.value));
return true;
Expand All @@ -40,7 +37,7 @@ export function* backendStatusSaga(
*/
export function* backendStatusWatcherLoop(
getStatus: ReturnType<typeof CdnBackendStatusClient>["getStatus"]
): IterableIterator<Effect> {
) {
// check backend status periodically
while (true) {
const response: SagaCallReturnType<typeof backendStatusSaga> = yield call(
Expand Down
10 changes: 7 additions & 3 deletions ts/sagas/contentLoaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ function* watchServiceMetadataLoadSaga(
function* fetchMunicipalityMetadata(
getMunicipality: ReturnType<typeof ContentClient>["getMunicipality"],
codiceCatastale: CodiceCatastale
): IterableIterator<Effect | Either<Error, MunicipalityMedadata>> {
): Generator<
Effect,
Either<Error, MunicipalityMedadata>,
SagaCallReturnType<typeof getMunicipality>
> {
try {
const response: SagaCallReturnType<typeof getMunicipality> = yield call(
getMunicipality,
Expand All @@ -153,9 +157,9 @@ function* fetchMunicipalityMetadata(
if (response.value.status !== 200) {
throw Error(`response status ${response.value.status}`);
}
return right(response.value.value);
return right<Error, MunicipalityMedadata>(response.value.value);
} catch (error) {
return left(error);
return left<Error, MunicipalityMedadata>(error);
}
}

Expand Down
8 changes: 6 additions & 2 deletions ts/sagas/identification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ type ResultAction =
| ActionType<typeof identificationForceLogout>
| ActionType<typeof identificationSuccess>;
// Wait the identification and return the result
function* waitIdentificationResult(): Iterator<Effect | IdentificationResult> {
function* waitIdentificationResult(): Generator<
Effect,
void | IdentificationResult,
any
> {
const resultAction: ResultAction = yield take([
getType(identificationCancel),
getType(identificationPinReset),
Expand Down Expand Up @@ -136,7 +140,7 @@ export function* startAndReturnIdentificationResult(
function* startAndHandleIdentificationResult(
pin: PinString,
identificationRequestAction: ActionType<typeof identificationRequest>
): IterableIterator<Effect> {
) {
yield put(
identificationStart(
pin,
Expand Down
7 changes: 2 additions & 5 deletions ts/sagas/instabug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
instabugUnreadMessagesLoaded,
updateInstabugUnreadMessages
} from "../store/actions/instabug";
import { SagaCallReturnType } from "../types/utils";

const loadInstabugUnreadMessages = () => {
return new Promise<number>(resolve => {
Expand All @@ -31,10 +30,8 @@ function* watchInstabugSaga(): IterableIterator<Effect> {
}
}

function* updateInstabugBadgeSaga(): IterableIterator<Effect> {
const repliesCount: SagaCallReturnType<
typeof loadInstabugUnreadMessages
> = yield call(loadInstabugUnreadMessages);
function* updateInstabugBadgeSaga(): Generator<any, void, number> {
const repliesCount = yield call(loadInstabugUnreadMessages);
yield put(instabugUnreadMessagesLoaded(repliesCount));
}

Expand Down
6 changes: 4 additions & 2 deletions ts/sagas/installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import { deletePin } from "../utils/keychain";
* This generator function removes user data from previous application
* installation
*/
export function* previousInstallationDataDeleteSaga(): IterableIterator<
Effect
export function* previousInstallationDataDeleteSaga(): Generator<
Effect,
void,
boolean
> {
const isFirstRunAfterInstall: ReturnType<
typeof isFirstRunAfterInstallSelector
Expand Down
Loading