migrate-to-typescript — команда Claude Code: миграция JS
Команда переводит JavaScript-проект на TypeScript: настраивает инструменты, переносит файлы и разбирает ошибки типов. Подходит для постепенной или полной миграции.
npx claude-code-templates@latest --command setup/migrate-to-typescriptЧто делает migrate-to-typescript
Команда анализирует package.json, считает файлы .js и .ts, а также ищет конфигурацию сборки. Затем настраивает TypeScript и tsconfig.json, добавляет определения типов, переименовывает файлы в .ts или .tsx и помогает исправить ошибки компилятора.
Передайте стратегию: постепенную, полную, строгую или пошаговую. Команда также предлагает настроить проверку типов и обновить тесты. При строгом режиме придётся разбирать ошибки, связанные с несовпадением типов и обработкой null и undefined; это стоит учесть до запуска миграции.
Какие задачи решает
- перенести JavaScript-файлы в TypeScript
- настроить
tsconfig.jsonи интеграцию со сборщиком - добавить типы для зависимостей и собственного кода
- исправить ошибки строгой проверки типов
- обновить тесты и проверку типов
Примеры запросов агенту
- Перенеси проект с JavaScript на TypeScript постепенно:
/migrate-to-typescript --gradual. - Преобразуй весь JavaScript-код в TypeScript:
/migrate-to-typescript --complete. - Проведи миграцию с пошаговым подходом:
/migrate-to-typescript --incremental.
Как установить migrate-to-typescript
1Через claude-code-templates
npx claude-code-templates@latest --command setup/migrate-to-typescript2Вручную: положить файлы
.claude/commands/migrate-to-typescript.mdВызов — /migrate-to-typescript. Для всех проектов — ~/.claude/commands/
Вручную: положить файлы
~/.codex/prompts/migrate-to-typescript.mdВызов — /prompts:migrate-to-typescript. В Codex этот формат помечен устаревшим, замена — скиллы
Вручную: положить файлы
.github/prompts/migrate-to-typescript.prompt.mdВручную: положить файлы
.gemini/commands/migrate-to-typescript.tomlGemini хранит команды в TOML: текст запроса — в поле prompt
Вопросы о migrate-to-typescript
Как установить migrate-to-typescript в Claude Code?
Выполните npx claude-code-templates@latest --command setup/migrate-to-typescript. Файл команды находится по пути .claude/commands/migrate-to-typescript.md.
Что делает migrate-to-typescript?
Команда помогает перевести JavaScript-проект на TypeScript: настроить среду, добавить типы, переименовать файлы и исправить ошибки проверки.
Какие стратегии миграции поддерживает команда?
Можно выбрать постепенную, полную, строгую или пошаговую стратегию: передайте её как аргумент команды.
Исходный текст
migrate-to-typescript.md · MIT
--- allowed-tools: Read, Write, Edit, Bash argument-hint: "[migration-strategy] | --gradual | --complete | --strict | --incremental" description: Migrate JavaScript project to TypeScript with proper typing and tooling setup --- # Migrate to TypeScript Migrate JavaScript project to TypeScript with comprehensive type safety: **$ARGUMENTS** ## Current JavaScript State - Project structure: @package.json (analyze JS/TS mix and dependencies) - JavaScript files: !`find . -name "*.js" -not -path "./node_modules/*" | wc -l` - Existing TypeScript: !`find . -name "*.ts" -not -path "./node_modules/*" | wc -l` - Build system: @webpack.config.js or @vite.config.js or @rollup.config.js ## Task Systematically migrate JavaScript codebase to TypeScript with proper typing and tooling: **Migration Strategy**: Use $ARGUMENTS to specify gradual migration, complete conversion, strict mode, or incremental approach **Migration Process**: 1. **Environment Setup** - TypeScript installation, tsconfig.json configuration, build tool integration 2. **Type Definitions** - Install @types packages, create custom type declarations, define interfaces 3. **File Migration** - Rename .js to .ts/.tsx, add type annotations, resolve compiler errors 4. **Code Transformation** - Convert classes, functions, and modules with proper typing 5. **Error Resolution** - Fix type mismatches, null/undefined handling, strict mode issues 6. **Testing & Validation** - Update test files, configure type checking, validate type coverage **Advanced Features**: Generic types, mapped types, conditional types, module augmentation, and strict compiler settings. **Developer Experience**: Configure IDE integration, debugging, linting rules, and team onboarding. **Output**: Fully typed TypeScript codebase with strict type checking, comprehensive IntelliSense, and improved developer productivity.
© davila7 · MIT · davila7/claude-code-templates