Skip to content
Permalink
Browse files

refactor(all): remove as many 'any' types as possible

  • Loading branch information...
bitjson committed Jun 5, 2018
1 parent 46292bd commit 10750ccd1597a04af4c80a17686e24d3a4b32283
Showing with 1,548 additions and 1,480 deletions.
  1. +9 −5 src/app/app.component.ts
  2. +2 −2 src/components/expandable-header/expandable-header.spec.ts
  3. +1 −1 src/directives/ios-scroll-bg-color/ios-scroll-bg-color.spec.ts
  4. +2 −2 src/directives/navbar-bg/navbar-bg.spec.ts
  5. +1 −1 src/directives/no-low-fee/no-low-fee.ts
  6. +11 −11 src/models/profile/profile.model.ts
  7. +8 −8 src/pages/add/copayers/copayers.ts
  8. +12 −9 src/pages/add/create-wallet/create-wallet.ts
  9. +1 −1 src/pages/add/import-wallet/import-wallet.spec.ts
  10. +31 −28 src/pages/add/import-wallet/import-wallet.ts
  11. +11 −8 src/pages/add/join-wallet/join-wallet.ts
  12. +8 −8 src/pages/backup/backup-game/backup-game.ts
  13. +1 −1 src/pages/feedback/feedback-complete/feedback-complete.ts
  14. +1 −1 src/pages/feedback/feedback/feedback.ts
  15. +2 −2 src/pages/feedback/send-feedback/send-feedback.ts
  16. +1 −1 src/pages/fingerprint/fingerprint.ts
  17. +6 −6 src/pages/home/activity/activity.ts
  18. +1 −1 src/pages/home/home.spec.ts
  19. +33 −33 src/pages/home/home.ts
  20. +5 −5 src/pages/home/proposals/proposals.ts
  21. +4 −4 src/pages/includes/card-item/card-item.ts
  22. +2 −2 src/pages/includes/feedback-card/feedback-card.ts
  23. +1 −1 src/pages/includes/gravatar/gravatar.ts
  24. +1 −1 src/pages/includes/incoming-data-menu/incoming-data-menu.ts
  25. +6 −6 src/pages/includes/txp/txp.ts
  26. +2 −2 src/pages/includes/wallet-activity/wallet-activity.ts
  27. +2 −2 src/pages/includes/wallet-item/wallet-item.ts
  28. +7 −7 src/pages/includes/wallet-selector/wallet-selector.ts
  29. +6 −5 src/pages/integrations/amazon/amazon-card-details/amazon-card-details.ts
  30. +2 −2 src/pages/integrations/amazon/amazon-settings/amazon-settings.ts
  31. +13 −12 src/pages/integrations/amazon/amazon.ts
  32. +66 −70 src/pages/integrations/amazon/buy-amazon/buy-amazon.ts
  33. +4 −4 src/pages/integrations/bitpay-card/bitpay-card-intro/bitpay-card-intro.ts
  34. +39 −43 src/pages/integrations/bitpay-card/bitpay-card-topup/bitpay-card-topup.ts
  35. +8 −8 src/pages/integrations/bitpay-card/bitpay-card.ts
  36. +5 −5 src/pages/integrations/bitpay-card/bitpay-settings/bitpay-settings.ts
  37. +19 −19 src/pages/integrations/coinbase/buy-coinbase/buy-coinbase.ts
  38. +4 −4 src/pages/integrations/coinbase/coinbase-settings/coinbase-settings.ts
  39. +1 −1 src/pages/integrations/coinbase/coinbase-tx-details/coinbase-tx-details.ts
  40. +6 −6 src/pages/integrations/coinbase/coinbase.ts
  41. +29 −29 src/pages/integrations/coinbase/sell-coinbase/sell-coinbase.ts
  42. +3 −0 src/pages/integrations/gift-cards.ts
  43. +6 −10 src/pages/integrations/glidera/buy-glidera/buy-glidera.ts
  44. +4 −4 src/pages/integrations/glidera/glidera-settings/glidera-settings.ts
  45. +1 −1 src/pages/integrations/glidera/glidera-tx-details/glidera-tx-details.ts
  46. +2 −2 src/pages/integrations/glidera/glidera.ts
  47. +8 −12 src/pages/integrations/glidera/sell-glidera/sell-glidera.ts
  48. +11 −0 src/pages/integrations/integrations.ts
  49. +34 −31 src/pages/integrations/mercado-libre/buy-mercado-libre/buy-mercado-libre.ts
  50. +1 −1 src/pages/integrations/mercado-libre/mercado-libre-card-details/mercado-libre-card-details.ts
  51. +2 −2 src/pages/integrations/mercado-libre/mercado-libre-settings/mercado-libre-settings.ts
  52. +11 −11 src/pages/integrations/mercado-libre/mercado-libre.ts
  53. +57 −56 src/pages/integrations/shapeshift/shapeshift-confirm/shapeshift-confirm.ts
  54. +2 −2 src/pages/integrations/shapeshift/shapeshift-details/shapeshift-details.ts
  55. +2 −2 src/pages/integrations/shapeshift/shapeshift-settings/shapeshift-settings.ts
  56. +20 −23 src/pages/integrations/shapeshift/shapeshift-shift/shapeshift-shift.ts
  57. +7 −7 src/pages/integrations/shapeshift/shapeshift.ts
  58. +1 −1 src/pages/onboarding/collect-email/collect-email.ts
  59. +2 −2 src/pages/onboarding/disclaimer/disclaimer.ts
  60. +27 −24 src/pages/paper-wallet/paper-wallet.ts
  61. +2 −2 src/pages/paypro/paypro.ts
  62. +1 −1 src/pages/pin/pin-modal/pin-modal.spec.ts
  63. +2 −2 src/pages/pin/pin-modal/pin-modal.ts
  64. +1 −1 src/pages/receive/custom-amount/custom-amount.ts
  65. +6 −6 src/pages/receive/receive.ts
  66. +2 −2 src/pages/scan/scan.ts
  67. +12 −12 src/pages/send/amount/amount.ts
  68. +13 −22 src/pages/send/choose-fee-level/choose-fee-level.ts
  69. +1 −1 src/pages/send/confirm/confirm.spec.ts
  70. +68 −62 src/pages/send/confirm/confirm.ts
  71. +13 −13 src/pages/send/send.ts
  72. +1 −1 src/pages/settings/about/about.spec.ts
  73. +1 −1 src/pages/settings/about/session-log/session-log.spec.ts
  74. +6 −6 src/pages/settings/about/session-log/session-log.ts
  75. +6 −6 src/pages/settings/addressbook/addressbook.ts
  76. +14 −16 src/pages/settings/addressbook/view/view.ts
  77. +1 −1 src/pages/settings/advanced/advanced.ts
  78. +13 −13 src/pages/settings/alt-currency/alt-currency.ts
  79. +1 −1 src/pages/settings/fee-policy/fee-policy.spec.ts
  80. +1 −1 src/pages/settings/language/language.spec.ts
  81. +2 −2 src/pages/settings/language/language.ts
  82. +1 −1 src/pages/settings/lock/lock.ts
  83. +1 −1 src/pages/settings/notifications/notifications.spec.ts
  84. +8 −8 src/pages/settings/settings.ts
  85. +4 −4 src/pages/settings/wallet-settings/wallet-color/wallet-color.ts
  86. +2 −2 src/pages/settings/wallet-settings/wallet-name/wallet-name.ts
  87. +17 −11 src/pages/settings/wallet-settings/wallet-settings-advanced/bitcoin-cash/bitcoin-cash.ts
  88. +5 −5 ...settings/wallet-settings/wallet-settings-advanced/wallet-addresses/all-addresses/all-addresses.ts
  89. +13 −13 src/pages/settings/wallet-settings/wallet-settings-advanced/wallet-addresses/wallet-addresses.ts
  90. +1 −1 src/pages/settings/wallet-settings/wallet-settings-advanced/wallet-delete/wallet-delete.ts
  91. +10 −10 src/pages/settings/wallet-settings/wallet-settings-advanced/wallet-export/wallet-export.ts
  92. +2 −2 ...t-settings-advanced/wallet-information/wallet-extended-private-key/wallet-extended-private-key.ts
  93. +5 −5 src/pages/settings/wallet-settings/wallet-settings-advanced/wallet-information/wallet-information.ts
  94. +3 −3 src/pages/settings/wallet-settings/wallet-settings-advanced/wallet-service-url/wallet-service-url.ts
  95. +1 −1 src/pages/settings/wallet-settings/wallet-settings-advanced/wallet-settings-advanced.ts
  96. +7 −7 ...wallet-settings/wallet-settings-advanced/wallet-transaction-history/wallet-transaction-history.ts
  97. +4 −4 src/pages/settings/wallet-settings/wallet-settings.ts
  98. +1 −1 src/pages/slide-to-accept/slide-to-accept.ts
  99. +1 −1 src/pages/tabs/tabs.ts
  100. +23 −26 src/pages/tx-details/tx-details.ts
  101. +12 −12 src/pages/txp-details/txp-details.ts
  102. +9 −9 src/pages/wallet-details/search-tx-modal/search-tx-modal.ts
  103. +1 −1 src/pages/wallet-details/wallet-balance/wallet-balance.ts
  104. +1 −1 src/pages/wallet-details/wallet-details.spec.ts
  105. +11 −11 src/pages/wallet-details/wallet-details.ts
  106. +2 −2 src/pipes/fiatToUnit.ts
  107. +1 −1 src/pipes/keys.ts
  108. +4 −4 src/pipes/order-by.ts
  109. +2 −2 src/pipes/satToFiat.ts
  110. +1 −1 src/pipes/satToUnit.ts
  111. +6 −6 src/providers/address-book/address-book.ts
  112. +3 −3 src/providers/address/address.ts
  113. +6 −6 src/providers/amazon/amazon.ts
  114. +3 −3 src/providers/app/app.ts
  115. +5 −5 src/providers/backup/backup.ts
  116. +6 −6 src/providers/bitpay-account/bitpay-account.ts
  117. +6 −3 src/providers/bitpay-card/bitpay-card.ts
  118. +4 −7 src/providers/bitpay/bitpay.ts
  119. +1 −1 src/providers/bwc-error/bwc-error.ts
  120. +6 −6 src/providers/bwc/bwc.ts
  121. +40 −40 src/providers/coinbase/coinbase.ts
  122. +7 −1 src/providers/config/config.ts
  123. +36 −26 src/providers/derivation-path-helper/derivation-path-helper.spec.ts
  124. +1 −1 src/providers/derivation-path-helper/derivation-path-helper.ts
  125. +2 −2 src/providers/email-notifications/email-notifications.ts
  126. +9 −5 src/providers/fee/fee.ts
  127. +3 −3 src/providers/feedback/feedback.ts
  128. +7 −7 src/providers/filter/filter.ts
  129. +31 −35 src/providers/glidera/glidera.ts
  130. +1 −1 src/providers/home-integrations/home-integrations.ts
  131. +1 −1 src/providers/incoming-data/incoming-data.spec.ts
  132. +11 −14 src/providers/incoming-data/incoming-data.ts
  133. +3 −3 src/providers/language/language.ts
  134. +13 −13 src/providers/logger/logger.ts
  135. +19 −18 src/providers/mercado-libre/mercado-libre.ts
  136. +3 −3 src/providers/node-webkit/node-webkit.ts
  137. +4 −4 src/providers/on-going-process/on-going-process.ts
  138. +1 −1 src/providers/paypro/paypro.ts
  139. +1 −1 src/providers/persistence/persistence.spec.ts
  140. +25 −19 src/providers/persistence/persistence.ts
  141. +4 −4 src/providers/persistence/storage/file-storage.ts
  142. +2 −2 src/providers/persistence/storage/istorage.ts
  143. +4 −4 src/providers/persistence/storage/local-storage.ts
  144. +2 −2 src/providers/persistence/storage/ram-storage.ts
  145. +1 −1 src/providers/platform/platform.ts
  146. +1 −1 src/providers/popup/popup.ts
  147. +109 −110 src/providers/profile/profile.ts
  148. +14 −14 src/providers/push-notifications/push-notifications.ts
  149. +2 −2 src/providers/rate/rate.spec.ts
  150. +13 −13 src/providers/rate/rate.ts
  151. +1 −1 src/providers/release/release.spec.ts
  152. +2 −2 src/providers/release/release.ts
  153. +1 −1 src/providers/replace-parameters/replace-parameters.ts
  154. +3 −3 src/providers/scan/scan.ts
  155. +16 −16 src/providers/shapeshift/shapeshift.ts
  156. +1 −1 src/providers/time/time.ts
  157. +10 −7 src/providers/touchid/touchid.ts
  158. +9 −11 src/providers/tx-confirm-notification/tx-confirm-notification.ts
  159. +7 −7 src/providers/tx-format/tx-format.ts
  160. +1 −1 src/providers/wallet/wallet.spec.ts
  161. +168 −135 src/providers/wallet/wallet.ts
  162. +14 −16 src/test.ts
  163. +1 −1 src/validators/address.ts
  164. +1 −1 src/validators/email.ts
  165. +2 −0 tslint.json
@@ -62,11 +62,15 @@ import { WalletDetailsPage } from '../pages/wallet-details/wallet-details';
export class CopayApp {
@ViewChild('appNav') nav: NavController;

public rootPage: any;
public rootPage:
| typeof AmountPage
| typeof DisclaimerPage
| typeof TabsPage
| typeof OnboardingPage;
private onResumeSubscription: Subscription;
private isModalOpen: boolean;

private pageMap: { [name: string]: any } = {
private pageMap = {
AddressbookAddPage,
AmountPage,
BitPayCardIntroPage,
@@ -179,7 +183,7 @@ export class CopayApp {
// Check Profile
this.profile
.loadAndBindProfile()
.then((profile: any) => {
.then(profile => {
this.onProfileLoad(profile);
})
.catch((err: Error) => {
@@ -216,7 +220,7 @@ export class CopayApp {

private openLockModal(): void {
if (this.isModalOpen) return;
let config: any = this.configProvider.get();
let config = this.configProvider.get();
let lockMethod =
config && config.lock && config.lock.method
? config.lock.method.toLowerCase()
@@ -366,7 +370,7 @@ export class CopayApp {
return false;
}

private getSelectedTabNav(): any {
private getSelectedTabNav() {
return this.nav
.getActiveChildNavs()[0]
.viewCtrl.instance.tabs.getSelected();
@@ -11,8 +11,8 @@ import {
import { Subject } from 'rxjs/Subject';

let fixture: ComponentFixture<TestHostComponent>;
let instance: any;
let contentMock: any;
let instance;
let contentMock;
let ionScrollSubject: Subject<ScrollEvent>;

const scrollEventMock = {
@@ -4,7 +4,7 @@ import { TestUtils } from '../../test';
import { IosScrollBgColor } from './ios-scroll-bg-color';

let fixture: ComponentFixture<TestHostComponent>;
let instance: any;
let instance;
let scrollContent;

@Component({
@@ -4,8 +4,8 @@ import { TestUtils } from '../../test';
import { NavbarBg } from './navbar-bg';

let fixture: ComponentFixture<TestHostComponent>;
let instance: any;
let toolbarBg: any;
let instance;
let toolbarBg;

@Component({
template: `
@@ -13,7 +13,7 @@ import { PopupProvider } from '../../providers/popup/popup';
}
})
export class NoLowFee {
private configWallet: any;
private configWallet;

constructor(
private configProvider: ConfigProvider,
@@ -1,18 +1,18 @@
export class Profile {
public version: string;
public createdOn: number;
public credentials: any[];
public credentials;
public disclaimerAccepted: boolean;
public onboardingCompleted: boolean;
public checked: any;
public checkedUA?: any;
public checked;
public checkedUA?;
public dirty: boolean;

constructor() {
this.version = '1.0.0';
}

public create(opts?: any): Profile {
public create(opts?): Profile {
opts = opts ? opts : {};
let x = new Profile();
x.createdOn = Date.now();
@@ -23,7 +23,7 @@ export class Profile {
return x;
}

public fromObj(obj: any): Profile {
public fromObj(obj): Profile {
let x = new Profile();

x.createdOn = obj.createdOn;
@@ -55,15 +55,15 @@ export class Profile {
return false;
}

public isChecked(ua: any, walletId: string): boolean {
public isChecked(ua, walletId: string): boolean {
return !!(this.checkedUA == ua && this.checked[walletId]);
}

public isDeviceChecked(ua: any): boolean {
public isDeviceChecked(ua): boolean {
return this.checkedUA == ua;
}

public setChecked(ua: any, walletId: string): void {
public setChecked(ua, walletId: string): void {
if (this.checkedUA != ua) {
this.checkedUA = ua;
this.checked = {};
@@ -72,7 +72,7 @@ export class Profile {
this.dirty = true;
}

public addWallet(credentials: any): boolean {
public addWallet(credentials): boolean {
if (!credentials.walletId)
throw new Error('credentials must have .walletId');

@@ -83,13 +83,13 @@ export class Profile {
return true;
}

public updateWallet(credentials: any): boolean {
public updateWallet(credentials): boolean {
if (!credentials.walletId)
throw new Error('credentials must have .walletId');

if (!this.hasWallet(credentials.walletId)) return false;

this.credentials = this.credentials.map((c: any) => {
this.credentials = this.credentials.map(c => {
if (c.walletId != credentials.walletId) {
return c;
} else {
@@ -26,9 +26,9 @@ export class CopayersPage {
public appUrl: string = this.appProvider.info.url;
public isCordova: boolean = this.platformProvider.isCordova;

public wallet: any;
public copayers: any;
public secret: any;
public wallet;
public copayers;
public secret;

constructor(
private app: App,
@@ -73,12 +73,12 @@ export class CopayersPage {
this.logger.debug('Updating wallet:' + this.wallet.name);
this.walletProvider
.getStatus(this.wallet, {})
.then((status: any) => {
.then(status => {
this.wallet.status = status;
this.copayers = this.wallet.status.wallet.copayers;
this.secret = this.wallet.status.wallet.secret;
if (status.wallet.status == 'complete') {
this.wallet.openWallet((err: any) => {
this.wallet.openWallet(err => {
if (err) this.logger.error(err);

this.navCtrl.popToRoot();
@@ -88,7 +88,7 @@ export class CopayersPage {
});
}
})
.catch((err: any) => {
.catch(err => {
let message = this.translate.instant('Could not update wallet');
this.popupProvider.ionicAlert(this.bwcErrorProvider.msg(err, message));
return;
@@ -100,7 +100,7 @@ export class CopayersPage {
let msg = this.translate.instant(
'Are you sure you want to cancel and delete this wallet?'
);
this.popupProvider.ionicConfirm(title, msg).then((res: any) => {
this.popupProvider.ionicConfirm(title, msg).then(res => {
if (res) this.deleteWallet();
});
}
@@ -115,7 +115,7 @@ export class CopayersPage {
this.pushNotificationsProvider.unsubscribe(this.wallet);
this.app.getRootNavs()[0].setRoot(TabsPage);
})
.catch((err: any) => {
.catch(err => {
this.onGoingProcessProvider.clear();
let errorText = this.translate.instant('Error');
this.popupProvider.ionicAlert(errorText, err.message || err);
@@ -14,7 +14,10 @@ import { OnGoingProcessProvider } from '../../../providers/on-going-process/on-g
import { PopupProvider } from '../../../providers/popup/popup';
import { ProfileProvider } from '../../../providers/profile/profile';
import { PushNotificationsProvider } from '../../../providers/push-notifications/push-notifications';
import { WalletProvider } from '../../../providers/wallet/wallet';
import {
WalletOptions,
WalletProvider
} from '../../../providers/wallet/wallet';

import * as _ from 'lodash';

@@ -24,7 +27,7 @@ import * as _ from 'lodash';
})
export class CreateWalletPage implements OnInit {
/* For compressed keys, m*73 + n*34 <= 496 */
private COPAYER_PAIR_LIMITS: any = {
private COPAYER_PAIR_LIMITS = {
1: 1,
2: 2,
3: 3,
@@ -40,15 +43,15 @@ export class CreateWalletPage implements OnInit {
};

private createForm: FormGroup;
private defaults: any;
private defaults;
private tc: number;
private derivationPathByDefault: string;
private derivationPathForTestnet: string;

public copayers: number[];
public signatures: number[];
public showAdvOpts: boolean;
public seedOptions: any;
public seedOptions;
public isShared: boolean;
public title: string;

@@ -134,7 +137,7 @@ export class CreateWalletPage implements OnInit {
this.createForm.controls['selectedSeed'].setValue(this.seedOptions[0].id); // new or set
}

public seedOptionsChange(seed: any): void {
public seedOptionsChange(seed): void {
if (seed === 'set') {
this.createForm
.get('recoveryPhrase')
@@ -159,7 +162,7 @@ export class CreateWalletPage implements OnInit {
}

public setOptsAndCreate(): void {
let opts: any = {
let opts: Partial<WalletOptions> = {
name: this.createForm.value.walletName,
m: this.createForm.value.requiredCopayers,
n: this.createForm.value.totalCopayers,
@@ -212,12 +215,12 @@ export class CreateWalletPage implements OnInit {
this.create(opts);
}

private create(opts: any): void {
private create(opts): void {
this.onGoingProcessProvider.set('creatingWallet');

this.profileProvider
.createWallet(opts)
.then((wallet: any) => {
.then(wallet => {
this.onGoingProcessProvider.clear();
this.events.publish('status:updated');
this.walletProvider.updateRemotePreferences(wallet);
@@ -236,7 +239,7 @@ export class CreateWalletPage implements OnInit {
this.navCtrl.popToRoot();
}
})
.catch((err: any) => {
.catch(err => {
this.onGoingProcessProvider.clear();
this.logger.error('Create: could not create wallet', err);
let title = this.translate.instant('Error');
@@ -4,7 +4,7 @@ import { ImportWalletPage } from './import-wallet';

describe('ImportWalletPage', () => {
let fixture: ComponentFixture<ImportWalletPage>;
let instance: any;
let instance;
let testBed: typeof TestBed;

beforeEach(async(() => {
Oops, something went wrong.

0 comments on commit 10750cc

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.