v3: migrate Numeral.js runtime to TypeScript#798
Conversation
There was a problem hiding this comment.
Pull request overview
This PR delivers version 3.0.0, a comprehensive TypeScript migration of Numeral.js while preserving existing runtime behavior. The migration converts all core, format, and locale files from JavaScript to TypeScript as the source of truth, adds bundled type declarations, updates build infrastructure, and implements GitHub Actions CI for Node 18/20/22.
Changes:
- Migrated entire codebase from JavaScript to TypeScript with type definitions
- Added first-party TypeScript declarations via
numeral.d.ts - Updated build pipeline to compile TypeScript before Grunt tasks
- Replaced Travis CI with GitHub Actions (Node 18/20/22)
- Updated documentation with v3 migration guide
Reviewed changes
Copilot reviewed 130 out of 168 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.core.json | TypeScript compiler configuration for ES5 target |
| src/numeral.ts | Main TypeScript source (762 lines) with type definitions |
| src/numeral.js | Generated JavaScript from TypeScript compilation |
| numeral.d.ts | Bundled TypeScript declarations for consumers |
| src/globals.d.ts | Global type declarations for module systems |
| src/formats/*.ts | Format plugins migrated to TypeScript |
| src/locales/*.ts | Locale files migrated to TypeScript |
| tests/numeral.js | Expanded test coverage with new API tests |
| package.json | Updated to 3.0.0, added types field, TypeScript dev dependency |
| .github/workflows/ci.yml | New GitHub Actions CI workflow |
| README.md | Updated docs with v3 notes and contribution guide |
| MIGRATION.md | New migration guide for upgrading to 3.0.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tsconfig.core.json
Outdated
| "strict": false, | ||
| "noImplicitAny": false, |
There was a problem hiding this comment.
The TypeScript compiler option "strict" is set to false, which disables all strict type checking. For a TypeScript migration, it's recommended to enable strict mode to catch type errors and enforce better type safety. Consider setting "strict": true or at minimum enabling "noImplicitAny": true.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 131 out of 170 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR delivers the full 3.0.0 rewrite with TypeScript as the source of truth across core, formats, and locales while preserving existing runtime behavior. It expands core API coverage in tests, adds bundled type declarations, updates package metadata/scripts for the TS-backed build, and regenerates JS/minified distribution artifacts. It also adds GitHub Actions CI (Node 18/20/22), updates README/changelog for v3, and includes a migration guide. Validation: npm test passes (181 tests).