UNPKG

834 BTypeScriptView Raw
1/**
2 Provide a type which is effectively a type-safe, non-interchangeable empty
3 object to use instead of `null` or `undefined`.
4
5 @module
6 */
7declare const Tag: unique symbol;
8/**
9 * Create a unique, nominalish type.
10 * @internal
11 */
12declare class _Unit {
13 private readonly [Tag];
14}
15/**
16 The `Unit` type exists for the cases where you want a type-safe equivalent of
17 `undefined` or `null`. It's a concrete instance, which won't blow up on you,
18 and you can safely use it with e.g. `Result` without being concerned that
19 you'll accidentally introduce `null` or `undefined` back into your
20 application.
21
22 Equivalent to `()` or "unit" in many functional or functional-influenced
23 languages.
24 */
25export declare const Unit: Unit;
26export interface Unit extends _Unit {
27}
28export default Unit;
29//# sourceMappingURL=unit.d.ts.map
\No newline at end of file