@stackframe/stack-shared 2.8.2 → 2.8.3

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.
@@ -2,3 +2,20 @@ export type IsAny<T> = 0 extends (1 & T) ? true : false;
2
2
  export type isNullish<T> = T extends null | undefined ? true : false;
3
3
  export type NullishCoalesce<T, U> = T extends null | undefined ? U : T;
4
4
  export type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
5
+ /**
6
+ * A variation of TypeScript's conditionals with slightly different semantics. It is the perfect type for cases where:
7
+ *
8
+ * - If all possible values are contained in `Extends`, then it will be mapped to `Then`.
9
+ * - If all possible values are not contained in `Extends`, then it will be mapped to `Otherwise`.
10
+ * - If some possible values are contained in `Extends` and some are not, then it will be mapped to `Then | Otherwise`.
11
+ *
12
+ * This is different from TypeScript's built-in conditional types (`Value extends Extends ? Then : Otherwise`), which
13
+ * returns `Otherwise` for the third case (causing unsoundness in many real-world cases).
14
+ */
15
+ export type IfAndOnlyIf<Value, Extends, Then, Otherwise> = (Value extends Extends ? never : Otherwise) | (Value & Extends extends never ? never : Then);
16
+ /**
17
+ * Can be used to prettify a type in the IDE; for example, some complicated intersected types can be flattened into a single type.
18
+ */
19
+ export type PrettifyType<T> = {
20
+ [K in keyof T]: T[K];
21
+ } & {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackframe/stack-shared",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -45,6 +45,7 @@
45
45
  "@simplewebauthn/browser": "^11.0.0",
46
46
  "async-mutex": "^0.5.0",
47
47
  "bcrypt": "^5.1.1",
48
+ "crc": "^4.3.2",
48
49
  "elliptic": "^6.5.7",
49
50
  "ip-regex": "^5.0.0",
50
51
  "jose": "^5.2.2",