@endo/compartment-mapper
Version:
The compartment mapper assembles Node applications in a sandbox
80 lines (47 loc) • 2.19 kB
JavaScript
/**
* Helpers relevant to any TypeScript project.
*
* @module
*/
/** Any object. All objects. Not `null`, though. */
/**
* Matches any {@link
* https://developer.mozilla.org/en-US/docs/Glossary/Primitive primitive
* value}.
*/
/**
* Allows creating a union type by combining primitive types and literal types
* without sacrificing auto-completion in IDEs for the literal type part of the
* union.
*
* Currently, when a union type of a primitive type is combined with literal
* types, TypeScript loses all information about the combined literals. Thus,
* when such a type is used in an IDE with autocompletion, no suggestions are
* made for the declared literals.
*
* This type is a workaround for {@link
* https://github.com/Microsoft/TypeScript/issues/29729
* Microsoft/TypeScript#29729}. It will be removed as soon as it's not needed
* anymore.
* @see {@link https://www.npmjs.com/package/type-fest}
*/
/**
* Generic type guard function that checks if a value of type `T` is also of type `U`.
* @template T The type of the value to check.
* @template U The type that the value should be checked against.
*/
/**
* Helper type for a generic type guard used in an "extends" clause
*/
/**
* Infers the type that a type guard function checks for.
*
* @template T The type guard function type itself
* @returns The type that the guard checks for
*/
/**
* Converts a union type to an intersection type
*/
/**
* Makes a nicer tooltip for `T` in IDEs (most of the time).
*/