@battis/typescript-tricks 0.7.4 → 0.7.5

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 CHANGED
@@ -1,4 +1,13 @@
1
- # @battis/typescript-tricks
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.5](https://github.com/battis/typescript-config/compare/typescript-tricks/0.7.4...typescript-tricks/0.7.5) (2025-11-11)
6
+
7
+
8
+ ### Features
9
+
10
+ * tjjfvi's OneOf type ([bf3a78d](https://github.com/battis/typescript-config/commit/bf3a78d834079029e2aa2da5313bc8387f1239c5))
2
11
 
3
12
  ## 0.7.4
4
13
 
@@ -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
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /** @see https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types#comment123255834_53229567 */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './Forms';
6
6
  export * from './JSONValue';
7
7
  export * from './MethodNames';
8
8
  export * from './Mixin';
9
+ export * from './OneOf';
9
10
  export * from './OptionalProperty';
10
11
  export * from './PropertyRequirements';
11
12
  export * from './Shorthand';
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.4",
3
+ "version": "0.7.5",
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.8",
19
+ "@tsconfig/recommended": "^1.0.10",
20
+ "commit-and-tag-version": "^12.6.0",
20
21
  "del-cli": "^6.0.0",
21
22
  "npm-run-all": "^4.1.5",
22
- "typescript": "^5.7.2"
23
+ "typescript": "^5.9.3"
23
24
  },
24
25
  "engines": {
25
26
  "node": "*"
@@ -27,6 +28,12 @@
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",
35
+ "release:main": "git push --follow-tags; git checkout main; git merge dev; git push",
36
+ "release:publish": "pnpm publish --access public",
37
+ "release:dev": "git checkout dev"
31
38
  }
32
39
  }