Type guards and checks for JavaScript values, collected in one type namespace.
npm install @tsdotnet/typeimport { type } from '@tsdotnet/type';
declare const value: unknown;
if (type.isString(value)) value.toUpperCase(); // narrowed to string
type.isNumber(NaN); // true
type.isNumber(NaN, true); // false: NaN ignoredAlso isFunction, isObject, isIterable, hasMember and more, all as type guards.
ESM (import { type } from '@tsdotnet/type';) or CommonJS (const { type } = require('@tsdotnet/type');).
In a browser, without a bundler
<script src="https://cdn.jsdelivr.net/npm/@tsdotnet/type@1/dist/umd/type.min.js"></script>
<script>
const { type } = tsdotnet.type;
</script>