Title: Improve function argument type inference · Issue #11440 · microsoft/TypeScript · GitHub
Open Graph Title: Improve function argument type inference · Issue #11440 · microsoft/TypeScript
X Title: Improve function argument type inference · Issue #11440 · microsoft/TypeScript
Description: Consider the example: // module1.ts export function doOperation( options: string, callback: (argument: { prop1: number, prop2: string, prop3: SomeComplexInterface }) => any ) { // implementation is omitted } // module 2 import {doOperati...
Open Graph Description: Consider the example: // module1.ts export function doOperation( options: string, callback: (argument: { prop1: number, prop2: string, prop3: SomeComplexInterface }) => any ) { // implementation is...
X Description: Consider the example: // module1.ts export function doOperation( options: string, callback: (argument: { prop1: number, prop2: string, prop3: SomeComplexInterface }) => any ) { // implementation...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/11440
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve function argument type inference","articleBody":"Consider the example:\n\n``` ts\n// module1.ts\nexport function doOperation(\n options: string,\n callback: (argument: {\n prop1: number,\n prop2: string,\n prop3: SomeComplexInterface\n }) => any\n) {\n // implementation is omitted\n}\n\n// module 2\nimport {doOperation} from \"./module1\"\ndoOperation(\"options\", operationCallback);\nfunction operationCallback(argument) {\n // argument has implicit type 'any' here\n}\n```\n\nI suggest to improve type inference of `operationCallback`'s arguments in this way:\n1. If function don't has defined arguments\n2. Take first usage of that function\n3. Infer argument types from that usage\n\nWhat do you think about it?\n","author":{"url":"https://github.com/Strate","@type":"Person","name":"Strate"},"datePublished":"2016-10-07T09:51:37Z","url":"https://github.com/microsoft/TypeScript/issues/11440"}
| 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:0707bf9d-fac7-ef91-8fa1-51ca7288d2a9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E502:14ECB:929D54:BC620F:6B00EDB3 |
| html-safe-nonce | 6271bf36c106dcf83ff61308bcdfbbef8a641379fac6700f38bc14dcb92a42a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTAyOjE0RUNCOjkyOUQ1NDpCQzYyMEY6NkIwMEVEQjMiLCJ2aXNpdG9yX2lkIjoiMzI2MTU2NzI4MTI2Nzc5NzQyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6cb6078d5cac3c91f07cbca2d54e232623a2551c0ffdab41fca27c63c90bfbce |
| hovercard-subject-tag | issue:181627795 |
| 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/11440/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d5e3cbf269ab83ae177a01b8d798449f77ce29ca3dd1e3268ebcf14365150850/microsoft/TypeScript/issues/11440 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d5e3cbf269ab83ae177a01b8d798449f77ce29ca3dd1e3268ebcf14365150850/microsoft/TypeScript/issues/11440 |
| og:image:alt | Consider the example: // module1.ts export function doOperation( options: string, callback: (argument: { prop1: number, prop2: string, prop3: SomeComplexInterface }) => any ) { // implementation is... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Strate |
| 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