feat: added typescript types for exported functions#1
feat: added typescript types for exported functions#1joshuagemvicente wants to merge 1 commit intosheldonix:mainfrom
Conversation
|
Sorry, I can’t add labels or assignees on my end. |
There was a problem hiding this comment.
Pull request overview
Adds TypeScript type definitions and package metadata so cube-scramble can be consumed with typings in TypeScript projects.
Changes:
- Adds a root
index.d.tswith exported API typings. - Updates
package.jsonto advertise the types viatypesandexports.types. - Introduces TypeScript/tsup config artifacts and updates lockfile metadata.
Reviewed changes
Copilot reviewed 3 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| index.d.ts | New TypeScript declarations for exported functions and ScrambleType. |
| package.json | Adds types + exports.types entries for TS resolution. |
| package-lock.json | Lockfile metadata updates. |
| tsconfig.json | Adds TS compiler configuration. |
| tsup.config.ts | Formatting-only config update. |
| tsup.config.js | Added compiled JS version of tsup config. |
| tsup.config.js.map | Source map for compiled tsup config. |
| tsup.config.d.ts | Generated declaration for tsup config. |
| tsup.config.d.ts.map | Source map for generated tsup config declaration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "exports": { | ||
| ".": { | ||
| "types": "./index.d.ts", | ||
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs" | ||
| } | ||
| }, | ||
| "types": "./index.d.ts", | ||
| "scripts": { |
There was a problem hiding this comment.
package.json declares types: "./index.d.ts", but the files allowlist only includes dist, so index.d.ts will not be published to npm and consumers will still see missing types. Add index.d.ts (and any referenced .d.ts.map if you intend to ship it) to the files array, or remove the files allowlist so the types file is included in the published package.
| }); | ||
| //# sourceMappingURL=tsup.config.js.map No newline at end of file |
There was a problem hiding this comment.
tsup.config.js (and its sourcemap) appears to be a compiled output of tsup.config.ts (note the //# sourceMappingURL=...). Keeping both .ts and generated .js configs in source control risks them drifting out of sync. Prefer committing only the source config (tsup.config.ts) and ignore/remove generated .js/.map outputs (or switch to a single .js config if you don’t want TS here).
| }); | |
| //# sourceMappingURL=tsup.config.js.map | |
| }); |
Title: Add TypeScript support to cube-scramble package
Problem Description
The cube-scramble package lacks TypeScript type definitions, making it difficult to use in TypeScript projects without manual type declarations. Users who want type safety and IntelliSense support in their TypeScript applications currently have to write their own type definitions.
Steps to Reproduce
import { getScramble } from 'cube-scramble';
const scramble = getScramble('333');
3. Observe that no type definitions are loaded
Expected Behavior
The package should include:
Environment Details
Proposed Solution
Add TypeScript support by: