-
Notifications
You must be signed in to change notification settings - Fork 2
Add TypeScript type definitions for package exports #50
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
base: main
Are you sure you want to change the base?
Conversation
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>
ChALkeR
left a comment
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.
@copilot this repo uses pnpm, don't add package-lock
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
.gitignore
Outdated
| coverage | ||
| playground | ||
| *.tgz | ||
| package-lock.json |
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.
@copilot put under node_modules
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.
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 | |||
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.
@copilot can we re-export types/node?
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.
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>
…ypes/node Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
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.
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.tstype 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.
Plan: Add TypeScript type definitions for exports
./jestexport (jest.d.ts)./expectexport (expect.d.ts)./nodeexport (node.d.ts)./mockexport (mock.d.ts)./tapeexport (tape.d.ts)./benchmarkexport (benchmark.d.ts)declarekeyword for esbuild compatibilityKey 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:
expectpackage (existing optionalDependency)@jest/globals(existing devDependency)node:testmodule (@types/node)Benefits
expect,@jest/globals,node:test), we avoid maintaining duplicate type definitionsOnly
mock.d.ts,tape.d.ts, andbenchmark.d.tscontain custom type definitions for library-specific APIs that don't exist in standard packages.Original prompt
💡 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.