{"id":23263663,"url":"https://github.com/danielbayley/reliable-type","last_synced_at":"2026-05-17T19:33:39.949Z","repository":{"id":249852386,"uuid":"827573186","full_name":"danielbayley/reliable-type","owner":"danielbayley","description":"Reliable runtime type information.","archived":false,"fork":false,"pushed_at":"2026-05-01T14:43:36.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-01T15:10:23.999Z","etag":null,"topics":["npm","npm-module","npm-package","npmjs","runtime","runtime-typechecking","runtime-types","runtime-validation","type","typechecker","types","typescript"],"latest_commit_sha":null,"homepage":"https://npm.im/reliable-type","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielbayley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"danielbayley","polar":"danielbayley","open_collective":"danielbayley","thanks_dev":"danielbayley","issuehunt":"danielbayley","patreon":"danielbayley","liberapay":"danielbayley","ko_fi":"danielbayley","buy_me_a_coffee":"danielbayley","custom":["https://paypal.me/danieljbayley","https://algora.io/bounties/#:~:text=tip%20contributors","https://terminal.merit.systems/danielbayley/pay","https://docs.opire.dev/overview/commands#tip-a-user","https://blockchain.com/btc/address/37rdZq4muDVNJh6jCr4XDXf8X2EFKjL3QQ","https://blockchain.com/eth/address/0x4176e321cb17876c99cd2b8c95b151c3991f5b25"]}},"created_at":"2024-07-11T23:35:15.000Z","updated_at":"2026-05-01T14:43:40.000Z","dependencies_parsed_at":"2024-07-23T19:48:07.452Z","dependency_job_id":"f919e1c7-db36-4251-ab16-b53b6bf3f66c","html_url":"https://github.com/danielbayley/reliable-type","commit_stats":null,"previous_names":["danielbayley/reliable-type"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/danielbayley/reliable-type","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielbayley%2Freliable-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielbayley%2Freliable-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielbayley%2Freliable-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielbayley%2Freliable-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielbayley","download_url":"https://codeload.github.com/danielbayley/reliable-type/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielbayley%2Freliable-type/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33151770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["npm","npm-module","npm-package","npmjs","runtime","runtime-typechecking","runtime-types","runtime-validation","type","typechecker","types","typescript"],"created_at":"2024-12-19T14:19:40.842Z","updated_at":"2026-05-17T19:33:39.944Z","avatar_url":"https://github.com/danielbayley.png","language":"JavaScript","funding_links":["https://github.com/sponsors/danielbayley","https://polar.sh/danielbayley","https://opencollective.com/danielbayley","https://thanks.dev/danielbayley","https://issuehunt.io/r/danielbayley","https://patreon.com/danielbayley","https://liberapay.com/danielbayley","https://ko-fi.com/danielbayley","https://buymeacoffee.com/danielbayley","https://paypal.me/danieljbayley","https://algora.io/bounties/#:~:text=tip%20contributors","https://terminal.merit.systems/danielbayley/pay","https://docs.opire.dev/overview/commands#tip-a-user","https://blockchain.com/btc/address/37rdZq4muDVNJh6jCr4XDXf8X2EFKjL3QQ","https://blockchain.com/eth/address/0x4176e321cb17876c99cd2b8c95b151c3991f5b25"],"categories":[],"sub_categories":[],"readme":"Reliable [Type]\n===============\nReliable runtime [type] information.\n\n## Install\n~~~ sh\npnpm install reliable-type\n~~~\n\nExample\n-------\nThe provided `type` method is more reliable than some combination of [`typeof`]\nand [`instanceof`]. While the [`.constructor`] `Object` property is strong\n—and recommended, in absence of a dependency like this—it can technically be\nreassigned. It will always `return` the correct type as an informative,\nspecific Type or [`tag`] `String`. Extra [type]s are also available to `import`:\n~~~ js\nimport assert from \"node:assert/strict\"\nimport { type, types, tag, tags } from \"reliable-type\"\nimport { GeneratorFunction } from \"reliable-type/types\"\n\nfunction* generator() { yield * [1, 2, 3] }\n\nconst Type = type(generator)\nconst Tag  =  tag(generator)\n\nassert.equal(Type, GeneratorFunction)\nassert.equal(Tag, \"GeneratorFunction\")\n\nassert.equal(Type, types.GeneratorFunction)\nassert.equal(Tag,   tags.GeneratorFunction)\n~~~\n\n[Type]s\n---------------------------------------------------------------------------------------------------------\n| Expression                                  | [`type`][type]             | [`tag`]                    |\n|:--------------------------------------------|:---------------------------|:---------------------------|\n| `undefined`                                 | `undefined`                | `\"undefined\"`              |\n| `null`                                      | `null`                     | `\"null\"`                   |\n| `true`/`false`                              | `Boolean`                  | `\"Boolean\"`                |\n| `\"string\"`                                  | `String`                   | `\"String\"`                 |\n| `-0`/`1_000`/`0.1`                          | [`Number`]                 | `\"Number\"`                 | \n| [`0xAf`]/[`0o1`]/[`0b1`]                    | `Number`                   | `\"Number\"`                 |\n| [`3.1415e+1`]/[`Math.PI`][`Math`]           | `Number`                   | `\"Number\"`                 |\n| `2n^63n`                                    | [`BigInt`]                 | `\"BigInt\"`                 | \n| [`-`]`Infinity`                             | `Infinity`                 | `\"Infinity\"`               | \n| [`NaN`]                                     | `NaN`                      | `\"NaN\"`                    |\n| [`Math`]                                    | `Math`                     | `\"Math\"`                   |\n| `Symbol(\"*\")`                               | [`Symbol`]                 | `\"Symbol\"`                 |\n| `/.*/g`/`new RegExp(\".*\")`                  | `RegExp`                   | `\"RegExp\"`                 |\n| `new Error(\"message\")`                      | [`Error`]                  | `\"Error\"`                  |\n| `new EvalError(\"message\")`                  | [`EvalError`]              | `\"EvalError\"`              |\n| `new RangeError(\"message\")`                 | [`RangeError`]             | `\"RangeError\"`             |\n| `new ReferenceError(\"message\")`             | [`ReferenceError`]         | `\"ReferenceError\"`         |\n| `new SyntaxError(\"message\")`                | [`SyntaxError`]            | `\"SyntaxError\"`            |\n| `new TypeError(\"message\")`                  | [`TypeError`]              | `\"TypeError\"`              |\n| `new URIError(\"message\")`                   | [`URIError`]               | `\"URIError\"`               |\n| `new AggregateError(\"message\")`             | [`AggregateError`]         | `\"AggregateError\"`         |\n| `new Intl.Segmenter()`                      | [`Segmenter`]              | `\"Segmenter\"`              |\n| `new Date()`                                | [`Date`]                   | `\"Date\"`                   |\n| `new URL(\"https://github.com\")`             | `URL`                      | `\"URL\"`                    |\n| `fs.createReadStream(buffer)`               | [`ReadStream`]             | `\"ReadStream\"`             |\n| `fs.createWriteStream(\"/dev/null\")`         | [`WriteStream`]            | `\"WriteStream\"`            |\n| `const buffer = Buffer.from(\"data\")`        | [`Buffer`]                 | `\"Buffer\"`                 |\n| `new ArrayBuffer(1024)`                     | [`ArrayBuffer`]            | `\"ArrayBuffer\"`            |\n| `new Int8Array([-128, 127])                 | [`Int8Array`]              | `\"Int8Array\"`              |\n| `new Uint8Array([0, 255])`                  | [`Uint8Array`]             | `\"Uint8Array\"`             |\n| `new new Uint8ClampedArray([0, 255])`       | [`Uint8ClampedArray`]      | `\"Uint8ClampedArray\"`      |\n| `new Int16Array([-32768, 32767])`           | [`Int16Array`]             | `\"Int16Array\"`             |\n| `new Uint16Array([0, 65535])`               | [`Uint16Array`]            | `\"Uint16Array\"`            |\n| `new Int32Array([-2147483648, 2147483647])` | [`Int32Array`]             | `\"Int32Array\"`             |\n| `new Uint32Array([0, 4294967295])`          | [`Uint32Array`]            | `\"Uint32Array\"`            |\n| `new Float32Array([-3.4e38,  3.4e38])`      | [`Float32Array`]           | `\"Float32Array\"`           |\n| `new Float64Array([-1.8e308, 1.8e308])`     | [`Float64Array`]           | `\"Float64Array\"`           |\n| `new BigInt64Array([-2n^63n, 2n^63n])`      | [`BigInt64Array`]          | `\"BigInt64Array\"`          |\n| `new BigUint64Array([0n, 2n^63n])`          | [`BigUint64Array`]         | `\"BigUint64Array\"`         |\n| `[1 ,2 ,3]`/`Array.from(\"abc\")`             | `Array`                    | `\"Array\"`                  |\n| `new Set([1, 2, 3])`                        | [`Set`]                    | `\"Set\"`                    |\n| `new WeakSet()`                             | [`WeakSet`]                | `\"WeakSet\"`                |\n| `new WeakMap()`                             | [`WeakMap`]                | `\"WeakMap\"`                |\n| `const map = new Map().set(\"a\", 1)`         | [`Map`]                    | `\"Map\"`                    |\n| `map.entries()`                             | [`Iterator`]               | `\"Iterator\"`               |\n| `const object = { a: 1, b: 2 }`             | `Object`                   | `\"Object\"`                 |\n| `new Proxy(object, {})`                     | [`Proxy`]                  | `\"Proxy\"`                  |\n| `Proxy.revocable(object, {})`               | `Proxy`                    | `\"Proxy\"`                  |\n| `{ [Symbol.toStringTag]: \"tag\" }`           | `\"tag\"`                    | [`\"tag\"`][`tag`]           |\n| [`JSON`]                                    | `JSON`                     | `\"JSON\"`                   |\n| `function() { return arguments }(1, 2)`     | [`Arguments`]              | `\"Arguments\"`              |\n| `[].reduce`/`() =\u003e {}`                      | `Function`                 | `\"Function\"`               |\n| `async () =\u003e Promise.resolve(true)`         | [`AsyncFunction`]          | `\"AsyncFunction\"`          |\n| `Promise.resolve(true)`                     | [`Promise`]                | `\"Promise\"`                |\n| `function* generator() { yield * [1, 2] }`  | [`GeneratorFunction`]      | `\"GeneratorFunction\"`      |\n| `generator()`                               | [`Generator`]              | `\"Generator\"`              |\n| `async function* gen() { yield * [1, 2] }`  | [`AsyncGeneratorFunction`] | `\"AsyncGeneratorFunction\"` |\n| `gen()`                                     | [`AsyncGenerator`]         | `\"AsyncGenerator\"`         |\n| `new (class Class {})()`                    | `Class`                    | [`\"Class\"`]                |\n| `new (class Extended extends Class {})()`   | `ExtendedClass`            | [`\"ExtendedClass\"`]        |\n| `fs.opendir(dir)`                           | [`Dir`]                    | `\"Dir\"`                    |\n| `fs.readdir(dir, { withFileTypes: true })`  | [`Dirent`]                 | `\"Dirent\"`                 |\n\n### Aliases\n~~~ js\nimport { typeOf, toStringTag } from \"reliable-type\"\n~~~\n\nLicense\n-------\n[MIT] © [Daniel Bayley]\n\n[MIT]:                        LICENSE.md\n[Daniel Bayley]:              https://github.com/danielbayley\n\n[type]:                       https://developer.mozilla.org/docs/Web/JavaScript/Guide/Grammar_and_types#data_types\n[`typeof`]:                   https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/typeof\n[`instanceof`]:               https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/instanceof\n[`.constructor`]:             https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor\n\n[`Number`]:                   https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\n[`0xAf`]:                     https://developer.mozilla.org/docs/Web/JavaScript/Guide/Numbers_and_dates#hexadecimal_numbers\n[`0o1`]:                      https://developer.mozilla.org/docs/Web/JavaScript/Guide/Numbers_and_dates#octal_numbers\n[`0b1`]:                      https://developer.mozilla.org/docs/Web/JavaScript/Guide/Numbers_and_dates#binary_numbers\n[`3.1415e+1`]:                https://developer.mozilla.org/docs/Web/JavaScript/Guide/Numbers_and_dates#exponentiation\n[`BigInt`]:                   https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/BigInt\n[`NaN`]:                      https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/NaN\n[`Math`]:                     https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math\n\n[`Symbol`]:                   https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol\n[`tag`]:                      https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag\n[`JSON`]:                     https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON\n\n[`Error`]:                    https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error\n[`EvalError`]:                https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/EvalError\n[`RangeError`]:               https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RangeError\n[`ReferenceError`]:           https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError\n[`SyntaxError`]:              https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError\n[`TypeError`]:                https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError\n[`URIError`]:                 https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/URIError\n[`AggregateError`]:           https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AggregateError\n\n[`Segmenter`]:                https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter\n[`Date`]:                     https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date\n\n[`ReadStream`]:               https://nodejs.org/api/fs.html#class-fsreadstream\n[`WriteStream`]:              https://nodejs.org/api/fs.html#class-fswritestream\n\n[`Buffer`]:                   https://nodejs.org/api/buffer.html\n[`ArrayBuffer`]:              https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer\n[`Int8Array`]:                https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Int8Array\n[`Uint8Array`]:               https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array\n[`Uint8ClampedArray`]:        https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray\n[`Int16Array`]:               https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Int16Array\n[`Uint16Array`]:              https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array\n[`Int32Array`]:               https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Int32Array\n[`Uint32Array`]:              https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array\n[`Float32Array`]:             https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Float32Array\n[`Float64Array`]:             https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Float64Array\n[`BigInt64Array`]:            https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array\n[`BigUint64Array`]:           https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array\n\n[`Set`]:                      https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set\n[`WeakSet`]:                  https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakSet\n[`WeakMap`]:                  https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap\n[`Map`]:                      https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map\n[`Iterator`]:                 https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator\n[`Proxy`]:                    https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Proxy\n\n[`Arguments`]:                https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/arguments\n[`AsyncFunction`]:            https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function\n[`Promise`]:                  https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise\n[`GeneratorFunction`]:        https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function*\n[`Generator`]:                https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Generator\n[`AsyncGeneratorFunction`]:   https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncGeneratorFunction\n[`AsyncGenerator`]:           https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator\n\n[`\"Class\"`]:                  https://developer.mozilla.org/docs/Web/JavaScript/Reference/Classes\n[`\"ExtendedClass\"`]:          https://developer.mozilla.org/docs/Web/JavaScript/Reference/Classes/extends\n\n[`Dir`]:                      https://nodejs.org/api/fs.html#class-fsdir\n[`Dirent`]:                   https://nodejs.org/api/fs.html#class-fsdirent\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielbayley%2Freliable-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielbayley%2Freliable-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielbayley%2Freliable-type/lists"}