Title: Unexpected behavior when static methods are used in an array · Issue #41977 · microsoft/TypeScript · GitHub
Open Graph Title: Unexpected behavior when static methods are used in an array · Issue #41977 · microsoft/TypeScript
X Title: Unexpected behavior when static methods are used in an array · Issue #41977 · microsoft/TypeScript
Description: TypeScript Version: 4.2.0-dev.20201211 (also tested with 4.2.0) Search Terms: static method(s) Code class S { static f(a: number|string): void {} } function g(a: number): void {} // Uncomment to see a different behavior of the `output` c...
Open Graph Description: TypeScript Version: 4.2.0-dev.20201211 (also tested with 4.2.0) Search Terms: static method(s) Code class S { static f(a: number|string): void {} } function g(a: number): void {} // Uncomment to se...
X Description: TypeScript Version: 4.2.0-dev.20201211 (also tested with 4.2.0) Search Terms: static method(s) Code class S { static f(a: number|string): void {} } function g(a: number): void {} // Uncomment to se...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/41977
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unexpected behavior when static methods are used in an array","articleBody":"**TypeScript Version:** 4.2.0-dev.20201211 (also tested with 4.2.0)\r\n\r\n**Search Terms:** static method(s)\r\n\r\n**Code**\r\n\r\n```ts\r\nclass S {\r\n static f(a: number|string): void {}\r\n}\r\n\r\nfunction g(a: number): void {}\r\n\r\n// Uncomment to see a different behavior of the `output` const type.\r\n// type G = typeof g;\r\n\r\nconst y = [S.f, g];\r\nconst output: ((ctrl: number|string) => void)[] = y;\r\n```\r\n\r\n**Expected behavior:**\r\nConsistent type checking result (an error) for the `output` const with and without `type G = typeof g`.\r\n\r\n**Actual behavior:**\r\nIf the `type G = typeof g` is present, the error is thrown (as expected), otherwise there is no error thrown.\r\n\r\n**Playground Link:**\r\n[Playground link to reproduce the error.](https://www.typescriptlang.org/play?ts=4.2.0-dev.20201211#code/MYGwhgzhAEDK0G8BQ1oQC5nQS2NAZgBRgBc0AdgK4C2ARgKYBOAPho9uQOYCUZAbgHtsAE0QBfJBKT5K5YDgHlonYmSp0mvaIJHikSAPQHoAVTkDq1euXTR0AtPXrQw0Ydnz4m12wwAWYHzYAozQAvh2fs4ABgKU6AAO8dHQwIoYdgCeCfQAdIbG6NnOAOLQALxZOeHKANz6aeQZmRXQANqwufgANMoAuvWNGXGJ8WSEhPKMIGo0DCxsHDwVAHzaQsLcbX2tmbVAA)\r\n\r\n// cc @alxhub @rkirov ","author":{"url":"https://github.com/AndrewKushnir","@type":"Person","name":"AndrewKushnir"},"datePublished":"2020-12-15T21:10:30Z","url":"https://github.com/microsoft/TypeScript/issues/41977"}
| 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:12dbf717-72f2-1825-ed91-c13453725347 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E18:16EED3:A94396:D86011:6B00F5B3 |
| html-safe-nonce | cb3ade551413b5b734e736eaaa532b27efe1a253c8a4e4e02a9cc0f56b271eb7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTE4OjE2RUVEMzpBOTQzOTY6RDg2MDExOjZCMDBGNUIzIiwidmlzaXRvcl9pZCI6IjYzOTQwMDE4NTA2ODA1Mzg1NDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3f881322e7f1de4b98a938cbdb5b43a8e55f637fa8adff9f58532d108f514386 |
| hovercard-subject-tag | issue:768206660 |
| 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/41977/issue_layout |
| twitter:image | https://opengraph.githubassets.com/098f9a611a1917243d6cced61f6aef89e9dbad1b2060f9f14602b8703dadd5b4/microsoft/TypeScript/issues/41977 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/098f9a611a1917243d6cced61f6aef89e9dbad1b2060f9f14602b8703dadd5b4/microsoft/TypeScript/issues/41977 |
| og:image:alt | TypeScript Version: 4.2.0-dev.20201211 (also tested with 4.2.0) Search Terms: static method(s) Code class S { static f(a: number|string): void {} } function g(a: number): void {} // Uncomment to se... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AndrewKushnir |
| 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