@battis/typescript-tricks 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/dist/JSONValue.d.ts +3 -5
- package/dist/OneOf.d.ts +9 -0
- package/dist/OneOf.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
## [0.7.6](https://github.com/battis/typescript-config/compare/typescript-tricks/0.7.5...typescript-tricks/0.7.6) (2026-01-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* include null as possible JSONPrimitive ([6f2aa04](https://github.com/battis/typescript-config/commit/6f2aa043a1b201f54d975a81bdc256c5feeb6989))
|
|
11
|
+
|
|
12
|
+
## [0.7.5](https://github.com/battis/typescript-config/compare/typescript-tricks/0.7.4...typescript-tricks/0.7.5) (2025-11-11)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* tjjfvi's OneOf type ([bf3a78d](https://github.com/battis/typescript-config/commit/bf3a78d834079029e2aa2da5313bc8387f1239c5))
|
|
2
18
|
|
|
3
19
|
## 0.7.4
|
|
4
20
|
|
package/dist/JSONValue.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
};
|
|
1
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
2
|
+
export type JSONArray = Array<JSONValue>;
|
|
4
3
|
export interface JSONObject {
|
|
5
4
|
[k: string]: JSONValue;
|
|
6
5
|
}
|
|
7
|
-
export
|
|
8
|
-
}
|
|
6
|
+
export type JSONValue = JSONPrimitive | JSONArray | JSONObject;
|
|
9
7
|
export default JSONValue;
|
package/dist/OneOf.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @see https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types#comment123255834_53229567 */
|
|
2
|
+
type UnionKeys<T> = T extends T ? keyof T : never;
|
|
3
|
+
type Expand<T> = T extends T ? {
|
|
4
|
+
[K in keyof T]: T[K];
|
|
5
|
+
} : never;
|
|
6
|
+
export type OneOf<T extends object[]> = {
|
|
7
|
+
[K in keyof T]: Expand<T[K] & Partial<Record<Exclude<UnionKeys<T[number]>, keyof T[K]>, never>>>;
|
|
8
|
+
}[number];
|
|
9
|
+
export {};
|
package/dist/OneOf.js
ADDED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ __exportStar(require("./Forms"), exports);
|
|
|
22
22
|
__exportStar(require("./JSONValue"), exports);
|
|
23
23
|
__exportStar(require("./MethodNames"), exports);
|
|
24
24
|
__exportStar(require("./Mixin"), exports);
|
|
25
|
+
__exportStar(require("./OneOf"), exports);
|
|
25
26
|
__exportStar(require("./OptionalProperty"), exports);
|
|
26
27
|
__exportStar(require("./PropertyRequirements"), exports);
|
|
27
28
|
__exportStar(require("./Shorthand"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@battis/typescript-tricks",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "A handful of useful types and operators",
|
|
5
5
|
"homepage": "https://github.com/battis/typescript-config/tree/main/packages/typescript-tricks#readme",
|
|
6
6
|
"repository": {
|
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
"main": "./dist/index.js",
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tsconfig/recommended": "^1.0.
|
|
19
|
+
"@tsconfig/recommended": "^1.0.13",
|
|
20
|
+
"commit-and-tag-version": "^12.6.1",
|
|
20
21
|
"del-cli": "^6.0.0",
|
|
21
22
|
"npm-run-all": "^4.1.5",
|
|
22
|
-
"typescript": "^5.
|
|
23
|
+
"typescript": "^5.9.3"
|
|
23
24
|
},
|
|
24
25
|
"engines": {
|
|
25
26
|
"node": "*"
|
|
@@ -27,6 +28,9 @@
|
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "run-s build:*",
|
|
29
30
|
"build:clean": "del ./dist/*",
|
|
30
|
-
"build:compile": "tsc"
|
|
31
|
+
"build:compile": "tsc",
|
|
32
|
+
"release": "run-s release:*",
|
|
33
|
+
"release:build": "run-s build",
|
|
34
|
+
"release:commit": "commit-and-tag-version"
|
|
31
35
|
}
|
|
32
36
|
}
|