Title: Exclude type not preventing to pass "excluded" types · Issue #22822 · microsoft/TypeScript · GitHub
Open Graph Title: Exclude type not preventing to pass "excluded" types · Issue #22822 · microsoft/TypeScript
X Title: Exclude type not preventing to pass "excluded" types · Issue #22822 · microsoft/TypeScript
Description: TypeScript Version: 2.8.0-dev.20180322 Code I am experimenting with the Exclude type introduced here #21847. What I would like is to create a type that includes all strings except for "", I thought something like this would work: type No...
Open Graph Description: TypeScript Version: 2.8.0-dev.20180322 Code I am experimenting with the Exclude type introduced here #21847. What I would like is to create a type that includes all strings except for "", I thought...
X Description: TypeScript Version: 2.8.0-dev.20180322 Code I am experimenting with the Exclude type introduced here #21847. What I would like is to create a type that includes all strings except for "",...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/22822
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exclude type not preventing to pass \"excluded\" types","articleBody":"**TypeScript Version:** 2.8.0-dev.20180322\r\n\r\n**Code**\r\n\r\nI am experimenting with the `Exclude` type introduced here https://github.com/Microsoft/TypeScript/issues/21847.\r\n\r\nWhat I would like is to create a type that includes all strings except for \"\", I thought something like this would work:\r\n\r\n```TypeScript\r\ntype NonEmptyString = Exclude\u003cstring, \"\">;\r\nfunction test(s: NonEmptyString) {}\r\ntest(\"\");\r\n```\r\n\r\nso I was expecting an error, but no, it compiles fine. Also `test(\"a\");` compiles fine. I didn't get the reason why, I've asked on gitter and it looks like this code should give a compile error.\r\n\r\n**Expected behavior:** I think a compiler error should be shown, but I'm really new with TypeScript, so it might easily be an error on my side\r\n\r\n**Actual behavior:** No compiler error, both with `test(\"\")` and `test(\"a\")`","author":{"url":"https://github.com/lazywithclass","@type":"Person","name":"lazywithclass"},"datePublished":"2018-03-23T09:23:32Z","url":"https://github.com/microsoft/TypeScript/issues/22822"}
| 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:21b8cc70-4fa0-00b4-2045-4f1484866e1f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 93E4:A7C8F:A00613:CF43BF:6B00E169 |
| html-safe-nonce | 2a122e0370d217851c876cd02dc800c06c300205fedd070032db01dfbd4cb5a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5M0U0OkE3QzhGOkEwMDYxMzpDRjQzQkY6NkIwMEUxNjkiLCJ2aXNpdG9yX2lkIjoiMzA0ODU4NzI5MzU3NTYxMzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2da6e26b2213ccf1bb559ebcb0ab7084c17564732811121b678da3d6451bb01b |
| hovercard-subject-tag | issue:307954228 |
| 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/22822/issue_layout |
| twitter:image | https://opengraph.githubassets.com/52a9d900ea32476318f625a9ac8e735885bd0a3efa2f0e44283e811cb3148d41/microsoft/TypeScript/issues/22822 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/52a9d900ea32476318f625a9ac8e735885bd0a3efa2f0e44283e811cb3148d41/microsoft/TypeScript/issues/22822 |
| og:image:alt | TypeScript Version: 2.8.0-dev.20180322 Code I am experimenting with the Exclude type introduced here #21847. What I would like is to create a type that includes all strings except for "", I thought... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lazywithclass |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width