Title: fourslash's verifyRangesAreRenamedLocations has nonsensical code · Issue #21283 · microsoft/TypeScript · GitHub
Open Graph Title: fourslash's verifyRangesAreRenamedLocations has nonsensical code · Issue #21283 · microsoft/TypeScript
X Title: fourslash's verifyRangesAreRenamedLocations has nonsensical code · Issue #21283 · microsoft/TypeScript
Description: public verifyRangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }) { const ranges = ts.isArray(options) ? options : options && options.ranges || this.getRanges(); this.verif...
Open Graph Description: public verifyRangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }) { const ranges = ts.isArray(options) ? options : options && option...
X Description: public verifyRangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }) { const ranges = ts.isArray(options) ? options : options &&...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/21283
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fourslash's verifyRangesAreRenamedLocations has nonsensical code","articleBody":"```ts\r\n public verifyRangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }) {\r\n const ranges = ts.isArray(options) ? options : options && options.ranges || this.getRanges();\r\n this.verifyRenameLocations(ranges, { ranges, ...options });\r\n }\r\n```\r\n\r\nWhen `options` is a `Range[]`, the object spread creates an object that is like an array, except without its methods, and with a property named `ranges` that is the array itself. This works fine because of the way that `verifyRenameLocations` uses `ts.isArray` (the spread object never is), but should probably be something more like:\r\n\r\n```ts\r\n const ranges = ts.isArray(options) ? options : options.ranges || this.getRanges();\r\n this.verifyRenameLocations(ranges, ts.isArray(options) ? options : { ranges, ...options });\r\n```\r\n\r\nFound while working on excess property checks, although this usage is not actually an error in the PR.","author":{"url":"https://github.com/sandersn","@type":"Person","name":"sandersn"},"datePublished":"2018-01-18T23:03:56Z","url":"https://github.com/microsoft/TypeScript/issues/21283"}
| 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:e4a445d3-4658-2cf4-f5f6-43663c29476c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A936:2564D8:AB9949:E484E1:6B00EB46 |
| html-safe-nonce | d7c965ad310218e7ae1aaabfb1286be04242d5f47fd110667c5156679b37030b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTM2OjI1NjREODpBQjk5NDk6RTQ4NEUxOjZCMDBFQjQ2IiwidmlzaXRvcl9pZCI6IjYwNDczMDgyNTg0MTM3MTk3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 293d597f96e277c0871b5e51828cab2bafc82662e4c51dc0e91b7d4b8267181b |
| hovercard-subject-tag | issue:289806848 |
| 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/21283/issue_layout |
| twitter:image | https://opengraph.githubassets.com/18d5763c177f3581e2f350ce337a96700bc1e2a7852b4e7e3103460f6bfa5399/microsoft/TypeScript/issues/21283 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/18d5763c177f3581e2f350ce337a96700bc1e2a7852b4e7e3103460f6bfa5399/microsoft/TypeScript/issues/21283 |
| og:image:alt | public verifyRangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }) { const ranges = ts.isArray(options) ? options : options && option... |
| 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 | 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