Skip to content

Conversation

@Critonik
Copy link

@Critonik Critonik commented Jan 8, 2026

@keksobot keksobot changed the title add cli Приложение для терминала Jan 8, 2026
}


function isPackageJson(value: unknown): value is PackageJsonData {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему эта функция вне класса ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

занес в приватное поле

@@ -0,0 +1,46 @@
import { FileReader } from './file-reader.interface.js';
import { readFileSync } from 'node:fs';
import { RentalOffer } from '../types/rental-offer.interface.js';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Полезно знать, такие штуки которые импортируются только в качестве типа лучше импортировать через import type чтобы в JS файле не были лишнего импорта это может помочь предотвратить лишние циклические зависимости

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbatimModuleSyntax по дефолту не включен

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

включил и поправил

}

private readVersion(): string {
const json = readFileSync(resolve(this.filepath), 'utf-8');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже полезно знать, что функции файловой системы которые *Sync блокируют выполнение потока, то есть использовать их нужно аккуратно и тогда когда ты действительно понимаешь что это не затормозит какие то паралельные процессы.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, спасибо, тут по примеру из лекции просто синхронную функцию вызвал

@keksobot keksobot merged commit 7797df0 into htmlacademy-nodejs-api:master Jan 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants