Title: Crash in writeType when getting codefixes for invalid code · Issue #20542 · microsoft/TypeScript · GitHub
Open Graph Title: Crash in writeType when getting codefixes for invalid code · Issue #20542 · microsoft/TypeScript
X Title: Crash in writeType when getting codefixes for invalid code · Issue #20542 · microsoft/TypeScript
Description: Fourslash test: ///
Open Graph Description: Fourslash test: ///
X Description: Fourslash test: /// <reference path="fourslash.ts" /> // @noImplicitAny: true //// function f(y, z = { p: y[ verify.not.codeFixAvailable([]); Stack trace: TypeError: Cannot read pro...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/20542
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash in writeType when getting codefixes for invalid code","articleBody":"Fourslash test:\r\n```ts\r\n/// \u003creference path=\"fourslash.ts\" />\r\n\r\n// @noImplicitAny: true\r\n//// function f(y, z = { p: y[\r\n\r\nverify.not.codeFixAvailable([]);\r\n```\r\n\r\nStack trace:\r\n```\r\n TypeError: Cannot read property 'flags' of undefined\r\n at writeType (src\\compiler\\checker.ts:3321:29)\r\n at buildTypeDisplay (src\\compiler\\checker.ts:3316:24)\r\n at buildIndexSignatureDisplay (src\\compiler\\checker.ts:3940:21)\r\n at writeObjectLiteralType (src\\compiler\\checker.ts:3664:21)\r\n at writeLiteralType (src\\compiler\\checker.ts:3647:21)\r\n at writeAnonymousType (src\\compiler\\checker.ts:3542:25)\r\n at writeType (src\\compiler\\checker.ts:3359:25)\r\n at Object.buildTypeDisplay (src\\compiler\\checker.ts:3316:24)\r\n at typeToString (src\\services\\codefixes\\inferFromUsage.ts:268:47)\r\n at src\\services\\codefixes\\inferFromUsage.ts:136:40\r\n at Object.zipWith (src\\compiler\\core.ts:220:25)\r\n at getCodeActionForParameters (src\\services\\codefixes\\inferFromUsage.ts:134:47)\r\n at Object.getActionsForAddExplicitTypeAnnotation [as getCodeActions] (src\\services\\codefixes\\inferFromUsage.ts:71:24)\r\n at src\\services\\codeFixProvider.ts:40:35\r\n at Object.forEach (src\\compiler\\core.ts:174:32)\r\n at Object.getFixes (src\\services\\codeFixProvider.ts:39:13)\r\n at src\\services\\services.ts:1893:32\r\n at Object.flatMap (src\\compiler\\core.ts:463:27)\r\n at Object.getCodeFixesAtPosition (src\\services\\services.ts:1891:20)\r\n at Object.proxy.(anonymous function) [as getCodeFixesAtPosition] (src\\harness\\fourslash.ts:397:66)\r\n at src\\harness\\fourslash.ts:2499:45\r\n at Object.flatMap (src\\compiler\\core.ts:463:27)\r\n at TestState.getCodeFixActions (src\\harness\\fourslash.ts:2494:23)\r\n```","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2017-12-07T18:53:57Z","url":"https://github.com/microsoft/TypeScript/issues/20542"}
| 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:c76bcba5-fd17-1814-7630-3e844947de2c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9C6:26ECEB:31E0E59:3F6DE34:6B01BD64 |
| html-safe-nonce | 57b243142c1ad6ad6d3eaee283a2e5ea45097bf928451ded881ced6c99fa7646 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUM2OjI2RUNFQjozMUUwRTU5OjNGNkRFMzQ6NkIwMUJENjQiLCJ2aXNpdG9yX2lkIjoiNDcxNDI2ODI5NDcyNTYxNDk0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 58d91449c15adfcc143c9347e405db0ebb538db84efc5ee1b13c33d0ccd097bc |
| hovercard-subject-tag | issue:280239354 |
| 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/20542/issue_layout |
| twitter:image | https://opengraph.githubassets.com/93c0afcffedae682a2dd4ee560463fa3bdc83e94278b8856197cb4355c60cc8a/microsoft/TypeScript/issues/20542 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/93c0afcffedae682a2dd4ee560463fa3bdc83e94278b8856197cb4355c60cc8a/microsoft/TypeScript/issues/20542 |
| og:image:alt | Fourslash test: /// |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RyanCavanaugh |
| 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 | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width