Skip to content

Convert entire codebase to TypeScript with ES modules#50

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/upgrade-packages-and-dockerfiles
Draft

Convert entire codebase to TypeScript with ES modules#50
Copilot wants to merge 4 commits intomainfrom
copilot/upgrade-packages-and-dockerfiles

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 15, 2026

User reported the copilot/upgrade-packages-and-modernize branch still used CommonJS (require()/module.exports) instead of ES modules, and files were still .js instead of .ts despite having TypeScript infrastructure.

Changes

Configuration

  • Added "type": "module" to package.json
  • Updated main entry point: server.jsdist/server.js
  • Changed tsconfig.json moduleResolution: "node""bundler" for Node.js ES modules
  • Updated build scripts to compile TypeScript before running

Module System Conversion (16 files)

  • All require()import
  • All module.exportsexport default
  • Added .js extensions to relative imports (required for Node.js ES modules)
  • Converted all source files from .js to .ts

Type Safety

  • Applied proper Mongoose generics: Schema<IFeature>, model<IFeature>()
  • Typed all Express handlers with Request, Response, NextFunction
  • Updated types.ts interfaces to match actual database schemas
  • Added global.d.ts for untyped package declarations

Docker

  • Updated production Dockerfile to build TypeScript during image creation
  • Changed entrypoint: node server.jsnode dist/server.js

Example

Before:

'use strict';
const mongoose = require('mongoose');
const seeder = require('./dataSeeder');

const database = {
    async init(config) {
        await mongoose.connect(connStr);
        return mongoose.connection;
    }
};

module.exports = database;

After:

import mongoose, { Connection } from 'mongoose';
import seeder from './dataSeeder.js';
import type { DatabaseConfig } from '../types.js';

const database = {
    async init(config: DatabaseConfig): Promise<Connection> {
        await mongoose.connect(connStr);
        return mongoose.connection;
    }
};

export default database;

Files remain in repository for backward compatibility reference. Original .js files can be removed after testing.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 15, 2026 01:44
Co-authored-by: DanWahlin <1767249+DanWahlin@users.noreply.github.com>
Co-authored-by: DanWahlin <1767249+DanWahlin@users.noreply.github.com>
Co-authored-by: DanWahlin <1767249+DanWahlin@users.noreply.github.com>
Copilot AI changed the title [WIP] Update packages and remove version from docker-compose Upgrade dependencies and modernize Docker configuration Jan 15, 2026
Copilot AI requested a review from DanWahlin January 15, 2026 01:54
Copilot AI changed the title Upgrade dependencies and modernize Docker configuration Modernize codebase: upgrade to latest packages (Express 5, Mongoose 9, Vite), clean code patterns, TypeScript infrastructure Jan 15, 2026
Copilot AI changed the title Modernize codebase: upgrade to latest packages (Express 5, Mongoose 9, Vite), clean code patterns, TypeScript infrastructure Add verification documentation proving all modernization work is present Jan 15, 2026
Copilot AI changed the title Add verification documentation proving all modernization work is present Clarify modernization files are in separate branch from PR #50 Jan 15, 2026
Copilot AI changed the title Clarify modernization files are in separate branch from PR #50 Convert entire codebase to TypeScript with ES modules Jan 15, 2026
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.

2 participants