Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

Description

Adds TypeScript type definitions (.d.ts) for all modules in src/, enabling IDE autocomplete and type checking for TypeScript consumers.

Changes:

  • Added TypeScript 5.9.3 as dev dependency
  • Created tsconfig.json configured to generate declaration files from JavaScript sources
  • Added JSDoc annotations to module exports for accurate type inference
  • Updated package.json:
    • "types": "./src/index.d.ts" field points to type definitions
    • "build": "tsc" script generates .d.ts files
  • Generated type definitions preserve exports:
    • Logger returns winston.Logger with proper options interface
    • Redis returns ioredis.Redis | undefined with exported getConnectionInfo function
    • Server returns object with app, server, listen(), close() methods
    • NewRelic returns initialization result or undefined

TypeScript consumers now get full IntelliSense:

import { logger, redis, server } from '@automattic/vip-go';

// Autocomplete and type checking work
const log = logger('my-app:module', {
  transport: customTransport,  // Type: winston-transport
  silent: false                 // Type: boolean
});

const redisClient = redis({ logger: log });  // Type: Redis | undefined

Steps to Test

  1. Check out PR
  2. Run npm install
  3. Run npm run build to generate type definitions
  4. Verify .d.ts files exist in src/ subdirectories
  5. Run npm test to verify all tests pass
  6. Create a TypeScript file importing the package and verify IDE autocomplete works
Original prompt

Please generate TypeScript typings for sources in src/ and update package.json. Then create a PR with your changes.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: sjinks <7810770+sjinks@users.noreply.github.com>
Copilot AI changed the title [WIP] Add TypeScript typings for sources in src and update package.json Add TypeScript type definitions for JavaScript modules Dec 13, 2025
Copilot AI requested a review from sjinks December 13, 2025 13:06
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