Add TypeScript Type Definitions #32
Merged
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.
Add TypeScript Type Definitions
Problem
The
jscombguidpackage is JavaScript-only and doesn't include TypeScript type definitions. There's no@types/jscombguidpackage available. With"strict": trueintsconfig.json, TypeScript requires type information for all imports, causing thetsc -bstep to fail for consuming applications.Solution
This PR adds native TypeScript type definitions to the library, eliminating the need for a separate
@types/jscombguidpackage. The type definitions are automatically included in the build output and published with the package.Changes
1. TypeScript Definition File (
src/index.d.ts)generateSequentialGuidfunction() => string2. Build Script (
scripts/copy-types.js).d.tsfiles fromsrc/tolib/during build3. Build Process Updates (
package.json)copy-typesscript to the build pipelinebuildscript to include type definition copying stepclean → lint → compile → copy-types → testBenefits
✅ TypeScript Support: Consuming applications with strict TypeScript can now use the library without errors
✅ No External Dependencies: Type definitions are bundled with the package (no need for
@types/jscombguid)✅ Better Developer Experience: IDEs will provide autocomplete and type checking
✅ Backward Compatible: JavaScript consumers are unaffected
Testing
Usage Example
Related
Fixes the issue where consuming applications with
"strict": trueintsconfig.jsonfail to compile when importing this library.