Releases: kyle-n/TypeSwift
Includes TypeScript types
Previous versions of the package did not bundle .d.ts
files. If you were using Node, React or a similar compiled environment, you might have run into this problem:
import 'typeswift';
const nums = [1, 2];
console.log(nums.first) // .first is underlined with a red squiggle in the IDE
That issue should be fixed. Apologies for the oversight.
Improvements to build and test processes
- Uses
shx
to run setup scripts so the package can be developed on non-Unix-like OSes such as Windows (Note:preview-npm-files
is not Windows-compatible becauseshx
does not supporttar
) - Moves unit test files and jest config to separate
tests
file - Adds
ts-jest
as a devDependency to run unit tests. Simplifies previous process of transpiling to a temporary directory. - Removes duplicate or unused scripts in
package.json
- Renames NPM deploy GitHub action to
cd.yml
- CI runs only on PRs into
main
- CD runs on merge/push into
main
Restores static methods
Figured out how to make TypeScript accept static extensions to base types. This release incldues:
Boolean.random()
Number.zero
Faster builds
In 1.1.0, TypeSwift actually transpiled the TypeScript source three times - once for Node, and twice for the browser bundles. In 1.1.1, the TS source is transpiled once, then that JS is bundled together by webpack.
This release adds no new user-facing features, but will make developing new ones easier by reducing build times by ~60%.
Fixes faulty naming and removes untyped static vars
Removed
myNumber.zero
- should be a static variable,Number.zero
Boolean.random()
- It is extremely difficult to add static variables to TypeScript interfaces. Removed until I come up with a better solution.
Fixed
Object.merging()
was declared asObject.merged()
in the TS interface. The interface property has been renamed tomerging
to match Swift.
Development
- Unit tests all variables and functions
- New build script that automatically runs unit tests, updates the README and sets an NPM version
Removes duplicate browser bundle
For some reason, webpack was generating two JS bundles for use in web browsers. This version fixes the build scripts so the only files in _bundles
are:
typeswift.js
typeswift.js.map
typeswift.min.js
This release was also a successful test of a GitHub Action to automatically publish any new versions on NPM.