payload: {"action":"created","issue":{"url":"https://api.github.com/repos/microsoft/TypeScript/issues/12936","repository_url":"https://api.github.com/repos/microsoft/TypeScript","labels_url":"https://api.github.com/repos/microsoft/TypeScript/issues/12936/labels{/name}","comments_url":"https://api.github.com/repos/microsoft/TypeScript/issues/12936/comments","events_url":"https://api.github.com/repos/microsoft/TypeScript/issues/12936/events","html_url":"https://github.com/microsoft/TypeScript/issues/12936","id":195716702,"node_id":"MDU6SXNzdWUxOTU3MTY3MDI=","number":12936,"title":"Exact Types","user":{"login":"blakeembrey","id":1088987,"node_id":"MDQ6VXNlcjEwODg5ODc=","avatar_url":"https://avatars0.githubusercontent.com/u/1088987?v=4","gravatar_id":"","url":"https://api.github.com/users/blakeembrey","html_url":"https://github.com/blakeembrey","followers_url":"https://api.github.com/users/blakeembrey/followers","following_url":"https://api.github.com/users/blakeembrey/following{/other_user}","gists_url":"https://api.github.com/users/blakeembrey/gists{/gist_id}","starred_url":"https://api.github.com/users/blakeembrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blakeembrey/subscriptions","organizations_url":"https://api.github.com/users/blakeembrey/orgs","repos_url":"https://api.github.com/users/blakeembrey/repos","events_url":"https://api.github.com/users/blakeembrey/events{/privacy}","received_events_url":"https://api.github.com/users/blakeembrey/received_events","type":"User","site_admin":false},"labels":[{"id":373477802,"node_id":"MDU6TGFiZWwzNzM0Nzc4MDI=","url":"https://api.github.com/repos/microsoft/TypeScript/labels/Awaiting%20More%20Feedback","name":"Awaiting More Feedback","color":"556677","default":false},{"id":113971155,"node_id":"MDU6TGFiZWwxMTM5NzExNTU=","url":"https://api.github.com/repos/microsoft/TypeScript/labels/Suggestion","name":"Suggestion","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":125,"created_at":"2016-12-15T04:52:17Z","updated_at":"2019-08-08T07:17:09Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This is a proposal to enable a syntax for exact types. A similar feature can be seen in Flow (https://flowtype.org/docs/objects.html#exact-object-types), but I would like to propose it as a feature used for type literals and not interfaces. The specific syntax I'd propose using is the pipe (which almost mirrors the Flow implementation, but it should surround the type statement), as it's familiar as the mathematical absolute syntax.\r\n\r\n```ts\r\ninterface User {\r\n  username: string\r\n  email: string\r\n}\r\n\r\nconst user1: User = { username: 'x', email: 'y', foo: 'z' } //=> Currently errors when `foo` is unknown.\r\nconst user2: Exact<User> = { username: 'x', email: 'y', foo: 'z' } //=> Still errors with `foo` unknown.\r\n\r\n// Primary use-case is when you're creating a new type from expressions and you'd like the\r\n// language to support you in ensuring no new properties are accidentally being added.\r\n// Especially useful when the assigned together types may come from other parts of the application \r\n// and the result may be stored somewhere where extra fields are not useful.\r\n\r\nconst user3: User = Object.assign({ username: 'x' }, { email: 'y', foo: 'z' }) //=> Does not currently error.\r\nconst user4: Exact<User> = Object.assign({ username: 'x' }, { email: 'y', foo: 'z' }) //=> Will error as `foo` is unknown.\r\n```\r\n\r\nThis syntax change would be a new feature and affect new definition files being written if used as a parameter or exposed type. This syntax could be combined with other more complex types.\r\n\r\n```ts\r\ntype Foo = Exact<X> | Exact<Y>\r\n\r\ntype Bar = Exact<{ username: string }>\r\n\r\nfunction insertIntoDb (user: Exact<User>) {}\r\n```\r\n\r\nApologies in advance if this is a duplicate, I could not seem to find the right keywords to find any duplicates of this feature.\r\n\r\nEdit: This post was updated to use the preferred syntax proposal mentioned at https://github.com/Microsoft/TypeScript/issues/12936#issuecomment-267272371, which encompasses using a simpler syntax with a generic type to enable usage in expressions."},"comment":{"url":"https://api.github.com/repos/microsoft/TypeScript/issues/comments/519399073","html_url":"https://github.com/microsoft/TypeScript/issues/12936#issuecomment-519399073","issue_url":"https://api.github.com/repos/microsoft/TypeScript/issues/12936","id":519399073,"node_id":"MDEyOklzc3VlQ29tbWVudDUxOTM5OTA3Mw==","user":{"login":"mityok","id":2138624,"node_id":"MDQ6VXNlcjIxMzg2MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/2138624?v=4","gravatar_id":"","url":"https://api.github.com/users/mityok","html_url":"https://github.com/mityok","followers_url":"https://api.github.com/users/mityok/followers","following_url":"https://api.github.com/users/mityok/following{/other_user}","gists_url":"https://api.github.com/users/mityok/gists{/gist_id}","starred_url":"https://api.github.com/users/mityok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mityok/subscriptions","organizations_url":"https://api.github.com/users/mityok/orgs","repos_url":"https://api.github.com/users/mityok/repos","events_url":"https://api.github.com/users/mityok/events{/privacy}","received_events_url":"https://api.github.com/users/mityok/received_events","type":"User","site_admin":false},"created_at":"2019-08-08T07:17:09Z","updated_at":"2019-08-08T07:17:09Z","author_association":"NONE","body":"I'm not sure if it's exactly related, but i'd expect at least two errors in this case:\r\n[playground](https://www.typescriptlang.org/play/index.html#code/JYOwLgpgTgZghgYwgAgGIHt0G8CwAoZQ5OALmRAFcBbAI2nwF999kEAbOAZ0+QEERgVOG2S4CRZEIDWEAMroKIACYAKAJRkM2FhIlQIYClBCjSAVibiily-nZceAEXQBzZBAAekZT36DhYhLScgrK6oG6hPqGxqZkZgA0yDRkAORSqZYSNnboIJxgyErIALzkEADuyM4u6rn5hVKlRQB0wfKKqmotNADc+EA)\r\n![Screen Shot 2019-08-08 at 10 15 34](https://user-images.githubusercontent.com/2138624/62682731-899d6400-b9c5-11e9-946f-1e5a60f5c44a.png)\r\n"}}
other: {"actor":{"display_login":"mityok"}}