@stryke/types 0.7.3 → 0.8.0

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/dist/async.d.ts CHANGED
@@ -10,6 +10,18 @@ import type { FunctionLike, IsUnknown } from "./base";
10
10
  * ```
11
11
  */
12
12
  export type Awaitable<T> = T | PromiseLike<T>;
13
+ /**
14
+ * A type that can be either a value or a function that returns a value.
15
+ *
16
+ * @example
17
+ * ```
18
+ * import type {Resolvable} from 'type-fest';
19
+ *
20
+ * const foo: Resolvable<string> = 'bar';
21
+ * const bar: Resolvable<string> = () => 'baz';
22
+ * ```
23
+ */
24
+ export type Resolvable<T> = Awaitable<T> | (() => Awaitable<T>);
13
25
  /**
14
26
  * Create a function type with a return type of your choice and the same parameters as the given function type.
15
27
  *
package/dist/base.d.ts CHANGED
@@ -70,10 +70,30 @@ export type Any = boolean | number | bigint | string | null | undefined | void |
70
70
  * The valid types of the index for an `Indexable` type object
71
71
  */
72
72
  export type IndexType = string | number | symbol;
73
+ /**
74
+ * The declaration of a ***dictionary-type*** object with a specific type
75
+ *
76
+ * @see {@link Indexable}
77
+ * @see {@link IndexType}
78
+ * @see {@link Dictionary}
79
+ */
80
+ export type TypedIndexable<T> = Record<IndexType, T>;
73
81
  /**
74
82
  * The declaration of a ***dictionary-type*** object
83
+ *
84
+ * @see {@link TypedIndexable}
85
+ * @see {@link IndexType}
86
+ * @see {@link Dictionary}
87
+ */
88
+ export type Indexable = TypedIndexable<any>;
89
+ /**
90
+ * The declaration of a ***dictionary-type*** object with a specific type
91
+ *
92
+ * @see {@link Indexable}
93
+ * @see {@link IndexType}
94
+ * @see {@link TypedIndexable}
75
95
  */
76
- export type Indexable = Record<IndexType, any>;
96
+ export type Dictionary<T> = Record<string, T>;
77
97
  export declare const EMPTY_STRING = "";
78
98
  export declare const NEWLINE_STRING = "\r\n";
79
99
  export declare const EMPTY_OBJECT: {};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The `package.json` file is the only required file in a package. It must be located at the root of a package, and can contain the following fields.
3
3
  */
4
- export interface PackageJson {
4
+ export interface PackageJson extends Record<string, any> {
5
5
  /**
6
6
  * The name is what your thing is called.
7
7
  * Some rules:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/types",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "A package containing many base TypeScript type definitions that are shared across many projects.",
6
6
  "repository": {