Title: Cannot return unique symbol · Issue #32242 · microsoft/TypeScript · GitHub
Open Graph Title: Cannot return unique symbol · Issue #32242 · microsoft/TypeScript
X Title: Cannot return unique symbol · Issue #32242 · microsoft/TypeScript
Description: TypeScript Version: 3.5.1 Search Terms: function, return type, unique symbol Code const a = Symbol(); const b = Symbol(); function identity
Open Graph Description: TypeScript Version: 3.5.1 Search Terms: function, return type, unique symbol Code const a = Symbol(); const b = Symbol(); function identity
X Description: TypeScript Version: 3.5.1 Search Terms: function, return type, unique symbol Code const a = Symbol(); const b = Symbol(); function identity<T> (t : T) : T { return t; } /** * Mouseover `ident...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32242
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot return unique symbol","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.5.1\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\n\r\nfunction, return type, unique symbol\r\n\r\n**Code**\r\n\r\n```ts\r\nconst a = Symbol();\r\nconst b = Symbol();\r\n\r\nfunction identity\u003cT> (t : T) : T {\r\n return t;\r\n}\r\n\r\n/**\r\n * Mouseover `identity(a)`,\r\n * Tooltip shows,\r\n * \r\n * ```\r\n * function identity\u003ctypeof a>(t: typeof a): typeof a\r\n * ```\r\n */\r\n/**\r\n * Expected : typeof a\r\n * \r\n * Actual : symbol\r\n */\r\nconst actual = identity(a);\r\n/**\r\n * Error\r\n * \r\n * Type 'symbol' is not assignable to type 'unique symbol'.\r\n */\r\nconst expectA : typeof a = actual;\r\n\r\n/////////////////////////////////////////////////\r\n\r\nfunction giveTypeOfA () : typeof a {\r\n return a;\r\n}\r\n\r\n/**\r\n * Expected : typeof a\r\n * \r\n * Actual : symbol\r\n */\r\nconst actual2 = giveTypeOfA();\r\n/**\r\n * Error\r\n * \r\n * Type 'symbol' is not assignable to type 'unique symbol'.\r\n */\r\nconst expectA2 : typeof a = actual2;\r\n\r\n```\r\n\r\n**Expected behavior:**\r\n\r\n`actual` and `actual2` should be `typeof a`\r\n\r\n**Actual behavior:**\r\n\r\n`actual` and `actual2` are `symbol`\r\n\r\n**Playground Link:** [Playground](http://www.typescriptlang.org/play/#code/MYewdgzgLgBAhjAvDAygTwLYCMQBsAUAlANwBQoksWSqmOBJppAZgK5jBQCW4MXAJgFMw3KGgA8AFQB8MfLABcMSYRhLJMAN6kYMAE6CorPWBhQyAXyYB6AFS2dtmAFkQrCIJAA3QXpgADAWFRNHw4Qn8AGkdlEDxuAAcYCAALEAB3CGiYJxj-fJi2Dm5eIJEuMXExBM9meGl5JWra+EImtBqQOrg8gpzrUjsHHJgAUQAPGs5BfjUzDpaekZiAQU5WOFxdOYg6PEcBimh4dc2aMpCwxiGY0b09ED0YmMkFmAByXew8d74IGDAIFgcAgEC4AHMwHAsLhBGYQPMah92FwAI6sOFfejvAB0B3I4GOgkmgk4KzmzS68BocFOuDIg2sTOZLNZbPZHM5zKYRU4PFM4K4PleNQA8sxyUQKQsqQhtLoDEYTPBLDZ7LcSdNZu1Ot1niM1kYzrolFj9v0CZQTkbcAAmGiC4ULcUrIhkG4jO4PJ7LEYiuGfPa4X5cf6A4GgiFQmFwqAI5rIsBojHJIO4-FHWDEqZQFb2nWLGl021kIA)\r\n\r\n**Related Issues:** \r\n\r\nThe very last comment of #24506 asks a question about intended behaviour but it goes unanswered.","author":{"url":"https://github.com/AnyhowStep","@type":"Person","name":"AnyhowStep"},"datePublished":"2019-07-03T21:43:43Z","url":"https://github.com/microsoft/TypeScript/issues/32242"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c1705942-f854-1a95-fa06-00b7729550a1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C772:38F59A:7A5EC3:A544BC:6B04A91A |
| html-safe-nonce | 5e2b3af1adbf12bf6927a83188f53f938926ff65d3beb2b4c3079a0e9340efc6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzcyOjM4RjU5QTo3QTVFQzM6QTU0NEJDOjZCMDRBOTFBIiwidmlzaXRvcl9pZCI6IjQ2NzI4MzMyNTkxNjI2MDk5NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 69ec607bbaaee7f34bf75f5f2c3d39e4966146b24d46f954b5f17294da58254e |
| hovercard-subject-tag | issue:463966419 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/32242/issue_layout |
| twitter:image | https://opengraph.githubassets.com/79503bbd9cbd894f7bab09480a4cc1139aacfd1a3adcbf5bcf1f63bd4ce47137/microsoft/TypeScript/issues/32242 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/79503bbd9cbd894f7bab09480a4cc1139aacfd1a3adcbf5bcf1f63bd4ce47137/microsoft/TypeScript/issues/32242 |
| og:image:alt | TypeScript Version: 3.5.1 Search Terms: function, return type, unique symbol Code const a = Symbol(); const b = Symbol(); function identity |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AnyhowStep |
| hostname | github.com |
| expected-hostname | github.com |
| None | 188497a0f45a7aa8f7c866faa1950d1a7f8d82b59416adf549b222ad1d1dd19b |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 557cfbac6cdb532730c95c90f2cefdc0c4128029 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width