Title: In JS, type annotations should not block errors from the rest of the program · Issue #23472 · microsoft/TypeScript · GitHub
Open Graph Title: In JS, type annotations should not block errors from the rest of the program · Issue #23472 · microsoft/TypeScript
X Title: In JS, type annotations should not block errors from the rest of the program · Issue #23472 · microsoft/TypeScript
Description: In a Javascript file that is checked by flow, we may see code like this (from create-react-app/packages/react-error-overlay/src/utils/parseCompileError.js) export type ErrorLocation = {| fileName: string, lineNumber: number, colNumber?: ...
Open Graph Description: In a Javascript file that is checked by flow, we may see code like this (from create-react-app/packages/react-error-overlay/src/utils/parseCompileError.js) export type ErrorLocation = {| fileName: ...
X Description: In a Javascript file that is checked by flow, we may see code like this (from create-react-app/packages/react-error-overlay/src/utils/parseCompileError.js) export type ErrorLocation = {| fileName: ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/23472
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"In JS, type annotations should not block errors from the rest of the program","articleBody":"In a Javascript file that is checked by flow, we may see code like this (from create-react-app/packages/react-error-overlay/src/utils/parseCompileError.js)\r\n```js\r\nexport type ErrorLocation = {|\r\n fileName: string,\r\n lineNumber: number,\r\n colNumber?: number,\r\n|}\r\nfunction parseCompileError(message: string): ?ErrorLocation {\r\n const lines: Array\u003cstring> = message.split('\\n');\r\n for (let i = 0; i \u003c lines.length; i++) {\r\n// ...................\r\n return fileName && lineNumber ? { fileName, lineNumber, colNumber } : null;\r\n}\r\n```\r\n\r\nThis behaves badly when the typescript compiler compiles it with checkJs on:\r\n\r\n**Expected behavior:**\r\n1. Errors on the type declaration and all the type annotations. \r\n2. However, ErrorLocation should be declared as a type alias, and message, lines, etc should all have their declared types. \r\n3. If they are used incorrectly, they should have errors.\r\n\r\n**Actual behavior:**\r\n1. Errors on the type declaration and all the type annotations.\r\n\r\nIn the language service:\r\n2. message, lines, etc have the correct types, **but ErrorLocation is type any**.\r\n3. If they are used incorrectly, they have errors.\r\n\r\nIn batch compilation:\r\n2. No errors show up except those from (1), even if there are lots of other javascript files without type annotations.\r\n","author":{"url":"https://github.com/sandersn","@type":"Person","name":"sandersn"},"datePublished":"2018-04-17T17:25:50Z","url":"https://github.com/microsoft/TypeScript/issues/23472"}
| 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:b655302e-ee9f-ba5b-3210-4593e47724e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D66C:1F2D:24A0692:2E6BF6A:6B01BD06 |
| html-safe-nonce | 881c67f11ca6658e11e57f5c147f22f62c1d4ba39eed2cdd24768de76293023c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjZDOjFGMkQ6MjRBMDY5MjoyRTZCRjZBOjZCMDFCRDA2IiwidmlzaXRvcl9pZCI6IjI0ODAxOTQxOTc2MTgwMTU0OTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fa6c1a28f38953cd3ad7b4d50c82dc8a95c8c03e5870d4a1eec2cb9714328d3c |
| hovercard-subject-tag | issue:315157569 |
| 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/23472/issue_layout |
| twitter:image | https://opengraph.githubassets.com/164282c7b64107ecf772a028b5b5756b607bbe190e06abacdab1a0db16d7cb95/microsoft/TypeScript/issues/23472 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/164282c7b64107ecf772a028b5b5756b607bbe190e06abacdab1a0db16d7cb95/microsoft/TypeScript/issues/23472 |
| og:image:alt | In a Javascript file that is checked by flow, we may see code like this (from create-react-app/packages/react-error-overlay/src/utils/parseCompileError.js) export type ErrorLocation = {| fileName: ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sandersn |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width