{"action":"created","issue":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12771","repository_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped","labels_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12771/labels{/name}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12771/comments","events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12771/events","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12771","id":190204715,"number":12771,"title":"d3-quadtree definitions are too strict.","user":{"login":"JonnyBGod","id":405206,"avatar_url":"https://avatars.githubusercontent.com/u/405206?v=3","gravatar_id":"","url":"https://api.github.com/users/JonnyBGod","html_url":"https://github.com/JonnyBGod","followers_url":"https://api.github.com/users/JonnyBGod/followers","following_url":"https://api.github.com/users/JonnyBGod/following{/other_user}","gists_url":"https://api.github.com/users/JonnyBGod/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyBGod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyBGod/subscriptions","organizations_url":"https://api.github.com/users/JonnyBGod/orgs","repos_url":"https://api.github.com/users/JonnyBGod/repos","events_url":"https://api.github.com/users/JonnyBGod/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyBGod/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-18T00:27:32Z","updated_at":"2016-11-18T04:15:32Z","closed_at":null,"body":"- [ ] I tried using the latest `xxxx/xxxx.d.ts` file in this repo and had problems.\r\n- [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript\r\n- [ ] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/).  (Please ask any appropriate questions there).\r\n- [x] I want to talk about `d3-quadtree/index.d.ts`.\r\n  - The authors of that type definition are cc/ @tomwanzek @gustavderdrache @borisyankov\r\n\r\nThe definitions for d3-quadtree look too strict. Atm we have to pass a [number, number][] but in practice we really can pass an Array<any> and this way it would be more flexible.\r\n\r\nFollowing example works well but gives a bunch of definition errors:\r\n\r\n```\r\n      let tree = quadtree()\r\n        .x((e) => e.x)\r\n        .y((e) => e.y)\r\n        .addAll(this.service.getNodes());\r\n\r\n      let rb = 2 * 1 + 9;\r\n      let exists = false;\r\n\r\n      tree.visit((node, x1, y1, x2, y2) => {\r\n        if (node.data && (node.data.id !== d.id)) {\r\n          let x = d.x - node.data.x,\r\n            y = d.y - node.data.y,\r\n            l = Math.sqrt(x * x + y * y);\r\n\r\n          if (l < rb) {\r\n            l = (l - rb) / l * 0.5;\r\n            d.x -= x *= l;\r\n            d.y -= y *= l;\r\n            node.data.x += x;\r\n            node.data.y += y;\r\n          }\r\n\r\n          if (l < 30) {\r\n            this.service.state.links.forEach((link) => {\r\n              if (\r\n                link.source.index === i && link.target.index === node.data.index ||\r\n                link.target.index === i && link.source.index === node.data.index\r\n              ) {\r\n                exists = true;\r\n              }\r\n            });\r\n\r\n            if (!exists) {\r\n              this.service.createLink(d, { source: d.id, target: node.data.id });\r\n            }\r\n          }\r\n        }\r\n      });\r\n```\r\n\r\nerrors:\r\n\r\n```\r\n[default] .../map.directive.ts:355:21\r\n    Property 'x' does not exist on type '[number, number]'.\r\n[default] .../map.directive.ts:356:21\r\n    Property 'y' does not exist on type '[number, number]'.\r\n[default] .../map.directive.ts:357:17\r\n    Argument of type 'SimulationNodeDatum[]' is not assignable to parameter of type '[number, number][]'.\r\n  Type 'SimulationNodeDatum' is not assignable to type '[number, number]'.\r\n    Property '0' is missing in type 'SimulationNodeDatum'.\r\n[default] Checking finished with 3 errors\r\n```"},"comment":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/comments/261444940","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12771#issuecomment-261444940","issue_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12771","id":261444940,"user":{"login":"JonnyBGod","id":405206,"avatar_url":"https://avatars.githubusercontent.com/u/405206?v=3","gravatar_id":"","url":"https://api.github.com/users/JonnyBGod","html_url":"https://github.com/JonnyBGod","followers_url":"https://api.github.com/users/JonnyBGod/followers","following_url":"https://api.github.com/users/JonnyBGod/following{/other_user}","gists_url":"https://api.github.com/users/JonnyBGod/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyBGod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyBGod/subscriptions","organizations_url":"https://api.github.com/users/JonnyBGod/orgs","repos_url":"https://api.github.com/users/JonnyBGod/repos","events_url":"https://api.github.com/users/JonnyBGod/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyBGod/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T04:15:32Z","updated_at":"2016-11-18T04:15:32Z","body":"ok manages to remove all errors with:\r\n\r\n```\r\nlet tree = quadtree<SimulationNodeDatum>()\r\n        .x((e) => e.x)\r\n        .y((e) => e.y)\r\n        .addAll(this.mapService.getD3Nodes());\r\n\r\ntree.visit((node: any, x1, y1, x2, y2) => {...}\r\n```"}}
{"actor":{"display_login":"JonnyBGod"}}