Convert project to TypeScript #128
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR converts the entire project from JavaScript to TypeScript while maintaining 100% backward compatibility and preserving all existing behavior.
Changes
TypeScript Configuration
tsconfig.jsonconfigured for CommonJS output targeting ES2020jest.config.jsfor TypeScript test support using ts-jest@typescript-eslintpluginsSource Code Conversion
All source files have been converted to TypeScript:
index.js→index.tscreate-or-update-files.js→create-or-update-files.tscreate-or-update-files.test.js→create-or-update-files.test.tsAll types are properly defined using Octokit's type system:
Octokittype from@octokit/restfor the octokit parameterRestEndpointMethodTypesfrom@octokit/plugin-rest-endpoint-methodsfor method parameters and return typesOptions,Change,FileChange, andCommitResultPackage Configuration
Updated
package.json:index.js→dist/index.jstypesfield pointing todist/index.d.tsfor TypeScript consumersbuild,prepareDependencies
Added TypeScript-related dev dependencies:
typescript- TypeScript compiler@types/jest,@types/node- Type definitions@typescript-eslint/eslint-plugin,@typescript-eslint/parser- ESLint TypeScript supportts-jest- Jest TypeScript preprocessorBuild Output
The project now builds to the
dist/directory containing:.d.ts)The
.gitignorehas been updated to exclude build artifacts from version control.Testing
✅ All 28 existing tests pass without modification
✅ Linting passes with no errors
✅ Build succeeds and generates correct output
✅ Plugin loads correctly from built code
✅ No security vulnerabilities detected
Backward Compatibility
This conversion maintains 100% backward compatibility:
Migration Path
For consumers of this package:
typesfield inpackage.jsonwith full type safety using Octokit's type systemFixes #127
Original prompt
Fixes #127
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.