Title: error TS2339: Property 'length' does not exist on type 'never' · Issue #33138 · microsoft/TypeScript · GitHub
Open Graph Title: error TS2339: Property 'length' does not exist on type 'never' · Issue #33138 · microsoft/TypeScript
X Title: error TS2339: Property 'length' does not exist on type 'never' · Issue #33138 · microsoft/TypeScript
Description: TypeScript Version: 3.6.2 Search Terms: Code function getValue(): string { return '1'; } function isNumber(value: any): value is number { return typeof value === 'number' && !Number.isNaN(value) && Number.isFinite(value); } function main...
Open Graph Description: TypeScript Version: 3.6.2 Search Terms: Code function getValue(): string { return '1'; } function isNumber(value: any): value is number { return typeof value === 'number' && !Number.isNaN(value) &&...
X Description: TypeScript Version: 3.6.2 Search Terms: Code function getValue(): string { return '1'; } function isNumber(value: any): value is number { return typeof value === 'number' &&...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/33138
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"error TS2339: Property 'length' does not exist on type 'never'","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.6.2\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\nfunction getValue(): string {\r\n\treturn '1';\r\n}\r\n\r\nfunction isNumber(value: any): value is number {\r\n\treturn typeof value === 'number' && !Number.isNaN(value) && Number.isFinite(value);\r\n}\r\n\r\nfunction main() {\r\n\tlet value = getValue();\r\n\r\n\tif (isNumber(value) && value.length === 4) {\r\n\t\tvalue++;\r\n\t}\r\n}\r\n\r\nmain();\r\n```\r\n\r\n**Expected behavior:**\r\nThe compare in the line `if (isNumber(value) && value.length === 4)` in the above example would always fail but did compile without type error in TypeScript 3.5.3.\r\n\r\n**Actual behavior:**\r\nIn TypeScript 3.6.2 the line generates `error TS2339: Property 'length' does not exist on type 'never'` and I do not understand why this would be a type error?\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:** \u003c!-- Did you find other bugs that looked similar? -->\r\n\r\n\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/doberkofler","@type":"Person","name":"doberkofler"},"datePublished":"2019-08-29T15:18:10Z","url":"https://github.com/microsoft/TypeScript/issues/33138"}
| 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:0700c0d2-c2d0-2066-90c2-92bfb51fe846 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E5DE:D050D:ED534:13C81C:6B04E193 |
| html-safe-nonce | 8e6ed98d8c58d7680673b6228b3f4bcc98fd152748b8167ad9231b461a3430c9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNURFOkQwNTBEOkVENTM0OjEzQzgxQzo2QjA0RTE5MyIsInZpc2l0b3JfaWQiOiI1ODI1Njg2MDAxMzQzMDYyNDE5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 47a4006e65543e58ff0fa8c0d8899a073dca6067e38c59acd0c717b8e068b8c9 |
| hovercard-subject-tag | issue:487023596 |
| 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/33138/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6a749247b1e57d784c49c5d45391dfad71e72ad592e8a5e643ffdd0a2d561abd/microsoft/TypeScript/issues/33138 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6a749247b1e57d784c49c5d45391dfad71e72ad592e8a5e643ffdd0a2d561abd/microsoft/TypeScript/issues/33138 |
| og:image:alt | TypeScript Version: 3.6.2 Search Terms: Code function getValue(): string { return '1'; } function isNumber(value: any): value is number { return typeof value === 'number' && !Number.isNaN(value) &&... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | doberkofler |
| hostname | github.com |
| expected-hostname | github.com |
| None | 970f03f35f02bb123d2b6f1884601d89a570dc02e5ef9612b1b6ca5c033b1796 |
| 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 | ebcec4199c8521b643c068ef118a1ba9a43b678a |
| 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