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 IDEThat issue should be fixed. Apologies for the oversight.
Improvements to build and test processes
- Uses
shxto run setup scripts so the package can be developed on non-Unix-like OSes such as Windows (Note:preview-npm-filesis not Windows-compatible becauseshxdoes not supporttar) - Moves unit test files and jest config to separate
testsfile - Adds
ts-jestas 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.zeroBoolean.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 tomergingto 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.jstypeswift.js.maptypeswift.min.js
This release was also a successful test of a GitHub Action to automatically publish any new versions on NPM.