Skip to content

Conversation

Copy link

Copilot AI commented Jan 28, 2026

Plan: Add TypeScript type definitions for exports

  • Understand repository structure and exports
  • Create type definitions for ./jest export (jest.d.ts)
    • Re-export types from @jest/globals
  • Create type definitions for ./expect export (expect.d.ts)
    • Re-export types from expect package
  • Create type definitions for ./node export (node.d.ts)
    • Re-export types from node:test module (@types/node)
  • Create type definitions for ./mock export (mock.d.ts)
    • Custom types for Exodus-specific APIs
  • Create type definitions for ./tape export (tape.d.ts)
    • Custom types for tape-compatible API
  • Create type definitions for ./benchmark export (benchmark.d.ts)
    • Custom types for benchmark API
  • Update package.json to reference type definitions in exports
  • Update tsconfig.json paths to point to .d.ts files
  • Test TypeScript integration with type checking
  • Fix type definitions to use declare keyword for esbuild compatibility
  • Run linter and format code with prettier
  • Address code review feedback
  • Remove package-lock.json and add to .gitignore (repo uses pnpm)

Key Changes

This PR adds TypeScript type definitions for all package exports by re-exporting from official type packages wherever possible, following the "borrow from jest, node, etc" approach suggested in the issue.

Type Definitions Added

All type definition files now leverage official type definitions from the ecosystem:

  • expect.d.ts (11 lines): Re-exports types from the expect package (existing optionalDependency)
  • jest.d.ts (28 lines): Re-exports types from @jest/globals (existing devDependency)
  • node.d.ts (28 lines): Re-exports types from node:test module (@types/node)
  • mock.d.ts (49 lines): Custom types for Exodus-specific utilities (fetchReplay, websocketRecord, timersSpeedup, etc.)
  • tape.d.ts (154 lines): Custom types for tape-compatible API
  • benchmark.d.ts (35 lines): Custom types for benchmark API

Benefits

  • Reduced maintenance burden: By re-exporting from official packages (expect, @jest/globals, node:test), we avoid maintaining duplicate type definitions
  • Better type accuracy: Official type definitions are maintained by their respective package maintainers
  • Smaller codebase: Total reduction of ~450 lines by leveraging existing types

Only mock.d.ts, tape.d.ts, and benchmark.d.ts contain custom type definitions for library-specific APIs that don't exist in standard packages.

Original prompt

This section details on the original issue you should resolve

<issue_title>typings for exports</issue_title>
<issue_description>can prob "borrow" them from jest, node, etc</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 28, 2026 08:57
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
…ties

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Copilot AI changed the title [WIP] Add typings for exports from Jest and Node Add TypeScript type definitions for package exports Jan 28, 2026
Copilot AI requested a review from ChALkeR January 28, 2026 09:09
Copy link
Collaborator

@ChALkeR ChALkeR left a comment

Choose a reason for hiding this comment

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

@copilot this repo uses pnpm, don't add package-lock

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 28, 2026

@copilot this repo uses pnpm, don't add package-lock

Removed package-lock.json and added it to .gitignore in commit 7282e61.

.gitignore Outdated
coverage
playground
*.tgz
package-lock.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot put under node_modules

Copy link
Author

Choose a reason for hiding this comment

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

Done in commit 8f8c25b. Moved package-lock.json entry under node_modules in .gitignore.

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
src/node.d.ts Outdated
@@ -0,0 +1,158 @@
/**
* Type definitions for @exodus/test/node
* Provides Node.js test runner compatible APIs
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot can we re-export types/node?

Copy link
Author

Choose a reason for hiding this comment

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

Done in commit 8f8c25b. The node.d.ts now re-exports types from the node:test module (@types/node), reducing the file from 150+ lines to 28 lines.

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Copilot AI and others added 2 commits January 28, 2026 10:30
…ypes/node

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
@ChALkeR ChALkeR requested a review from Copilot January 28, 2026 10:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds TypeScript type definitions for all package exports, enabling better IDE support and type checking for consumers of the @exodus/test package. The approach leverages official type definitions from ecosystem packages where possible (expect, @jest/globals, node:test) and provides custom types for library-specific APIs.

Changes:

  • Added 6 new .d.ts type definition files covering all package exports (jest, node, tape, expect, mock, benchmark)
  • Updated package.json exports to reference type definitions using the "types" field
  • Updated tsconfig.json paths to point to the new type definition files
  • Added package-lock.json to .gitignore (appropriate since repo uses pnpm)

Reviewed changes

Copilot reviewed 1 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/jest.d.ts Type definitions for Jest-compatible API (has critical issues with runtime exports)
src/node.d.ts Type definitions for Node.js test runner API (has critical issues with runtime exports)
src/tape.d.ts Custom type definitions for tape-compatible testing API
src/expect.d.ts Type re-exports from expect package
src/mock.d.ts Custom types for mocking and testing utilities
src/benchmark.d.ts Custom types for benchmark API (incorrect return type)
package.json Updated exports with "types" field and added .d.ts files to files array
tsconfig.json Updated paths to point to .d.ts files instead of .js files
.gitignore Added package-lock.json (appropriate for pnpm-based project)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

typings for exports

2 participants