Browse Source

fix: @typescript-eslint/consistent-type-assertions

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
pull/3982/head
dw-0 10 months ago
parent
commit
e45923aee1
  1. 1
      .eslintrc.json
  2. 2
      apps/api/src/app/account-balance/account-balance.service.ts
  3. 4
      apps/api/src/app/account/account.service.ts
  4. 4
      apps/api/src/app/admin/queue/queue.controller.ts
  5. 2
      apps/api/src/app/auth/auth.controller.ts
  6. 4
      apps/api/src/app/benchmark/benchmark.service.ts
  7. 6
      apps/api/src/app/order/order.service.ts
  8. 4
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
  9. 4
      apps/api/src/app/portfolio/portfolio.service.ts
  10. 4
      apps/api/src/app/redis-cache/redis-cache.module.ts
  11. 2
      apps/api/src/app/subscription/subscription.controller.ts
  12. 13
      apps/api/src/app/user/update-user-setting.dto.ts
  13. 2
      apps/api/src/app/user/user.controller.ts
  14. 39
      apps/api/src/app/user/user.service.ts
  15. 16
      apps/api/src/services/api/api.service.ts
  16. 29
      apps/api/src/services/market-data/market-data.service.ts
  17. 8
      apps/api/src/services/queues/data-gathering/data-gathering.processor.ts
  18. 22
      apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts
  19. 2
      apps/api/src/services/symbol-profile/symbol-profile.service.ts
  20. 4
      apps/client/src/app/app.component.ts
  21. 4
      apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts
  22. 27
      apps/client/src/app/components/admin-market-data/admin-market-data.component.ts
  23. 4
      apps/client/src/app/components/admin-overview/admin-overview.component.ts
  24. 13
      apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
  25. 2
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  26. 11
      apps/client/src/app/components/investment-chart/investment-chart.component.ts
  27. 4
      apps/client/src/app/pages/accounts/accounts-page.component.ts
  28. 8
      apps/client/src/app/pages/portfolio/activities/activities-page.component.ts
  29. 4
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  30. 20
      apps/client/src/app/services/data.service.ts
  31. 4
      apps/client/src/app/services/user/user.service.ts
  32. 6
      apps/client/src/main.ts
  33. 4
      libs/common/src/lib/config.ts
  34. 2
      libs/common/src/lib/helper.ts
  35. 2
      libs/ui/src/lib/activities-filter/activities-filter.component.ts
  36. 4
      libs/ui/src/lib/assistant/assistant.component.ts
  37. 4
      libs/ui/src/lib/benchmark/benchmark.component.ts
  38. 19
      libs/ui/src/lib/line-chart/line-chart.component.ts
  39. 16
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
  40. 4
      libs/ui/src/lib/value/value.component.ts

1
.eslintrc.json

@ -143,7 +143,6 @@
// The following rules are part of @typescript-eslint/stylistic-type-checked
// and can be remove once solved
"@typescript-eslint/prefer-nullish-coalescing": "warn", // TODO: Requires strictNullChecks: true
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/consistent-indexed-object-style": "warn",
"@typescript-eslint/consistent-generic-constructors": "warn"

2
apps/api/src/app/account-balance/account-balance.service.ts

@ -88,7 +88,7 @@ export class AccountBalanceService {
this.eventEmitter.emit(
PortfolioChangedEvent.getName(),
new PortfolioChangedEvent({
userId: <string>where.userId
userId: where.userId as string
})
);

4
apps/api/src/app/account/account.service.ts

@ -209,8 +209,8 @@ export class AccountService {
const { data, where } = params;
await this.accountBalanceService.createOrUpdateAccountBalance({
accountId: <string>data.id,
balance: <number>data.balance,
accountId: data.id as string,
balance: data.balance as number,
date: format(new Date(), DATE_FORMAT),
userId: aUserId
});

4
apps/api/src/app/admin/queue/queue.controller.ts

@ -26,7 +26,7 @@ export class QueueController {
public async deleteJobs(
@Query('status') filterByStatus?: string
): Promise<void> {
const status = <JobStatus[]>filterByStatus?.split(',') ?? undefined;
const status = (filterByStatus?.split(',') as JobStatus[]) ?? undefined;
return this.queueService.deleteJobs({ status });
}
@ -36,7 +36,7 @@ export class QueueController {
public async getJobs(
@Query('status') filterByStatus?: string
): Promise<AdminJobs> {
const status = <JobStatus[]>filterByStatus?.split(',') ?? undefined;
const status = (filterByStatus?.split(',') as JobStatus[]) ?? undefined;
return this.queueService.getJobs({ status });
}

2
apps/api/src/app/auth/auth.controller.ts

@ -85,7 +85,7 @@ export class AuthController {
@Res() response: Response
) {
// Handles the Google OAuth2 callback
const jwt: string = (<any>request.user).jwt;
const jwt: string = (request.user as any).jwt;
if (jwt) {
response.redirect(

4
apps/api/src/app/benchmark/benchmark.service.ts

@ -442,10 +442,10 @@ export class BenchmarkService {
await this.redisCacheService.set(
this.CACHE_KEY_BENCHMARKS,
JSON.stringify(<BenchmarkValue>{
JSON.stringify({
benchmarks,
expiration: expiration.getTime()
}),
} as BenchmarkValue),
CACHE_TTL_INFINITE
);
}

6
apps/api/src/app/order/order.service.ts

@ -410,7 +410,7 @@ export class OrderService {
where.SymbolProfile,
{
AND: [
{ dataSource: <DataSource>filterByDataSource },
{ dataSource: filterByDataSource as DataSource },
{ symbol: filterBySymbol }
]
}
@ -419,7 +419,7 @@ export class OrderService {
} else {
where.SymbolProfile = {
AND: [
{ dataSource: <DataSource>filterByDataSource },
{ dataSource: filterByDataSource as DataSource },
{ symbol: filterBySymbol }
]
};
@ -638,7 +638,7 @@ export class OrderService {
{
dataSource:
data.SymbolProfile.connect.dataSource_symbol.dataSource,
date: <Date>data.date,
date: data.date as Date,
symbol: data.SymbolProfile.connect.dataSource_symbol.symbol
}
],

4
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts

@ -796,7 +796,7 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
[key: DateRange]: Big;
} = {};
for (const dateRange of <DateRange[]>[
for (const dateRange of [
'1d',
'1y',
'5y',
@ -812,7 +812,7 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
// .map((date) => {
// return format(date, 'yyyy');
// })
]) {
] as DateRange[]) {
const dateInterval = getIntervalFromDateRange(dateRange);
const endDate = dateInterval.endDate;
let startDate = dateInterval.startDate;

4
apps/api/src/app/portfolio/portfolio.service.ts

@ -138,7 +138,7 @@ export class PortfolioService {
some: {
SymbolProfile: {
AND: [
{ dataSource: <DataSource>filterByDataSource },
{ dataSource: filterByDataSource as DataSource },
{ symbol: filterBySymbol }
]
}
@ -1160,7 +1160,7 @@ export class PortfolioService {
public async getReport(impersonationId: string): Promise<PortfolioReport> {
const userId = await this.getUserId(impersonationId, this.request.user.id);
const userSettings = <UserSettings>this.request.user.Settings.settings;
const userSettings = this.request.user.Settings.settings as UserSettings;
const { accounts, holdings, markets, summary } = await this.getDetails({
impersonationId,

4
apps/api/src/app/redis-cache/redis-cache.module.ts

@ -19,11 +19,11 @@ import { RedisCacheService } from './redis-cache.service';
configurationService.get('REDIS_PASSWORD')
);
return <RedisClientOptions>{
return {
store: redisStore,
ttl: configurationService.get('CACHE_TTL'),
url: `redis://${redisPassword ? `:${redisPassword}` : ''}@${configurationService.get('REDIS_HOST')}:${configurationService.get('REDIS_PORT')}/${configurationService.get('REDIS_DB')}`
};
} as RedisClientOptions;
}
}),
ConfigurationModule

2
apps/api/src/app/subscription/subscription.controller.ts

@ -95,7 +95,7 @@ export class SubscriptionController {
@Res() response: Response
) {
const userId = await this.subscriptionService.createSubscriptionViaStripe(
<string>request.query.checkoutSessionId
request.query.checkoutSessionId as string
);
Logger.log(

13
apps/api/src/app/user/update-user-setting.dto.ts

@ -1,4 +1,3 @@
import { IsCurrencyCode } from '@ghostfolio/api/validators/is-currency-code';
import type {
ColorScheme,
DateRange,
@ -18,6 +17,8 @@ import {
} from 'class-validator';
import { eachYearOfInterval, format } from 'date-fns';
import { IsCurrencyCode } from '../../validators/is-currency-code';
export class UpdateUserSettingDto {
@IsNumber()
@IsOptional()
@ -31,11 +32,11 @@ export class UpdateUserSettingDto {
@IsOptional()
benchmark?: string;
@IsIn(<ColorScheme[]>['DARK', 'LIGHT'])
@IsIn(['DARK', 'LIGHT'] as ColorScheme[])
@IsOptional()
colorScheme?: ColorScheme;
@IsIn(<DateRange[]>[
@IsIn([
'1d',
'1y',
'5y',
@ -48,7 +49,7 @@ export class UpdateUserSettingDto {
return format(date, 'yyyy');
}
)
])
] as DateRange[])
@IsOptional()
dateRange?: DateRange;
@ -68,7 +69,7 @@ export class UpdateUserSettingDto {
@IsOptional()
'filters.tags'?: string[];
@IsIn(<HoldingsViewMode[]>['CHART', 'TABLE'])
@IsIn(['CHART', 'TABLE'] as HoldingsViewMode[])
@IsOptional()
holdingsViewMode?: HoldingsViewMode;
@ -100,7 +101,7 @@ export class UpdateUserSettingDto {
@IsOptional()
savingsRate?: number;
@IsIn(<ViewMode[]>['DEFAULT', 'ZEN'])
@IsIn(['DEFAULT', 'ZEN'] as ViewMode[])
@IsOptional()
viewMode?: ViewMode;

2
apps/api/src/app/user/user.controller.ts

@ -148,7 +148,7 @@ export class UserController {
const userSettings: UserSettings = merge(
{},
<UserSettings>this.request.user.Settings.settings,
this.request.user.Settings.settings as UserSettings,
data
);

39
apps/api/src/app/user/user.service.ts

@ -1,20 +1,3 @@
import { OrderService } from '@ghostfolio/api/app/order/order.service';
import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service';
import { environment } from '@ghostfolio/api/environments/environment';
import { PortfolioChangedEvent } from '@ghostfolio/api/events/portfolio-changed.event';
import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment';
import { AccountClusterRiskSingleAccount } from '@ghostfolio/api/models/rules/account-cluster-risk/single-account';
import { AllocationClusterRiskDevelopedMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/developed-markets';
import { AllocationClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/emerging-markets';
import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/base-currency-current-investment';
import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment';
import { EmergencyFundSetup } from '@ghostfolio/api/models/rules/emergency-fund/emergency-fund-setup';
import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment';
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service';
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
import { TagService } from '@ghostfolio/api/services/tag/tag.service';
import {
DEFAULT_CURRENCY,
DEFAULT_LANGUAGE_CODE,
@ -40,6 +23,24 @@ import { Prisma, Role, User } from '@prisma/client';
import { differenceInDays } from 'date-fns';
import { sortBy, without } from 'lodash';
import { environment } from '../../environments/environment';
import { PortfolioChangedEvent } from '../../events/portfolio-changed.event';
import { AccountClusterRiskCurrentInvestment } from '../../models/rules/account-cluster-risk/current-investment';
import { AccountClusterRiskSingleAccount } from '../../models/rules/account-cluster-risk/single-account';
import { AllocationClusterRiskDevelopedMarkets } from '../../models/rules/allocation-cluster-risk/developed-markets';
import { AllocationClusterRiskEmergingMarkets } from '../../models/rules/allocation-cluster-risk/emerging-markets';
import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '../../models/rules/currency-cluster-risk/base-currency-current-investment';
import { CurrencyClusterRiskCurrentInvestment } from '../../models/rules/currency-cluster-risk/current-investment';
import { EmergencyFundSetup } from '../../models/rules/emergency-fund/emergency-fund-setup';
import { FeeRatioInitialInvestment } from '../../models/rules/fees/fee-ratio-initial-investment';
import { ConfigurationService } from '../../services/configuration/configuration.service';
import { I18nService } from '../../services/i18n/i18n.service';
import { PrismaService } from '../../services/prisma/prisma.service';
import { PropertyService } from '../../services/property/property.service';
import { TagService } from '../../services/tag/tag.service';
import { OrderService } from '../order/order.service';
import { SubscriptionService } from '../subscription/subscription.service';
const crypto = require('crypto');
@Injectable()
@ -116,8 +117,8 @@ export class UserService {
accounts: Account,
dateOfFirstActivity: firstActivity?.date ?? new Date(),
settings: {
...(<UserSettings>Settings.settings),
locale: (<UserSettings>Settings.settings)?.locale ?? aLocale
...(Settings.settings as UserSettings),
locale: (Settings.settings as UserSettings)?.locale ?? aLocale
}
};
}

16
apps/api/src/services/api/api.service.ts

@ -34,28 +34,28 @@ export class ApiService {
const filters = [
...accountIds.map((accountId) => {
return <Filter>{
return {
id: accountId,
type: 'ACCOUNT'
};
} as Filter;
}),
...assetClasses.map((assetClass) => {
return <Filter>{
return {
id: assetClass,
type: 'ASSET_CLASS'
};
} as Filter;
}),
...assetSubClasses.map((assetClass) => {
return <Filter>{
return {
id: assetClass,
type: 'ASSET_SUB_CLASS'
};
} as Filter;
}),
...tagIds.map((tagId) => {
return <Filter>{
return {
id: tagId,
type: 'TAG'
};
} as Filter;
})
];

29
apps/api/src/services/market-data/market-data.service.ts

@ -1,7 +1,3 @@
import { UpdateMarketDataDto } from '@ghostfolio/api/app/admin/update-market-data.dto';
import { DateQuery } from '@ghostfolio/api/app/portfolio/interfaces/date-query.interface';
import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces';
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
import { resetHours } from '@ghostfolio/common/helper';
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
@ -13,6 +9,11 @@ import {
Prisma
} from '@prisma/client';
import { UpdateMarketDataDto } from '../../app/admin/update-market-data.dto';
import { DateQuery } from '../../app/portfolio/interfaces/date-query.interface';
import { IDataGatheringItem } from '../interfaces/interfaces';
import { PrismaService } from '../prisma/prisma.service';
@Injectable()
export class MarketDataService {
public constructor(private readonly prismaService: PrismaService) {}
@ -144,21 +145,21 @@ export class MarketDataService {
({ dataSource, date, marketPrice, symbol, state }) => {
return this.prismaService.marketData.upsert({
create: {
dataSource: <DataSource>dataSource,
date: <Date>date,
marketPrice: <number>marketPrice,
state: <MarketDataState>state,
symbol: <string>symbol
dataSource: dataSource as DataSource,
date: date as Date,
marketPrice: marketPrice as number,
state: state as MarketDataState,
symbol: symbol as string
},
update: {
marketPrice: <number>marketPrice,
state: <MarketDataState>state
marketPrice: marketPrice as number,
state: state as MarketDataState
},
where: {
dataSource_date_symbol: {
dataSource: <DataSource>dataSource,
date: <Date>date,
symbol: <string>symbol
dataSource: dataSource as DataSource,
date: date as Date,
symbol: symbol as string
}
}
});

8
apps/api/src/services/queues/data-gathering/data-gathering.processor.ts

@ -1,6 +1,3 @@
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';
import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces';
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service';
import {
DATA_GATHERING_QUEUE,
DEFAULT_PROCESSOR_GATHER_ASSET_PROFILE_CONCURRENCY,
@ -25,6 +22,9 @@ import {
parseISO
} from 'date-fns';
import { DataProviderService } from '../../data-provider/data-provider.service';
import { IDataGatheringItem } from '../../interfaces/interfaces';
import { MarketDataService } from '../../market-data/market-data.service';
import { DataGatheringService } from './data-gathering.service';
@Injectable()
@ -78,7 +78,7 @@ export class DataGatheringProcessor {
public async gatherHistoricalMarketData(job: Job<IDataGatheringItem>) {
try {
const { dataSource, date, symbol } = job.data;
let currentDate = parseISO(<string>(<unknown>date));
let currentDate = parseISO(date as unknown as string);
Logger.log(
`Historical market data gathering has been started for ${symbol} (${dataSource}) at ${format(

22
apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts

@ -1,12 +1,3 @@
import { AccountBalanceService } from '@ghostfolio/api/app/account-balance/account-balance.service';
import { OrderService } from '@ghostfolio/api/app/order/order.service';
import {
PerformanceCalculationType,
PortfolioCalculatorFactory
} from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator.factory';
import { PortfolioSnapshotValue } from '@ghostfolio/api/app/portfolio/interfaces/snapshot-value.interface';
import { RedisCacheService } from '@ghostfolio/api/app/redis-cache/redis-cache.service';
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
import {
CACHE_TTL_INFINITE,
DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_CONCURRENCY,
@ -19,6 +10,15 @@ import { Injectable, Logger } from '@nestjs/common';
import { Job } from 'bull';
import { addMilliseconds } from 'date-fns';
import { AccountBalanceService } from '../../../app/account-balance/account-balance.service';
import { OrderService } from '../../../app/order/order.service';
import {
PerformanceCalculationType,
PortfolioCalculatorFactory
} from '../../../app/portfolio/calculator/portfolio-calculator.factory';
import { PortfolioSnapshotValue } from '../../../app/portfolio/interfaces/snapshot-value.interface';
import { RedisCacheService } from '../../../app/redis-cache/redis-cache.service';
import { ConfigurationService } from '../../configuration/configuration.service';
import { IPortfolioSnapshotQueueJob } from './interfaces/portfolio-snapshot-queue-job.interface';
@Injectable()
@ -94,10 +94,10 @@ export class PortfolioSnapshotProcessor {
filters: job.data.filters,
userId: job.data.userId
}),
JSON.stringify(<PortfolioSnapshotValue>(<unknown>{
JSON.stringify({
expiration: expiration.getTime(),
portfolioSnapshot: snapshot
})),
} as unknown as PortfolioSnapshotValue),
CACHE_TTL_INFINITE
);

2
apps/api/src/services/symbol-profile/symbol-profile.service.ts

@ -176,7 +176,7 @@ export class SymbolProfileService {
countries: this.getCountries(
symbolProfile?.countries as unknown as Prisma.JsonArray
),
dateOfFirstActivity: <Date>undefined,
dateOfFirstActivity: undefined as Date,
holdings: this.getHoldings(symbolProfile),
scraperConfiguration: this.getScraperConfiguration(symbolProfile),
sectors: this.getSectors(symbolProfile),

4
apps/client/src/app/app.component.ts

@ -292,7 +292,7 @@ export class AppComponent implements OnDestroy, OnInit {
const dialogRef = this.dialog.open(GfHoldingDetailDialogComponent, {
autoFocus: false,
data: <HoldingDetailDialogParams>{
data: {
dataSource,
symbol,
baseCurrency: this.user?.settings?.baseCurrency,
@ -312,7 +312,7 @@ export class AppComponent implements OnDestroy, OnInit {
hasPermission(this.user?.permissions, permissions.updateOrder) &&
!this.user?.settings?.isRestrictedView,
locale: this.user?.settings?.locale
},
} as HoldingDetailDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

4
apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts

@ -178,14 +178,14 @@ export class AdminMarketDataDetailComponent implements OnChanges {
const marketPrice = this.marketDataByMonth[yearMonth]?.[day]?.marketPrice;
const dialogRef = this.dialog.open(MarketDataDetailDialog, {
data: <MarketDataDetailDialogParams>{
data: {
marketPrice,
currency: this.currency,
dataSource: this.dataSource,
dateString: `${yearMonth}-${day}`,
symbol: this.symbol,
user: this.user
},
} as MarketDataDetailDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

27
apps/client/src/app/components/admin-market-data/admin-market-data.component.ts

@ -1,6 +1,3 @@
import { AdminService } from '@ghostfolio/client/services/admin.service';
import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service';
import {
DEFAULT_PAGE_SIZE,
ghostfolioScraperApiSymbolPrefix
@ -37,6 +34,9 @@ import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject } from 'rxjs';
import { distinctUntilChanged, switchMap, takeUntil } from 'rxjs/operators';
import { AdminService } from '../../services/admin.service';
import { DataService } from '../../services/data.service';
import { UserService } from '../../services/user/user.service';
import { AdminMarketDataService } from './admin-market-data.service';
import { AssetProfileDialog } from './asset-profile-dialog/asset-profile-dialog.component';
import { AssetProfileDialogParams } from './asset-profile-dialog/interfaces/interfaces';
@ -71,36 +71,35 @@ export class AdminMarketDataComponent
return {
id: assetSubClass.toString(),
label: translate(assetSubClass),
type: <Filter['type']>'ASSET_SUB_CLASS'
type: 'ASSET_SUB_CLASS' as Filter['type']
};
})
.concat([
{
id: 'BENCHMARKS',
label: $localize`Benchmarks`,
type: <Filter['type']>'PRESET_ID'
type: 'PRESET_ID' as Filter['type']
},
{
id: 'CURRENCIES',
label: $localize`Currencies`,
type: <Filter['type']>'PRESET_ID'
type: 'PRESET_ID' as Filter['type']
},
{
id: 'ETF_WITHOUT_COUNTRIES',
label: $localize`ETFs without Countries`,
type: <Filter['type']>'PRESET_ID'
type: 'PRESET_ID' as Filter['type']
},
{
id: 'ETF_WITHOUT_SECTORS',
label: $localize`ETFs without Sectors`,
type: <Filter['type']>'PRESET_ID'
type: 'PRESET_ID' as Filter['type']
}
]);
public benchmarks: Partial<SymbolProfile>[];
public currentDataSource: DataSource;
public currentSymbol: string;
public dataSource: MatTableDataSource<AdminMarketDataItem> =
new MatTableDataSource();
public dataSource = new MatTableDataSource<AdminMarketDataItem>();
public defaultDateFormat: string;
public deviceType: string;
public displayedColumns: string[] = [];
@ -375,13 +374,13 @@ export class AdminMarketDataComponent
const dialogRef = this.dialog.open(AssetProfileDialog, {
autoFocus: false,
data: <AssetProfileDialogParams>{
data: {
dataSource,
symbol,
colorScheme: this.user?.settings.colorScheme,
deviceType: this.deviceType,
locale: this.user?.settings?.locale
},
} as AssetProfileDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});
@ -404,10 +403,10 @@ export class AdminMarketDataComponent
const dialogRef = this.dialog.open(CreateAssetProfileDialog, {
autoFocus: false,
data: <CreateAssetProfileDialogParams>{
data: {
deviceType: this.deviceType,
locale: this.user?.settings?.locale
},
} as CreateAssetProfileDialogParams,
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

4
apps/client/src/app/components/admin-overview/admin-overview.component.ts

@ -225,10 +225,10 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
$localize`Please set your system message:`,
JSON.stringify(
this.systemMessage ??
<SystemMessage>{
({
message: '⚒️ Scheduled maintenance in progress...',
targetGroups: ['Basic', 'Premium']
}
} as SystemMessage)
)
);

13
apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts

@ -98,7 +98,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy {
}
private initialize() {
const benchmarkDataValues: { [date: string]: number } = {};
const benchmarkDataValues: Record<string, number> = {};
for (const { date, value } of this.benchmarkDataItems) {
benchmarkDataValues[date] = value;
@ -133,9 +133,8 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy {
if (this.chartCanvas) {
if (this.chart) {
this.chart.data = data;
this.chart.options.plugins.tooltip = <unknown>(
this.getTooltipPluginConfiguration()
);
this.chart.options.plugins.tooltip =
this.getTooltipPluginConfiguration() as unknown;
this.chart.update();
} else {
this.chart = new Chart(this.chartCanvas.nativeElement, {
@ -154,7 +153,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy {
},
interaction: { intersect: false, mode: 'index' },
maintainAspectRatio: true,
plugins: <unknown>{
plugins: {
annotation: {
annotations: {
yAxis: {
@ -173,7 +172,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy {
verticalHoverLine: {
color: `rgba(${getTextColor(this.colorScheme)}, 0.1)`
}
},
} as unknown,
responsive: true,
scales: {
x: {
@ -238,7 +237,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy {
unit: '%'
}),
mode: 'index',
position: <unknown>'top',
position: 'top' as unknown,
xAlign: 'center',
yAlign: 'bottom'
};

2
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -148,7 +148,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public ngOnInit() {
this.activityForm = this.formBuilder.group({
tags: <string[]>[]
tags: [] as string[]
});
const filters: Filter[] = [

11
apps/client/src/app/components/investment-chart/investment-chart.component.ts

@ -154,9 +154,8 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
if (this.chartCanvas) {
if (this.chart) {
this.chart.data = chartData;
this.chart.options.plugins.tooltip = <unknown>(
this.getTooltipPluginConfiguration()
);
this.chart.options.plugins.tooltip =
this.getTooltipPluginConfiguration() as unknown;
if (
this.savingsRate &&
@ -186,7 +185,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
},
interaction: { intersect: false, mode: 'index' },
maintainAspectRatio: true,
plugins: <unknown>{
plugins: {
annotation: {
annotations: {
savingsRate: this.savingsRate
@ -227,7 +226,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
verticalHoverLine: {
color: `rgba(${getTextColor(this.colorScheme)}, 0.1)`
}
},
} as unknown,
responsive: true,
scales: {
x: {
@ -294,7 +293,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
unit: this.isInPercent ? '%' : undefined
}),
mode: 'index',
position: <unknown>'top',
position: 'top' as unknown,
xAlign: 'center',
yAlign: 'bottom'
};

4
apps/client/src/app/pages/accounts/accounts-page.component.ts

@ -222,7 +222,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
private openAccountDetailDialog(aAccountId: string) {
const dialogRef = this.dialog.open(AccountDetailDialog, {
autoFocus: false,
data: <AccountDetailDialogParams>{
data: {
accountId: aAccountId,
deviceType: this.deviceType,
hasImpersonationId: this.hasImpersonationId,
@ -230,7 +230,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
!this.hasImpersonationId &&
hasPermission(this.user?.permissions, permissions.createOrder) &&
!this.user?.settings?.isRestrictedView
},
} as AccountDetailDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

8
apps/client/src/app/pages/portfolio/activities/activities-page.component.ts

@ -218,10 +218,10 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
public onImport() {
const dialogRef = this.dialog.open(ImportActivitiesDialog, {
data: <ImportActivitiesDialogParams>{
data: {
deviceType: this.deviceType,
user: this.user
},
} as ImportActivitiesDialogParams,
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});
@ -235,11 +235,11 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
public onImportDividends() {
const dialogRef = this.dialog.open(ImportActivitiesDialog, {
data: <ImportActivitiesDialogParams>{
data: {
activityTypes: ['DIVIDEND'],
deviceType: this.deviceType,
user: this.user
},
} as ImportActivitiesDialogParams,
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

4
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

@ -505,7 +505,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
private openAccountDetailDialog(aAccountId: string) {
const dialogRef = this.dialog.open(AccountDetailDialog, {
autoFocus: false,
data: <AccountDetailDialogParams>{
data: {
accountId: aAccountId,
deviceType: this.deviceType,
hasImpersonationId: this.hasImpersonationId,
@ -513,7 +513,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
!this.hasImpersonationId &&
hasPermission(this.user?.permissions, permissions.createOrder) &&
!this.user?.settings?.isRestrictedView
},
} as AccountDetailDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

20
apps/client/src/app/services/data.service.ts

@ -230,8 +230,8 @@ export class DataService {
public fetchActivity(aActivityId: string) {
return this.http.get<Activity>(`/api/v1/order/${aActivityId}`).pipe(
map((activity) => {
activity.createdAt = parseISO(<string>(<unknown>activity.createdAt));
activity.date = parseISO(<string>(<unknown>activity.date));
activity.createdAt = parseISO(activity.createdAt as unknown as string);
activity.date = parseISO(activity.date as unknown as string);
return activity;
})
@ -387,8 +387,8 @@ export class DataService {
map((data) => {
if (data.orders) {
for (const order of data.orders) {
order.createdAt = parseISO(<string>(<unknown>order.createdAt));
order.date = parseISO(<string>(<unknown>order.date));
order.createdAt = parseISO(order.createdAt as unknown as string);
order.date = parseISO(order.date as unknown as string);
}
}
@ -399,9 +399,9 @@ export class DataService {
public fetchInfo(): InfoItem {
const info = cloneDeep((window as any).info);
const utmSource = <'ios' | 'trusted-web-activity'>(
window.localStorage.getItem('utm_source')
);
const utmSource = window.localStorage.getItem('utm_source') as
| 'ios'
| 'trusted-web-activity';
info.globalPermissions = filterGlobalPermissions(
info.globalPermissions,
@ -715,9 +715,9 @@ export class DataService {
public updateInfo() {
this.http.get<InfoItem>('/api/v1/info').subscribe((info) => {
const utmSource = <'ios' | 'trusted-web-activity'>(
window.localStorage.getItem('utm_source')
);
const utmSource = window.localStorage.getItem('utm_source') as
| 'ios'
| 'trusted-web-activity';
info.globalPermissions = filterGlobalPermissions(
info.globalPermissions,

4
apps/client/src/app/services/user/user.service.ts

@ -104,9 +104,9 @@ export class UserService extends ObservableStore<UserStoreState> {
) {
const dialogRef = this.dialog.open(SubscriptionInterstitialDialog, {
autoFocus: false,
data: <SubscriptionInterstitialDialogParams>{
data: {
user
},
} as SubscriptionInterstitialDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

6
apps/client/src/main.ts

@ -12,9 +12,9 @@ import { environment } from './environments/environment';
(async () => {
const response = await fetch('/api/v1/info');
const info: InfoItem = await response.json();
const utmSource = <'ios' | 'trusted-web-activity'>(
window.localStorage.getItem('utm_source')
);
const utmSource = window.localStorage.getItem('utm_source') as
| 'ios'
| 'trusted-web-activity';
info.globalPermissions = filterGlobalPermissions(
info.globalPermissions,

4
libs/common/src/lib/config.ts

@ -125,14 +125,14 @@ export const PROPERTY_SLACK_COMMUNITY_USERS = 'SLACK_COMMUNITY_USERS';
export const PROPERTY_STRIPE_CONFIG = 'STRIPE_CONFIG';
export const PROPERTY_SYSTEM_MESSAGE = 'SYSTEM_MESSAGE';
export const QUEUE_JOB_STATUS_LIST = <JobStatus[]>[
export const QUEUE_JOB_STATUS_LIST = [
'active',
'completed',
'delayed',
'failed',
'paused',
'waiting'
];
] as JobStatus[];
export const REPLACE_NAME_PARTS = [
'Amundi Index Solutions -',

2
libs/common/src/lib/helper.ts

@ -108,7 +108,7 @@ export function downloadAsFile({
content = JSON.stringify(content, undefined, ' ');
}
const file = new Blob([<string>content], {
const file = new Blob([content as string], {
type: contentType
});
a.href = URL.createObjectURL(file);

2
libs/ui/src/lib/activities-filter/activities-filter.component.ts

@ -157,7 +157,7 @@ export class GfActivitiesFilterComponent implements OnChanges, OnDestroy {
for (const type of Object.keys(filterGroupsMap)) {
filterGroups.push({
name: <Filter['type']>translate(type),
name: translate(type) as Filter['type'],
filters: filterGroupsMap[type]
});
}

4
libs/ui/src/lib/assistant/assistant.component.ts

@ -180,10 +180,10 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
debounceTime(300),
distinctUntilChanged(),
mergeMap(async (searchTerm) => {
const result = <ISearchResults>{
const result = {
assetProfiles: [],
holdings: []
};
} as ISearchResults;
try {
if (searchTerm) {

4
libs/ui/src/lib/benchmark/benchmark.component.ts

@ -109,13 +109,13 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy {
symbol
}: AssetProfileIdentifier) {
const dialogRef = this.dialog.open(GfBenchmarkDetailDialogComponent, {
data: <BenchmarkDetailDialogParams>{
data: {
dataSource,
symbol,
colorScheme: this.user?.settings?.colorScheme,
deviceType: this.deviceType,
locale: this.locale
},
} as BenchmarkDetailDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : undefined,
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
});

19
libs/ui/src/lib/line-chart/line-chart.component.ts

@ -172,15 +172,14 @@ export class GfLineChartComponent
if (this.chartCanvas) {
if (this.chart) {
this.chart.data = data;
this.chart.options.plugins.tooltip = <unknown>(
this.getTooltipPluginConfiguration()
);
this.chart.options.plugins.tooltip =
this.getTooltipPluginConfiguration() as unknown;
this.chart.options.animation =
this.isAnimated &&
<unknown>{
({
x: this.getAnimationConfigurationForAxis({ labels, axis: 'x' }),
y: this.getAnimationConfigurationForAxis({ labels, axis: 'y' })
};
} as unknown);
this.chart.update();
} else {
this.chart = new Chart(this.chartCanvas.nativeElement, {
@ -188,10 +187,10 @@ export class GfLineChartComponent
options: {
animation:
this.isAnimated &&
<unknown>{
({
x: this.getAnimationConfigurationForAxis({ labels, axis: 'x' }),
y: this.getAnimationConfigurationForAxis({ labels, axis: 'y' })
},
} as unknown),
aspectRatio: 16 / 9,
elements: {
point: {
@ -200,7 +199,7 @@ export class GfLineChartComponent
}
},
interaction: { intersect: false, mode: 'index' },
plugins: <unknown>{
plugins: {
legend: {
align: 'start',
display: this.showLegend,
@ -210,7 +209,7 @@ export class GfLineChartComponent
verticalHoverLine: {
color: `rgba(${getTextColor(this.colorScheme)}, 0.1)`
}
},
} as unknown,
scales: {
x: {
border: {
@ -325,7 +324,7 @@ export class GfLineChartComponent
unit: this.unit
}),
mode: 'index',
position: <unknown>'top',
position: 'top' as unknown,
xAlign: 'center',
yAlign: 'bottom'
};

16
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -304,14 +304,14 @@ export class GfPortfolioProportionChartComponent
if (this.chartCanvas) {
if (this.chart) {
this.chart.data = data;
this.chart.options.plugins.tooltip = <unknown>(
this.getTooltipPluginConfiguration(data)
);
this.chart.options.plugins.tooltip = this.getTooltipPluginConfiguration(
data
) as unknown;
this.chart.update();
} else {
this.chart = new Chart(this.chartCanvas.nativeElement, {
data,
options: <unknown>{
options: {
animation: false,
cutout: '70%',
layout: {
@ -358,7 +358,7 @@ export class GfPortfolioProportionChartComponent
legend: { display: false },
tooltip: this.getTooltipPluginConfiguration(data)
}
},
} as unknown,
plugins: [ChartDataLabels],
type: 'doughnut'
});
@ -405,7 +405,7 @@ export class GfPortfolioProportionChartComponent
symbol = $localize`No data available`;
}
const name = translate(this.positions[<string>symbol]?.name);
const name = translate(this.positions[symbol as string]?.name);
let sum = 0;
for (const item of context.dataset.data) {
@ -414,12 +414,12 @@ export class GfPortfolioProportionChartComponent
const percentage = (context.parsed * 100) / sum;
if (<number>context.raw === Number.MAX_SAFE_INTEGER) {
if ((context.raw as number) === Number.MAX_SAFE_INTEGER) {
return $localize`No data available`;
} else if (this.isInPercent) {
return [`${name ?? symbol}`, `${percentage.toFixed(2)}%`];
} else {
const value = <number>context.raw;
const value = context.raw as number;
return [
`${name ?? symbol}`,
`${value.toLocaleString(this.locale, {

4
libs/ui/src/lib/value/value.component.ts

@ -48,7 +48,7 @@ export class GfValueComponent implements OnChanges {
if (isNumber(this.value)) {
this.isNumber = true;
this.isString = false;
this.absoluteValue = Math.abs(<number>this.value);
this.absoluteValue = Math.abs(this.value as number);
if (this.colorizeSign) {
if (this.isCurrency) {
@ -113,7 +113,7 @@ export class GfValueComponent implements OnChanges {
this.isString = true;
if (this.isDate) {
this.formattedValue = new Date(<string>this.value).toLocaleDateString(
this.formattedValue = new Date(this.value).toLocaleDateString(
this.locale,
{
day: '2-digit',

Loading…
Cancel
Save