Title: A fix for array methods strangely breaks the compiler · Issue #36591 · microsoft/TypeScript · GitHub
Open Graph Title: A fix for array methods strangely breaks the compiler · Issue #36591 · microsoft/TypeScript
X Title: A fix for array methods strangely breaks the compiler · Issue #36591 · microsoft/TypeScript
Description: Although neither reduce nor reduceRight method doesn't directly relate to the errors, looks like the errors (which were not discovered by gulp runtests-parallel) are caused by a bug of the compiler. For instance, the following function s...
Open Graph Description: Although neither reduce nor reduceRight method doesn't directly relate to the errors, looks like the errors (which were not discovered by gulp runtests-parallel) are caused by a bug of the compiler...
X Description: Although neither reduce nor reduceRight method doesn't directly relate to the errors, looks like the errors (which were not discovered by gulp runtests-parallel) are caused by a bug of the comp...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/36591
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"A fix for array methods strangely breaks the compiler","articleBody":"Although neither reduce nor reduceRight method doesn't directly relate to the errors, looks like the errors (which were not discovered by `gulp runtests-parallel`) are caused by a bug of the compiler. For instance, the following function should return `Statement[]` when `nodes` is `MutableNodeArray\u003cStatement>`, but actually returns `Node[]`. This is strange.\r\n\r\n```ts\r\n export function visitNodes\u003cT extends Node>(nodes: NodeArray\u003cT> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray\u003cT>;\r\n```\r\n\r\nLooks like the errors indicate a bug of the compiler.\r\n\r\nThis issue is requested by @sandersn .\r\n\r\n\u003c!--\r\nPlease try to reproduce the issue with the latest published version. It may have already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n-->\r\n**TypeScript Version:** 3.7.x-dev.201xxxxx\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#36570\r\n\r\n**Expected behavior:**\r\npass\r\n**Actual behavior:**\r\n```\r\nsrc/services/codefixes/helpers.ts:127:45 - error TS2345: Argument of type 'NodeArray\u003cNode> | undefined' is not assignable to parameter of type 'NodeArray\u003cModifier> | undefined'.\r\n Type 'NodeArray\u003cNode>' is not assignable to type 'NodeArray\u003cModifier>'.\r\n Type 'Node' is not assignable to type 'Modifier'.\r\n Type 'Node' is not assignable to type 'Token\u003cSyntaxKind.StaticKeyword>'.\r\n Types of property 'kind' are incompatible.\r\n Type 'SyntaxKind' is not assignable to type 'SyntaxKind.StaticKeyword'.\r\n127 outputMethod(signature, getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), getSynthesizedDeepClone(name, /*includeTrivia*/ false));\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nsrc/services/refactors/extractSymbol.ts:1259:40 - error TS2345: Argument of type 'Node[]' is not assignable to parameter of type 'readonly Statement[]'.\r\n Property '_statementBrand' is missing in type 'Node' but required in type 'Statement'.\r\n1259 return { body: createBlock(rewrittenStatements, /*multiLine*/ true), returnValueProperty };\r\n ~~~~~~~~~~~~~~~~~~~\r\n built/local/compiler.d.ts:2048:9\r\n 2048 _statementBrand: any;\r\n ~~~~~~~~~~~~~~~\r\n '_statementBrand' is declared here.\r\n```\r\nhttps://travis-ci.org/microsoft/TypeScript/jobs/644727907#L419-L441\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","author":{"url":"https://github.com/falsandtru","@type":"Person","name":"falsandtru"},"datePublished":"2020-02-03T23:47:09Z","url":"https://github.com/microsoft/TypeScript/issues/36591"}
| 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:7f00d16f-9dcf-fa07-3a73-a493e01ef1b7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E04A:10D9F8:CD2C7E:1101F54:6B00F513 |
| html-safe-nonce | c2d7f0dec76fa3ec3aed417aba43920c933cad33b2e532bfb8c1639c9da6b28f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDRBOjEwRDlGODpDRDJDN0U6MTEwMUY1NDo2QjAwRjUxMyIsInZpc2l0b3JfaWQiOiIzMjA4NjYxNDI3NDM5MDcyNTMxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f63d7b6ab97367a6af623134f3d5ed04e008cc5eb72be3d6337359f4ed287cb4 |
| hovercard-subject-tag | issue:559402915 |
| 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/36591/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8f508741dc52de8f340dbab054094af1a2cb23d3c296b878efb885c556d2916/microsoft/TypeScript/issues/36591 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8f508741dc52de8f340dbab054094af1a2cb23d3c296b878efb885c556d2916/microsoft/TypeScript/issues/36591 |
| og:image:alt | Although neither reduce nor reduceRight method doesn't directly relate to the errors, looks like the errors (which were not discovered by gulp runtests-parallel) are caused by a bug of the compiler... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | falsandtru |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width