Title: non-null assertion on TypeParameter changes `string | undefined` to `String` · Issue #21360 · microsoft/TypeScript · GitHub
Open Graph Title: non-null assertion on TypeParameter changes `string | undefined` to `String` · Issue #21360 · microsoft/TypeScript
X Title: non-null assertion on TypeParameter changes `string | undefined` to `String` · Issue #21360 · microsoft/TypeScript
Description: TypeScript Version: 2.7.0-dev.20180123 Search Terms: Code declare function foo(p: string): void; function fn
Open Graph Description: TypeScript Version: 2.7.0-dev.20180123 Search Terms: Code declare function foo(p: string): void; function fn
X Description: TypeScript Version: 2.7.0-dev.20180123 Search Terms: Code declare function foo(p: string): void; function fn<T extends string | undefined, U extends string>(one: T,two: U) { let three = Boole...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/21360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"non-null assertion on TypeParameter changes `string | undefined` to `String`","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨 -->\r\n\u003c!--\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.\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 CONTRIBUTING guidelines: https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n-->\r\n\r\n\u003c!-- If you have a QUESTION:\r\n THIS IS NOT A FORUM FOR QUESTIONS.\r\n Ask questions at http://stackoverflow.com/questions/tagged/typescript\r\n or https://gitter.im/Microsoft/TypeScript\r\n-->\r\n\r\n\u003c!-- If you have a SUGGESTION:\r\n Most suggestion reports are duplicates, please search extra hard before logging a new suggestion.\r\n See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md\r\n-->\r\n\r\n\u003c!-- If you have a BUG:\r\n Please 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:** 2.7.0-dev.20180123\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\n**Code**\r\n\r\n```ts\r\ndeclare function foo(p: string): void;\r\n\r\nfunction fn\u003cT extends string | undefined, U extends string>(one: T,two: U) {\r\n let three = Boolean() ? one : two;\r\n foo(one!);\r\n foo(two!);\r\n foo(three!); // error on this line\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\nNo type error.\r\n\r\n**Actual behavior:**\r\n```\r\nArgument of type 'string | String' is not assignable to parameter of type 'string'.\r\n Type 'String' is not assignable to type 'string'.\r\n 'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.\r\n```\r\n\r\nThis is caused by #20995. To be fair, without that change the above was not valid at all.\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior --> \r\n\r\n**Related Issues:**\r\nMaybe related to #21317","author":{"url":"https://github.com/ajafff","@type":"Person","name":"ajafff"},"datePublished":"2018-01-23T15:39:47Z","url":"https://github.com/microsoft/TypeScript/issues/21360"}
| 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:8f4a2ad4-eb47-d82e-000b-229438d78946 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A766:3A73AA:2A4894:354CE3:6B01009D |
| html-safe-nonce | 2387e17f460d098f6e605c26a56f5b5aeff383571a231f82072bcb7510db3851 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzY2OjNBNzNBQToyQTQ4OTQ6MzU0Q0UzOjZCMDEwMDlEIiwidmlzaXRvcl9pZCI6IjMxNTY0ODM1MTQ3MzI0NDU4NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3f8ebba788a46a6689f98e47970ecc886ef3224be8092f83a318ebb44f526534 |
| hovercard-subject-tag | issue:290883863 |
| 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/21360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1240cc5b2f7d930c157b717270441c5470c632d77e89dbad778048e824bcf4bf/microsoft/TypeScript/issues/21360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1240cc5b2f7d930c157b717270441c5470c632d77e89dbad778048e824bcf4bf/microsoft/TypeScript/issues/21360 |
| og:image:alt | TypeScript Version: 2.7.0-dev.20180123 Search Terms: Code declare function foo(p: string): void; function fn |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ajafff |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width