@shakerquiz/utilities 0.2.2 → 0.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shakerquiz/utilities",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "author": "yurkimus <yurkimus@gmail.com>",
5
5
  "license": "ISC",
6
6
  "exports": {
@@ -62,3 +62,7 @@ export let FeatureUrls: Map<
62
62
  keyof typeof Features,
63
63
  Map<keyof typeof Networks, (options: URLOptions) => URL>
64
64
  >
65
+
66
+ type Features = typeof Features
67
+
68
+ type FeaturesUnion = Features[keyof Features]
@@ -37,3 +37,7 @@ export let RoleGameStatuses: {
37
37
 
38
38
  [Roles.Default]: []
39
39
  }
40
+
41
+ type GameStatuses = typeof GameStatuses
42
+
43
+ type GameStatusesUnion = GameStatuses[keyof GameStatuses]
@@ -5,3 +5,7 @@ export let Phases: {
5
5
  Loaded: 'Loaded'
6
6
  Loading: 'Loading'
7
7
  }
8
+
9
+ type Phases = typeof Phases
10
+
11
+ type PhasesUnion = keyof Phases
@@ -3,3 +3,7 @@ export let Roles: {
3
3
  Organizer: 'organizer'
4
4
  Default: 'default'
5
5
  }
6
+
7
+ type Roles = typeof Roles
8
+
9
+ type RolesUnion = Roles[keyof Roles]
@@ -1,6 +1,6 @@
1
1
  import { URLOptions } from '@yurkimus/url'
2
2
 
3
- import { Roles } from 'source/enumerations/roles'
3
+ import type { Roles, RolesUnion } from 'source/enumerations/roles'
4
4
  import { Features } from '../enumerations/features'
5
5
  import { Methods } from '../enumerations/methods'
6
6
  import { Networks } from '../enumerations/networks'
@@ -441,7 +441,7 @@ export let useRequest: <
441
441
  feature: Feature,
442
442
  method: Method,
443
443
  network: Network,
444
- ) => <Role extends typeof Roles[keyof typeof Roles] = typeof Roles.Default>(
444
+ ) => <Role extends Roles[RolesUnion] = Roles['Default']>(
445
445
  options: URLOptions,
446
446
  init: RequestInit,
447
447
  ) => Promise<RequestResults[Feature][Method][Role]>
@@ -4,6 +4,8 @@
4
4
 
5
5
  type Nullable<Type> = Type | null
6
6
 
7
+ type Optional<Type> = Type | null | undefined
8
+
7
9
  /**
8
10
  * Mixins
9
11
  */
@@ -11,4 +13,13 @@ type Nullable<Type> = Type | null
11
13
  interface RequestInit {
12
14
  /** A string to declaratively set the Authorization header. */
13
15
  cookie?: string
14
- }
16
+ }
17
+
18
+ /**
19
+ * React
20
+ */
21
+
22
+ type UseState<Type> = [
23
+ Type,
24
+ import('react').Dispatch<import('react').SetStateAction<Type>>,
25
+ ]