-
typescript:
Почему стоит перейти на typescript
- Статическая типизация:
- отлов багов до компиляции, позволяет избежать глупых ошибок
- Статическая типизация:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { TokenAccountType } from '@common/model/accounts/token-account-type'; | |
| import { TokenType } from '@common/model/blockchain/tokenType'; | |
| import { CollaboratorRole } from '@common/model/collaborator/collaboratorRole'; | |
| import { faker } from '@faker-js/faker'; | |
| import { RoyaltyCalculatorParamsDto } from '../../../../src/area/accounts/dto/royalty-calculator-params.dto'; | |
| import { | |
| RoyaltyCalculatorCollaborator, | |
| RoyaltyCalculatorNftCampaignSettings, | |
| TokenAccountHistoryLastRecord | |
| } from '../../../../src/area/accounts/interfaces/royalty-calculator'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| CustomDictionaryItemServiceGetAllApiArg, | |
| CustomDictionaryServiceGetAllApiArg, | |
| CustomFieldDefinitionServiceGetAllApiResponse, | |
| DataSourceServiceGetAllApiResponse, | |
| generatedApi, | |
| RsmTierServiceGetAllApiResponse, | |
| TagServiceGetAllApiArg, | |
| } from './generatedApi'; | |
| import { ApiTags } from '../tags'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FC, useEffect } from 'react'; | |
| import { View } from './view'; | |
| import { useDispatch } from 'react-redux'; | |
| // import { profileAvatarSelector } from 'redux/selectors'; | |
| // import { getProfileAvatar, updateProfileAvatar } from 'redux/actions'; | |
| import { AppDispatch } from 'redux/store'; | |
| import { usersApi } from 'api/users/usersApi'; | |
| const userId = '610635d0-d5af-422a-a1c2-f88a35495b65'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module, ValidationPipe } from '@nestjs/common'; | |
| import { ConfigModule } from '../../config/config.module'; | |
| import { AvatarModule } from './avatar/avatar.module'; | |
| import { UsersController } from './controllers/users.controller'; | |
| import { UserController } from './user.controller'; | |
| import { UserService } from './user.service'; | |
| import { TypeOrmModule } from '@nestjs/typeorm'; | |
| import { User } from './models/user.entity'; | |
| import { APP_PIPE } from '@nestjs/core'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { HttpStatus } from '@nestjs/common'; | |
| import { ConfigModule } from '@nestjs/config'; | |
| import { | |
| FastifyAdapter, | |
| NestFastifyApplication | |
| } from '@nestjs/platform-fastify'; | |
| import { Test } from '@nestjs/testing'; | |
| import { AppModule } from '../../../src/app.module'; | |
| describe('User Profile Get', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sourceData: { | |
| id: string; | |
| addressId: number; | |
| isCrashedMeter: boolean; | |
| meterSerialNum: string; | |
| meterModelId: number; | |
| }[] = await em.query(` | |
| SELECT | |
| m.id as id, | |
| address_id as addressId, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export enum Routes { | |
| empty = '/', | |
| login = '/login', | |
| authError = '/auth-error', | |
| profile = '/profile', | |
| meters = '/meters', | |
| meterConfigurationHistory = '/meters/:meterId/meter-configuration-history', | |
| meter = '/meters/:meterId/', | |
| monitoring = '/monitoring', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useEffect, useMemo, useState } from 'react'; | |
| import classnames from 'classnames'; | |
| import { useGetDetailJudging } from '../../../hooks'; | |
| import { MainFieldsDetailJudging } from './MainFieldsDetailJudging'; | |
| import { Icon } from 'uiKit/Icon'; | |
| import { Button } from 'uiKit/Button'; |
-
Структура проекта:
На наш взгляд существующая структура имеет место быть, однако можно было бы перекомпоновать код, например создать папку shared, и туда сложить components, hooks, localization, queryClient, utils, userStorage.
В нашей компании мы используем подобную структуру:
-
content - страницы проекта
NewerOlder

