-
Notifications
You must be signed in to change notification settings - Fork 1
Приложение для терминала #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Приложение для терминала #2
Conversation
src/cli/commands/version.command.ts
Outdated
| } | ||
|
|
||
|
|
||
| function isPackageJson(value: unknown): value is PackageJsonData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему эта функция вне класса ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
занес в приватное поле
src/shared/lib/tsv-file-reader.ts
Outdated
| @@ -0,0 +1,46 @@ | |||
| import { FileReader } from './file-reader.interface.js'; | |||
| import { readFileSync } from 'node:fs'; | |||
| import { RentalOffer } from '../types/rental-offer.interface.js'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Полезно знать, такие штуки которые импортируются только в качестве типа лучше импортировать через import type чтобы в JS файле не были лишнего импорта это может помочь предотвратить лишние циклические зависимости
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verbatimModuleSyntax по дефолту не включен
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тоже полезно знать, что функции файловой системы которые *Sync блокируют выполнение потока, то есть использовать их нужно аккуратно и тогда когда ты действительно понимаешь что это не затормозит какие то паралельные процессы.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
да, спасибо, тут по примеру из лекции просто синхронную функцию вызвал
🎓 Приложение для терминала