From e01d1f81b03f3510fa7bd4a5bb32fed78aff99e5 Mon Sep 17 00:00:00 2001 From: "alekseev.t" Date: Thu, 8 Jan 2026 22:11:02 +0500 Subject: [PATCH 1/2] add cli --- mocks/test.tsv | 2 + package-lock.json | 76 +++++++++++++++------- package.json | 7 +- src/cli/cli-application.ts | 40 ++++++++++++ src/cli/command-parser.ts | 19 ++++++ src/cli/commands/command.interface.ts | 4 ++ src/cli/commands/help.command.ts | 25 +++++++ src/cli/commands/import.command.ts | 23 +++++++ src/cli/commands/version.command.ts | 46 +++++++++++++ src/cli/index.ts | 5 ++ src/main.cli.ts | 15 +++++ src/shared/lib/file-reader.interface.ts | 3 + src/shared/lib/tsv-file-reader.ts | 46 +++++++++++++ src/shared/types/coordinates.type.ts | 4 ++ src/shared/types/facility.enum.ts | 9 +++ src/shared/types/housing-type.enum.ts | 6 ++ src/shared/types/rental-offer.interface.ts | 23 +++++++ 17 files changed, 326 insertions(+), 27 deletions(-) create mode 100644 mocks/test.tsv create mode 100644 src/cli/cli-application.ts create mode 100644 src/cli/command-parser.ts create mode 100644 src/cli/commands/command.interface.ts create mode 100644 src/cli/commands/help.command.ts create mode 100644 src/cli/commands/import.command.ts create mode 100644 src/cli/commands/version.command.ts create mode 100644 src/cli/index.ts create mode 100644 src/main.cli.ts create mode 100644 src/shared/lib/file-reader.interface.ts create mode 100644 src/shared/lib/tsv-file-reader.ts create mode 100644 src/shared/types/coordinates.type.ts create mode 100644 src/shared/types/facility.enum.ts create mode 100644 src/shared/types/housing-type.enum.ts create mode 100644 src/shared/types/rental-offer.interface.ts diff --git a/mocks/test.tsv b/mocks/test.tsv new file mode 100644 index 0000000..fe4fe61 --- /dev/null +++ b/mocks/test.tsv @@ -0,0 +1,2 @@ +Тестовое объявление об аренде Комнатка в Париже 2022-01-10T19:00:00.000Z Paris preview.jpg photo1;photo2;photo3 false true 4.6 house 1 2 100 Breakfast;Baby seat https://user 50 48.85661 2.351499 +Тестовое объявление об аренде2 Комнатка в Кёльне 2022-04-10T19:00:00.000Z Cologne preview.jpg photo1;photo2;photo3 true false 4.6 room 1 2 100 Breakfast;Baby seat https://user 33 50.938361 6.959974 diff --git a/package-lock.json b/package-lock.json index cf63002..cd13cbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,9 @@ "": { "name": "six-cities", "version": "5.0.0", + "dependencies": { + "chalk": "5.6.2" + }, "devDependencies": { "@types/node": "18.17.17", "@typescript-eslint/eslint-plugin": "6.7.0", @@ -14,11 +17,11 @@ "eslint": "8.49.0", "eslint-config-htmlacademy": "9.1.1", "rimraf": "5.0.1", - "ts-node": "10.9.1", + "ts-node": "10.9.2", "typescript": "5.2.2" }, "engines": { - "node": "^18.0.0", + "node": ">20.19", "npm": ">=8" } }, @@ -818,16 +821,12 @@ } }, "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "license": "MIT", "engines": { - "node": ">=10" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { "url": "https://github.com/chalk/chalk?sponsor=1" @@ -1398,6 +1397,23 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -1852,6 +1868,7 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3389,6 +3406,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3439,10 +3457,11 @@ } }, "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, + "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -4312,14 +4331,9 @@ "dev": true }, "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==" }, "ci-info": { "version": "3.8.0", @@ -4574,6 +4588,18 @@ "optionator": "^0.9.3", "strip-ansi": "^6.0.1", "text-table": "^0.2.0" + }, + "dependencies": { + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + } } }, "eslint-config-htmlacademy": { @@ -6204,9 +6230,9 @@ "requires": {} }, "ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", diff --git a/package.json b/package.json index 9909045..d2a57e2 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,9 @@ "clean": "rimraf dist", "ts": "ts-node" }, + "dependencies": { + "chalk": "5.6.2" + }, "devDependencies": { "@types/node": "18.17.17", "@typescript-eslint/eslint-plugin": "6.7.0", @@ -23,12 +26,12 @@ "eslint": "8.49.0", "eslint-config-htmlacademy": "9.1.1", "rimraf": "5.0.1", - "ts-node": "10.9.1", + "ts-node": "10.9.2", "typescript": "5.2.2" }, "type": "module", "engines": { - "node": "^18.0.0", + "node": ">20.19", "npm": ">=8" } } diff --git a/src/cli/cli-application.ts b/src/cli/cli-application.ts new file mode 100644 index 0000000..bdc09cc --- /dev/null +++ b/src/cli/cli-application.ts @@ -0,0 +1,40 @@ +import { Command } from './commands/command.interface.js'; +import { CommandParser } from './command-parser.js'; + +type CommandCollection = Record; + +export class CLIApplication { + private commands: CommandCollection = {}; + + constructor( + private readonly defaultCommand: string = '--help' + ) {} + + public registerCommands(commandList: Command[]): void { + commandList.forEach((command) => { + if (Object.hasOwn(this.commands, command.getName())) { + throw new Error(`Command ${command.getName()} is already registered`); + } + this.commands[command.getName()] = command; + }); + } + + public getCommand(commandName: string): Command { + return this.commands[commandName] ?? this.getDefaultCommand(); + } + + public getDefaultCommand(): Command | never { + if (! this.commands[this.defaultCommand]) { + throw new Error(`The default command (${this.defaultCommand}) is not registered.`); + } + return this.commands[this.defaultCommand]; + } + + public processCommand(argv: string[]): void { + const parsedCommand = CommandParser.parse(argv); + const [commandName] = Object.keys(parsedCommand); + const command = this.getCommand(commandName); + const commandArguments = parsedCommand[commandName] ?? []; + command.execute(...commandArguments); + } +} diff --git a/src/cli/command-parser.ts b/src/cli/command-parser.ts new file mode 100644 index 0000000..e4da774 --- /dev/null +++ b/src/cli/command-parser.ts @@ -0,0 +1,19 @@ +type ParsedCommand = Record + +export class CommandParser { + static parse(cliArguments: string[]): ParsedCommand { + const parsedCommand: ParsedCommand = {}; + let currentCommand = ''; + + for (const argument of cliArguments) { + if (argument.startsWith('--')) { + parsedCommand[argument] = []; + currentCommand = argument; + } else if (currentCommand && argument) { + parsedCommand[currentCommand].push(argument); + } + } + + return parsedCommand; + } +} diff --git a/src/cli/commands/command.interface.ts b/src/cli/commands/command.interface.ts new file mode 100644 index 0000000..a724f03 --- /dev/null +++ b/src/cli/commands/command.interface.ts @@ -0,0 +1,4 @@ +export interface Command { + getName(): string; + execute(...params: string[]): void; +} diff --git a/src/cli/commands/help.command.ts b/src/cli/commands/help.command.ts new file mode 100644 index 0000000..52ed55f --- /dev/null +++ b/src/cli/commands/help.command.ts @@ -0,0 +1,25 @@ +import { Command } from './command.interface.js'; +import chalk from 'chalk'; + +export class HelpCommand implements Command { + execute(..._params: string[]): void { + console.info(chalk.bgBlackBright( + ` + Программа для подготовки данных для REST API сервера. + Пример: + cli.js -- [--arguments] + Команды: + --version: # выводит номер версии + --help: # печатает этот текст + --import : # импортирует данные из TSV + --generate # генерирует произвольное количество тестовых данных + ` + )); + + } + + getName(): string { + return '--help'; + } + +} diff --git a/src/cli/commands/import.command.ts b/src/cli/commands/import.command.ts new file mode 100644 index 0000000..f5ba822 --- /dev/null +++ b/src/cli/commands/import.command.ts @@ -0,0 +1,23 @@ +import { Command } from './command.interface.js'; +import { TsvFileReader } from '../../shared/lib/tsv-file-reader.js'; + +export class ImportCommand implements Command { + execute(...params: string[]): void { + const [filename] = params; + const fileReader = new TsvFileReader(filename); + try { + fileReader.read(); + console.log(fileReader.toArray()); + } catch (error) { + if (!(error instanceof Error)) { + throw error; + } + console.error(`Details ${error.message}`); + } + } + + getName(): string { + return '--import'; + } + +} diff --git a/src/cli/commands/version.command.ts b/src/cli/commands/version.command.ts new file mode 100644 index 0000000..5adc63a --- /dev/null +++ b/src/cli/commands/version.command.ts @@ -0,0 +1,46 @@ +import { resolve } from 'node:path'; +import { Command } from './command.interface.js'; +import { readFileSync } from 'node:fs'; +import chalk from 'chalk'; + +interface PackageJsonData { + version: string +} + + +function isPackageJson(value: unknown): value is PackageJsonData { + return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.hasOwn(value, 'version'); +} + + +export class VersionCommand implements Command { + constructor(private readonly filepath: string = './package.json') { + } + + private readVersion(): string { + const json = readFileSync(resolve(this.filepath), 'utf-8'); + const parsedData: unknown = JSON.parse(json); + + if (!isPackageJson(parsedData)) { + throw new Error('Invalid package.json'); + } + + return parsedData.version; + } + + execute(..._params: string[]): void { + try { + const ver = this.readVersion(); + console.log(chalk.green(ver)); + } catch (e) { + console.error(`Failed to read version from ${this.filepath}`); + if (e instanceof Error) { + console.error(chalk.bgRed(e.message)); + } + } + } + + getName(): string { + return '--version'; + } +} diff --git a/src/cli/index.ts b/src/cli/index.ts new file mode 100644 index 0000000..f28f95f --- /dev/null +++ b/src/cli/index.ts @@ -0,0 +1,5 @@ +export * from './cli-application.js'; +export * from './command-parser.js'; +export * from './commands/help.command.js'; +export * from './commands/version.command.js'; +export * from './commands/import.command.js'; diff --git a/src/main.cli.ts b/src/main.cli.ts new file mode 100644 index 0000000..a737264 --- /dev/null +++ b/src/main.cli.ts @@ -0,0 +1,15 @@ +#!/usr/bin/env node +import { CLIApplication, HelpCommand, ImportCommand, VersionCommand } from './cli/index.js'; + +function bootstrap() { + const cliApplication = new CLIApplication(); + cliApplication.registerCommands([ + new HelpCommand(), + new VersionCommand(), + new ImportCommand(), + ]); + + cliApplication.processCommand(process.argv); +} + +bootstrap(); diff --git a/src/shared/lib/file-reader.interface.ts b/src/shared/lib/file-reader.interface.ts new file mode 100644 index 0000000..e8c9e00 --- /dev/null +++ b/src/shared/lib/file-reader.interface.ts @@ -0,0 +1,3 @@ +export interface FileReader { + read(): void +} diff --git a/src/shared/lib/tsv-file-reader.ts b/src/shared/lib/tsv-file-reader.ts new file mode 100644 index 0000000..caa335f --- /dev/null +++ b/src/shared/lib/tsv-file-reader.ts @@ -0,0 +1,46 @@ +import { FileReader } from './file-reader.interface.js'; +import { readFileSync } from 'node:fs'; +import { RentalOffer } from '../types/rental-offer.interface.js'; +import { HousingType } from '../types/housing-type.enum.js'; +import { Facility } from '../types/facility.enum.js'; + +export class TsvFileReader implements FileReader { + private rawData = ''; + + constructor(private readonly filename: string) { + } + + read(): void { + this.rawData = readFileSync(this.filename, {encoding: 'utf8'}); + } + + public toArray(): RentalOffer[] { + if (!this.rawData) { + throw new Error('No data to read'); + } + return this.rawData.split('\n').filter((row) => row.trim().length > 0) + .map((line) => line.split('\t')) + .map(([title, description, postDate, city, preview, photos, isPremium, isFavorite, rating, housingType, roomCount, guestCount, cost, facilities, author, commentCounts, latitude, longitude]) => ({ + title, + description, + postDate: new Date(postDate), + city, + preview, + photos: photos.split(';'), + isPremium: Boolean(isPremium), + isFavorite: Boolean(isFavorite), + rating: Number.parseFloat(rating), + housingType: housingType as HousingType, + roomCount: Number.parseInt(roomCount, 10), + guestCount: Number.parseInt(guestCount, 10), + cost: Number.parseInt(cost, 10), + facilities: facilities.split(';') as Facility[], + author, + commentCounts: commentCounts ? Number.parseInt(commentCounts, 10) : 0, + coordinates: { + longitude, + latitude + } + })); + } +} diff --git a/src/shared/types/coordinates.type.ts b/src/shared/types/coordinates.type.ts new file mode 100644 index 0000000..6701c22 --- /dev/null +++ b/src/shared/types/coordinates.type.ts @@ -0,0 +1,4 @@ +export type Coordinates = { + latitude: string; + longitude: string +} diff --git a/src/shared/types/facility.enum.ts b/src/shared/types/facility.enum.ts new file mode 100644 index 0000000..e743e58 --- /dev/null +++ b/src/shared/types/facility.enum.ts @@ -0,0 +1,9 @@ +export enum Facility { + Breakfast = 'Breakfast', + AirConditioning = 'Air conditioning', + LaptopFriendlyWorkspace = 'Laptop friendly workspace', + BabySeat = 'Baby seat', + Washer = 'Washer', + Towels = 'Towels', + Fridge = 'Fridge', +} diff --git a/src/shared/types/housing-type.enum.ts b/src/shared/types/housing-type.enum.ts new file mode 100644 index 0000000..f01d666 --- /dev/null +++ b/src/shared/types/housing-type.enum.ts @@ -0,0 +1,6 @@ +export enum HousingType { + Apartment= 'apartment', + House = 'house', + Room = 'room', + Hotel = 'hotel' +} diff --git a/src/shared/types/rental-offer.interface.ts b/src/shared/types/rental-offer.interface.ts new file mode 100644 index 0000000..c2d21a2 --- /dev/null +++ b/src/shared/types/rental-offer.interface.ts @@ -0,0 +1,23 @@ +import { HousingType } from './housing-type.enum.js'; +import { Facility } from './facility.enum.js'; +import { Coordinates } from './coordinates.type.js'; + +export interface RentalOffer { + title: string; + description: string; + postDate: Date; + city: string; + preview: string; + photos: string[]; + isPremium: boolean; + isFavorite: boolean; + rating: number; + housingType: HousingType; + roomCount: number; + guestCount: number; + cost: number; + facilities: Facility[]; + author: string; + commentCounts?: number; + coordinates: Coordinates; +} From b8cfdbbc5efc39a0ec66d6964c83c4848a84e28d Mon Sep 17 00:00:00 2001 From: "alekseev.t" Date: Fri, 9 Jan 2026 10:59:16 +0500 Subject: [PATCH 2/2] review --- package.json | 1 + src/cli/cli-application.ts | 2 +- src/cli/commands/help.command.ts | 2 +- src/cli/commands/import.command.ts | 2 +- src/cli/commands/version.command.ts | 13 ++++++------- src/shared/lib/tsv-file-reader.ts | 4 ++-- src/shared/types/rental-offer.interface.ts | 6 +++--- tsconfig.json | 1 + 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index d2a57e2..61dd6ba 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "start": "npm run build && node ./dist/main.js", "build": "npm run clean && npm run compile", "lint": "eslint src/ --ext .ts", + "lint:fix": "eslint src/ --ext .ts --fix", "compile": "tsc -p tsconfig.json", "clean": "rimraf dist", "ts": "ts-node" diff --git a/src/cli/cli-application.ts b/src/cli/cli-application.ts index bdc09cc..3f0afe5 100644 --- a/src/cli/cli-application.ts +++ b/src/cli/cli-application.ts @@ -1,4 +1,4 @@ -import { Command } from './commands/command.interface.js'; +import type { Command } from './commands/command.interface.js'; import { CommandParser } from './command-parser.js'; type CommandCollection = Record; diff --git a/src/cli/commands/help.command.ts b/src/cli/commands/help.command.ts index 52ed55f..e31f1b7 100644 --- a/src/cli/commands/help.command.ts +++ b/src/cli/commands/help.command.ts @@ -1,4 +1,4 @@ -import { Command } from './command.interface.js'; +import type { Command } from './command.interface.js'; import chalk from 'chalk'; export class HelpCommand implements Command { diff --git a/src/cli/commands/import.command.ts b/src/cli/commands/import.command.ts index f5ba822..ee40b93 100644 --- a/src/cli/commands/import.command.ts +++ b/src/cli/commands/import.command.ts @@ -1,4 +1,4 @@ -import { Command } from './command.interface.js'; +import type { Command } from './command.interface.js'; import { TsvFileReader } from '../../shared/lib/tsv-file-reader.js'; export class ImportCommand implements Command { diff --git a/src/cli/commands/version.command.ts b/src/cli/commands/version.command.ts index 5adc63a..7bbea0e 100644 --- a/src/cli/commands/version.command.ts +++ b/src/cli/commands/version.command.ts @@ -1,5 +1,5 @@ import { resolve } from 'node:path'; -import { Command } from './command.interface.js'; +import type { Command } from './command.interface.js'; import { readFileSync } from 'node:fs'; import chalk from 'chalk'; @@ -8,11 +8,6 @@ interface PackageJsonData { } -function isPackageJson(value: unknown): value is PackageJsonData { - return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.hasOwn(value, 'version'); -} - - export class VersionCommand implements Command { constructor(private readonly filepath: string = './package.json') { } @@ -21,13 +16,17 @@ export class VersionCommand implements Command { const json = readFileSync(resolve(this.filepath), 'utf-8'); const parsedData: unknown = JSON.parse(json); - if (!isPackageJson(parsedData)) { + if (!this.isPackageJson(parsedData)) { throw new Error('Invalid package.json'); } return parsedData.version; } + private isPackageJson(value: unknown): value is PackageJsonData { + return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.hasOwn(value, 'version'); + } + execute(..._params: string[]): void { try { const ver = this.readVersion(); diff --git a/src/shared/lib/tsv-file-reader.ts b/src/shared/lib/tsv-file-reader.ts index caa335f..5e9823a 100644 --- a/src/shared/lib/tsv-file-reader.ts +++ b/src/shared/lib/tsv-file-reader.ts @@ -1,6 +1,6 @@ -import { FileReader } from './file-reader.interface.js'; +import type { FileReader } from './file-reader.interface.js'; import { readFileSync } from 'node:fs'; -import { RentalOffer } from '../types/rental-offer.interface.js'; +import type { RentalOffer } from '../types/rental-offer.interface.js'; import { HousingType } from '../types/housing-type.enum.js'; import { Facility } from '../types/facility.enum.js'; diff --git a/src/shared/types/rental-offer.interface.ts b/src/shared/types/rental-offer.interface.ts index c2d21a2..fc65e64 100644 --- a/src/shared/types/rental-offer.interface.ts +++ b/src/shared/types/rental-offer.interface.ts @@ -1,6 +1,6 @@ -import { HousingType } from './housing-type.enum.js'; -import { Facility } from './facility.enum.js'; -import { Coordinates } from './coordinates.type.js'; +import type { HousingType } from './housing-type.enum.js'; +import type { Facility } from './facility.enum.js'; +import type { Coordinates } from './coordinates.type.js'; export interface RentalOffer { title: string; diff --git a/tsconfig.json b/tsconfig.json index 58f04b3..3ce123f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,7 @@ "importHelpers": true, "skipLibCheck": true, "esModuleInterop": true, + "verbatimModuleSyntax": true, "allowSyntheticDefaultImports": true, "experimentalDecorators": true, "sourceMap": true,