{"action":"created","issue":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/24082","repository_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped","labels_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/24082/labels{/name}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/24082/comments","events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/24082/events","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24082","id":302278013,"number":24082,"title":"[Jest]: Adding type support for matchers on primitive types.","user":{"login":"seivan","id":55424,"avatar_url":"https://avatars1.githubusercontent.com/u/55424?v=4","gravatar_id":"","url":"https://api.github.com/users/seivan","html_url":"https://github.com/seivan","followers_url":"https://api.github.com/users/seivan/followers","following_url":"https://api.github.com/users/seivan/following{/other_user}","gists_url":"https://api.github.com/users/seivan/gists{/gist_id}","starred_url":"https://api.github.com/users/seivan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seivan/subscriptions","organizations_url":"https://api.github.com/users/seivan/orgs","repos_url":"https://api.github.com/users/seivan/repos","events_url":"https://api.github.com/users/seivan/events{/privacy}","received_events_url":"https://api.github.com/users/seivan/received_events","type":"User","site_admin":false},"labels":[{"id":397523192,"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/labels/Awaiting%20reviewer%20feedback","name":"Awaiting reviewer feedback","color":"0052cc","default":false},{"id":684321576,"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/labels/Popular%20package","name":"Popular package","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-03-05T12:16:10Z","updated_at":"2018-03-08T17:36:14Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/24082","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24082","diff_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24082.diff","patch_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24082.patch"},"body":"- [x] Use a meaningful title for the pull request. Include the name of the package modified.\r\n- [x] Test the change in your own code. (Compile and run.)\r\n- [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).\r\n- [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).\r\n- [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present).\r\n\r\n- [x] Increase the version number in the header **if** appropriate.\r\n\r\n---\r\n\r\nPretty sure there is a better way of doing this, but this uses primitive Typescript types to select appropriate matchers. \r\n\r\n```typescript\r\ntest('testing boolean matchers', () => {\r\n    expect(false).toBeFalsy()\r\n    expect(true).not.toBeFalsy()\r\n    expect(false).toBe(false)\r\n    // expect(false).toBe(\"false\") // error \r\n\r\n})\r\n\r\ntest('testing string matchers', () => {\r\n    expect(\"false\").toBe(\"false\")\r\n    expect(\"false\").not.toBe(\"true\")\r\n    // expect(\"false\").toBe(1) // error \r\n    // expect(\"false\").toBe(1) // error \r\n})\r\n\r\ntest('testing number matchers', () => {\r\n    expect(1).toBe(1)\r\n    expect(1).not.toBe(2)\r\n    // expect(1).toBe(\"lol\") // error \r\n})\r\n\r\ntest('testing list matchers', () => {\r\n    expect([1, 2]).toEqual([1,2])\r\n    expect([1, 2, 3]).toContain(3)\r\n    //   expect([1,2,3]).toContain(\"3\") // error \r\n    expect([\"1\", \"2\"]).toEqual([\"1\", \"2\"])\r\n    expect([\"1\", \"2\", \"3\"]).toContain(\"1\")\r\n    // expect([\"1\"]).toContain(3) // error \r\n})\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/comments/371563082","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24082#issuecomment-371563082","issue_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/24082","id":371563082,"user":{"login":"nickmccurdy","id":927220,"avatar_url":"https://avatars0.githubusercontent.com/u/927220?v=4","gravatar_id":"","url":"https://api.github.com/users/nickmccurdy","html_url":"https://github.com/nickmccurdy","followers_url":"https://api.github.com/users/nickmccurdy/followers","following_url":"https://api.github.com/users/nickmccurdy/following{/other_user}","gists_url":"https://api.github.com/users/nickmccurdy/gists{/gist_id}","starred_url":"https://api.github.com/users/nickmccurdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickmccurdy/subscriptions","organizations_url":"https://api.github.com/users/nickmccurdy/orgs","repos_url":"https://api.github.com/users/nickmccurdy/repos","events_url":"https://api.github.com/users/nickmccurdy/events{/privacy}","received_events_url":"https://api.github.com/users/nickmccurdy/received_events","type":"User","site_admin":false},"created_at":"2018-03-08T17:36:14Z","updated_at":"2018-03-08T17:36:14Z","author_association":"NONE","body":"I believe the intention is to ensure that misuse of Jest matchers would cause type errors at build time instead of Jest errors at runtime for a better and more consistent development experience of Jest tests."}}
{"actor":{"display_login":"nickmccurdy"}}