Package Exports
- as-safely
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (as-safely) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
as-safely
A library for safe type assertion in TypeScript.
Install
npm install as-safely
Quickstart
const str: string = asSafely('1' as unknown, isString);
// type assertion is succeeded.
const strOrUndefined: string | undefined = asSafely(undefined as unknown, [isString, isUndefined]);
// type assertion is succeeded.
const str: string = asSafely(1, isString);
// detect a compile error.
const str: string = asSafely(1 as unknown, isString);
// throw a runtime error.