{"id":16015684,"url":"https://github.com/detachhead/typed-nodejs-assert","last_synced_at":"2026-04-30T10:31:16.141Z","repository":{"id":55080777,"uuid":"327579689","full_name":"DetachHead/typed-nodejs-assert","owner":"DetachHead","description":"various fixes for nodeJS assertions in typescript.","archived":false,"fork":false,"pushed_at":"2021-11-24T15:03:54.000Z","size":359,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-21T00:08:19.089Z","etag":null,"topics":["assertions","espower","hacktoberfest","nodejs","power-assert","typed-nodejs-assert","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DetachHead.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-07T10:35:43.000Z","updated_at":"2021-11-24T15:03:57.000Z","dependencies_parsed_at":"2022-08-14T11:21:02.157Z","dependency_job_id":null,"html_url":"https://github.com/DetachHead/typed-nodejs-assert","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DetachHead%2Ftyped-nodejs-assert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DetachHead%2Ftyped-nodejs-assert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DetachHead%2Ftyped-nodejs-assert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DetachHead%2Ftyped-nodejs-assert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DetachHead","download_url":"https://codeload.github.com/DetachHead/typed-nodejs-assert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247281606,"owners_count":20913201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["assertions","espower","hacktoberfest","nodejs","power-assert","typed-nodejs-assert","typescript"],"created_at":"2024-10-08T15:41:59.132Z","updated_at":"2026-04-30T10:31:16.115Z","avatar_url":"https://github.com/DetachHead.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# typed nodejs assert\nvarious fixes for nodeJS assertions in typescript.\n\n[![npm](https://img.shields.io/npm/v/typed-nodejs-assert)](https://www.npmjs.com/package/typed-nodejs-assert)\n## what it do\nthis packages fixes the following issues:\n- the typescript definitions for the default assertion library in nodeJS\n  [do not properly check the types of expected/actual values](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50274),\n  leading to assertion errors that could\neasily be caught by the compiler.\n  \n  for example. in the current type definitions, the following error would not occur:\n  ```ts\n  type Foo = {\n      bar: number\n  }\n  const foo: Foo = {\n      bar: 1\n  }\n  //@ts-expect-error TS2345: Argument of type '{}' is not assignable to parameter of type 'Foo'. Property 'bar' is missing in type '{}' but required in type 'Foo'\n  assert.deepStrictEqual(foo, {})\n  ```\n- [power-assert](https://npmjs.org/power-assert) can only be imported using commonJS syntax\n  (ie. `const assert = require('power-assert')`), meaning it's treated as `any` by the compiler in many cases\n\n## how to use\n### normally\n```ts\nimport assert from 'typed-nodejs-assert'\n```\n### with [power-assert](https://npmjs.org/power-assert)\nsince power-assert has to be imported using commonJS syntax, you have to import it as such, then give it the `PowerAsssert`\ntype from this package.\n\n```ts\nimport { PowerAssert } from 'typed-nodejs-assert'\nconst assert: PowerAssert = require('power-assert')\n```\n**IMPORTANT:** you have to explicitly specify the type as shown above.\nthe following will **not work**:\n```ts\nconst assert = require('power-assert') as PowerAssert\n```\nsee [this issue](https://github.com/microsoft/TypeScript/issues/34596#issuecomment-691574987) for more info\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetachhead%2Ftyped-nodejs-assert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdetachhead%2Ftyped-nodejs-assert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetachhead%2Ftyped-nodejs-assert/lists"}