Conversation
- Fix runtime bugs: toValue truthiness (falsy values dropped), toStream error swallowing (no .catch), IterableType | any union swallowing all other branches - Migrate from Mocha to Vitest 3 with v8 coverage; fix toStream test reader variable bug; add 12 new edge-case tests (26 total, 96.5% coverage) - Replace dual-CJS build with CJS + ESM; add exports map, module, and types fields to package.json; upgrade target to ES2020 - Migrate ESLint to flat config (eslint.config.mjs); add lint script - Remove dead deps (@types/fs-extra, npm-check-updates, source-map-support); fix lint-staged (remove deprecated git add); split prepare/prepublishOnly - Add LICENSE file; align functions.ts signature with README - Add GitHub Actions CI (Node 18/20/22 matrix) - Upgrade all packages to latest; fix TypeScript 6 breaking changes (baseUrl removed, moduleResolution → bundler, polyfill cast) Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
- Split monolithic src/typectl.ts into focused modules: types.ts, polyfill.ts, wrap.ts, pick.ts, concurrency.ts, iterate.ts, mappers.ts, assign.ts; typectl.ts is now a pure barrel re-export - Fix for...in → Object.entries() in iterate (avoids inherited keys) - Fix recursive ReadableStream pump → iterative while loop (no stack risk) - Fix pick error test: silent try/catch → expect().rejects.toThrow() - Add JSDoc to every exported function covering behaviour, concurrency semantics, and examples - Add 11 edge-case tests: empty array/record/stream for iterate, toArray, toRecord, toValue, toStream; wrap with zero args; all/each on [] - Fix package.json exports: condition-specific "types" paths for ESM and CJS consumers; add "files": ["dist"] whitelist; remove jsx lint-staged glob - Fix bin/watch to watch both CJS and ESM targets in parallel - Fix README stale spec example (Jest import → Vitest) - Rewrite README with motivation, full API reference with examples, concurrency table, type export table, compatibility, and dev commands Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Modernize build, test, and packaging (previous work)
exportsmap,module, andtypesfieldseslint.config.mjs); addlintscriptmoduleResolution,ignoreDeprecations)toValuefalsy-value drop,toStreamerror swallowingRefactor into focused modules
src/typectl.ts(~500 lines) into eight focused modules:types.ts,polyfill.ts,wrap.ts,pick.ts,concurrency.ts,iterate.ts,mappers.ts,assign.tssrc/typectl.tsis now a pure barrel re-export; public API is unchangedBug fixes
for...in→Object.entries()initerate: no longer visits inherited prototype properties on plain-object recordswhileloop: eliminates stack overflow risk on longReadableStreaminputspickerror test: replaced silenttry/catchwithexpect().rejects.toThrow()so a missing throw correctly fails the testDocumentation
iterate, all 12 utility types listed, compatibility notes, dev commandsTests (38 total, up from 26)
iterate,toArray,toRecord,toValue,toStream;wrapwith zero args;all/eachon[]Packaging
"files": ["dist"]whitelist inpackage.json(replaces.npmignoreas the publish guard)"types"inexports: ESM consumers getdist/esm/typectl.d.ts, CJS consumers getdist/cjs/typectl.d.tsjsxglob fromlint-stagedbin/watchnow watches both CJS and ESM targets in parallelTest plan
npm run build— clean dual CJS + ESM buildnpm run lint— zero errorsnpm test— 38 tests passnpm run test:coverage— coverage onsrc/typectl.tsand all modulesMade with Cursor