Skip to content

Commit

Permalink
feat: add isInstanceof()
Browse files Browse the repository at this point in the history
deprecates `isConstructor()`

`isType()` not accepting constructor anymore (breaking).

Updated project ot use changeset for better control of releases.
  • Loading branch information
unional committed Dec 13, 2022
1 parent 585c2a4 commit d43213f
Show file tree
Hide file tree
Showing 15 changed files with 683 additions and 1,005 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true,
"updateInternalDependents": "always"
},
"access": "public",
"baseBranch": "main",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"ignore": [],
"linked": [],
"updateInternalDependencies": "patch"
}
10 changes: 10 additions & 0 deletions .changeset/nine-dragons-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'type-plus': major
---

Deprecates `isConstructor`.
It cannot reliably detect non-constructors as normal functions and transpiled arrow functions are both returned true.

Add `isInstanceof()` to do `instanceof` check against `unknown` or union types of constructor and other types.

`isType()` does not accept `AnyConstructor` anymore. Use `isInstanceof()` instead (breaking).
2 changes: 1 addition & 1 deletion .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pull_request_rules:
- name: automatic merge for Dependabot pull requests
conditions:
- author~=^dependabot(|-preview)\[bot\]$
- title~=^Bump [^\s]+ from ([\d]+)\..+ to \1\.
- title~=bump [^\s]+ from ([\d]+)\..+ to \1\.
actions:
merge:
method: squash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
os: '["ubuntu-latest"]'

release:
uses: unional/.github/.github/workflows/pnpm-release-semantic.yml@main
uses: unional/.github/.github/workflows/pnpm-release-changeset.yml@main
needs: code
secrets: inherit

Expand Down
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.changeset/*.md
CHANGELOG.md
flow-types.md
LICENSE
11 changes: 11 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
editorconfig: true,
printWidth: 110,
endOfLine: 'auto',
semi: false,
singleQuote: true,

// For ES5, trailing commas cannot be used in function parameters; it is counterintuitive
// to use them for arrays only
trailingComma: 'none'
};
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "type-plus",
"version": "0.0.0-development",
"version": "4.18.1",
"description": "Provides additional types for TypeScript.",
"homepage": "https://github.com/unional/type-plus",
"bugs": {
Expand Down Expand Up @@ -38,38 +38,38 @@
"build:tslib": "tsc -p tsconfig.tslib.json && ncp package.cjs.json tslib/package.json",
"build:doc": "typedoc",
"clean": "rimraf cjs coverage esm lib libm tslib",
"coverage": "jest --coverage",
"coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --coverage",
"cs": "changeset",
"depcheck": "depcheck",
"lint": "eslint --ext=ts,js .",
"nuke": "pnpm clean && rimraf node_modules",
"postinstall": "husky install",
"prepack": "pinst --disable",
"postpack": "pinst --enable",
"release": "semantic-release",
"release": "changeset publish",
"size": "size-limit",
"test": "jest",
"test:watch": "jest --watch",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest",
"test:watch": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --watch",
"verify": "npm-run-all clean -p build depcheck lint coverage -p size",
"version": "changeset version",
"watch": "jest --watch"
},
"dependencies": {
"tersify": "^3.10.2",
"unpartial": "^1.0.3"
"tersify": "^3.11.1",
"unpartial": "^1.0.4"
},
"devDependencies": {
"@changesets/cli": "^2.25.2",
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"@repobuddy/jest": "^2.1.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.5",
"@semantic-release/npm": "^9.0.1",
"@size-limit/preset-small-lib": "^8.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^14",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@unional/fixture": "^3.0.0",
"assertron": "^11.0.1",
"cross-env": "^7.0.3",
"depcheck": "^1.4.3",
"eslint": "^8.17.0",
"eslint-plugin-harmony": "^7.1.0",
Expand All @@ -83,7 +83,6 @@
"pinst": "^3.0.0",
"rimraf": "^3.0.2",
"satisfier": "^5.2.2",
"semantic-release": "^19.0.3",
"size-limit": "^8.0.0",
"ts-jest": "^29.0.0",
"tslib": "^2.4.0",
Expand Down
Loading

0 comments on commit d43213f

Please sign in to comment.