{"action":"created","issue":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/20717","repository_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped","labels_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/20717/labels{/name}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/20717/comments","events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/20717/events","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/20717","id":266803889,"number":20717,"title":"lodash: replace StringRepresentable with more specific types","user":{"login":"thorn0","id":94334,"avatar_url":"https://avatars0.githubusercontent.com/u/94334?v=4","gravatar_id":"","url":"https://api.github.com/users/thorn0","html_url":"https://github.com/thorn0","followers_url":"https://api.github.com/users/thorn0/followers","following_url":"https://api.github.com/users/thorn0/following{/other_user}","gists_url":"https://api.github.com/users/thorn0/gists{/gist_id}","starred_url":"https://api.github.com/users/thorn0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorn0/subscriptions","organizations_url":"https://api.github.com/users/thorn0/orgs","repos_url":"https://api.github.com/users/thorn0/repos","events_url":"https://api.github.com/users/thorn0/events{/privacy}","received_events_url":"https://api.github.com/users/thorn0/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":"2017-10-19T11:05:40Z","updated_at":"2017-10-23T20:44:17Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/20717","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/20717","diff_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/20717.diff","patch_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/20717.patch"},"body":"```ts\r\n    interface StringRepresentable {\r\n        toString(): string;\r\n    }\r\n```\r\nThis interface is used in many places throughout the type definitions, but I believe it's a mistake because almost any type (even `{}`) can be assigned to it for `toString` is a member of the `Object` interface. Effectively, `StringRepresentable` is an alias for `{}`.\r\n```ts\r\nvar a: StringRepresentable;\r\na = 222;\r\na = {};\r\na = Math;\r\n```\r\nNo errors. [playground](http://www.typescriptlang.org/play/#src=interface%20StringRepresentable%20%7B%0D%0A%20%20toString()%3A%20string%3B%0D%0A%7D%0D%0A%0D%0Avar%20a%3A%20StringRepresentable%3B%0D%0Aa%20%3D%20222%3B%0D%0Aa%20%3D%20%7B%7D%3B%0D%0Aa%20%3D%20Math%3B%20%0D%0A)\r\n\r\nWhy lose type checking for the sake of some rare use cases that can be fixed with an explicit `.toString()` call? For reference, look at `lib.d.ts` and functions like `parseInt` there. Also see Microsoft/TypeScript#15368 where @RyanCavanaugh wrote:\r\n\r\n> TypeScript generally warns on implicit conversions, e.g. calling Math.sign(\"hello world\") is an error even though the spec says \"hello world\" will be converted to a number automatically.\r\n\r\nThere must exist other issues discussing this. It's simply the first one that I found.\r\n\r\n`StringRepresentable` is chiefly used for property names, for which it's totally common to use numbers, so I replaced it with `string | number` where it made sense."},"comment":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/comments/338790753","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/20717#issuecomment-338790753","issue_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/20717","id":338790753,"user":{"login":"typescript-bot","id":23042052,"avatar_url":"https://avatars0.githubusercontent.com/u/23042052?v=4","gravatar_id":"","url":"https://api.github.com/users/typescript-bot","html_url":"https://github.com/typescript-bot","followers_url":"https://api.github.com/users/typescript-bot/followers","following_url":"https://api.github.com/users/typescript-bot/following{/other_user}","gists_url":"https://api.github.com/users/typescript-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/typescript-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/typescript-bot/subscriptions","organizations_url":"https://api.github.com/users/typescript-bot/orgs","repos_url":"https://api.github.com/users/typescript-bot/repos","events_url":"https://api.github.com/users/typescript-bot/events{/privacy}","received_events_url":"https://api.github.com/users/typescript-bot/received_events","type":"User","site_admin":false},"created_at":"2017-10-23T20:44:16Z","updated_at":"2017-10-23T20:44:16Z","author_association":"NONE","body":"<!--header {\"slug\":\"reviewPing-e9d46c9dce183ebbcff6a7e3eec6ab9c\"} headerend-->\r\n@aj-r - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate?\r\n<!--footer bot @ 2017-10-23 20:44:17 footerend-->"}}
{"actor":{"display_login":"typescript-bot"}}