Contributions are welcome. Please look at current issues first and comment or create a new issue when required. We ask that you follow the code of conduct in all communication.
If you're new to open source, please see this guide on How to Contribute to Open Source
To develop and make contributions to this project...
- First fork and clone the repo
- Make a branch for your fix or feature
- Make changes and create or update tests
- Run
yarn test
andyarn lint
- Commit changes to your branch
- Submit a PR referencing the issue
If you need more detail, read this great reference by Jen Weber.
Utility types are tested with snapshots using dts-jest.
yarn test:watch
while developing oryarn test:update
when finished to update snapshotsyarn test
will check that tests match the snapshots and fails if snapshots haven't been updated
Snap files are generated alongside test files to make definitions and diffs more readable. Unfortunately manually checking these snaps is the best way to ensure expected behaviour from custom types. e.g:
test/dts-jest/util/Only.test.ts
is where test is written
// @dts-jest:snap
testType<Only<{ a: any, b: any, c: any }, 'a' | 'b'>>()
test/dts-jest/util/Only.test.snap.ts
is generated from the snapshot
// @dts-jest:snap -> Only<ABC, "a" | "b">
testType<Only<{ a: any, b: any, c: any }, 'a' | 'b'>>()
☝️ see appended type output -> Only<ABC, "a" | "b">
There's also a partial setup to test type definitions with dtslint
. Run with yarn test:types
. This is experimental but open for enhancements.
Approved contributors can accept PRs or make changes to publish a release. All it takes is a commit including an incremented package version to trigger a GitHub action to publish to NPM.
Please follow semantic versioning for the type of changes being published.
Before merging a new version, you can test the bundle with a consuming project to ensure any change to package config doesn't break builds (which can happen even if tests pass).
From this package root:
yarn link
to register the local dependencyyarn build
to compile the package files (oryarn dev
to watch changes)
In your consuming project:
yarn link @os-gurus/assemble
to link the local dependency- Run project or tests, assuming a broken build would throw it
- Ensure exported types available in the project IDE
yarn unlink @os-gurus/assemble
resume consuming the published package