Title: Weak type detection only works with object literals being passed · Issue #17656 · microsoft/TypeScript · GitHub
Open Graph Title: Weak type detection only works with object literals being passed · Issue #17656 · microsoft/TypeScript
X Title: Weak type detection only works with object literals being passed · Issue #17656 · microsoft/TypeScript
Description: TypeScript Version: 2.4.0 Code interface ITest { optional?: string; } function test(param: ITest): void { } class Test { } test({ whatever: 0, optional: "" }); //<-- compiler doesn't allow this test(test); //<-- compiler allows this test...
Open Graph Description: TypeScript Version: 2.4.0 Code interface ITest { optional?: string; } function test(param: ITest): void { } class Test { } test({ whatever: 0, optional: "" }); //<-- compiler doesn't allow this tes...
X Description: TypeScript Version: 2.4.0 Code interface ITest { optional?: string; } function test(param: ITest): void { } class Test { } test({ whatever: 0, optional: "" }); //<-- compiler doesn'...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/17656
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Weak type detection only works with object literals being passed","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:** 2.4.0\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface ITest {\r\n optional?: string;\r\n}\r\n\r\nfunction test(param: ITest): void {\r\n\r\n}\r\n\r\nclass Test {\r\n\r\n}\r\n\r\ntest({ whatever: 0, optional: \"\" }); //\u003c-- compiler doesn't allow this\r\ntest(test); //\u003c-- compiler allows this\r\ntest(Test); //\u003c-- compiler allows this\r\ntest(new Test()); //\u003c-- compiler allows this\r\n```\r\n\r\n**Expected behavior:**\r\nPassing any object of any type that doesn't match with at least one of the properties defined in the weak type, should fail.\r\n\r\n**Actual behavior:**\r\nOnly object literals that don't at least partially match are not allowed to be passed.","author":{"url":"https://github.com/ownerer","@type":"Person","name":"ownerer"},"datePublished":"2017-08-07T11:52:49Z","url":"https://github.com/microsoft/TypeScript/issues/17656"}
| 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:e54c7153-3aa7-fe7f-3e0f-c10131ea3978 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BEAC:1CEA6F:26BF57:345BEC:6B00C151 |
| html-safe-nonce | c7f2a518c18b2c0d2ebb45be6b29680e727bd7e8818ff79082cb2b76426b6d90 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUFDOjFDRUE2RjoyNkJGNTc6MzQ1QkVDOjZCMDBDMTUxIiwidmlzaXRvcl9pZCI6IjY2ODQ0MzE3NDQwMDkwMjc5MjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | afa72d50c5ca5d090ba7f03936bdee267bc58ad679dba5085ae3ee0df7f42fc2 |
| hovercard-subject-tag | issue:248387469 |
| 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/17656/issue_layout |
| twitter:image | https://opengraph.githubassets.com/421022d62b401534bf2eed2fcbc9d2741fab0e09ab3d4b5b1a5076377daa57ad/microsoft/TypeScript/issues/17656 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/421022d62b401534bf2eed2fcbc9d2741fab0e09ab3d4b5b1a5076377daa57ad/microsoft/TypeScript/issues/17656 |
| og:image:alt | TypeScript Version: 2.4.0 Code interface ITest { optional?: string; } function test(param: ITest): void { } class Test { } test({ whatever: 0, optional: "" }); //<-- compiler doesn't allow this tes... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ownerer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 93edd3bebc4afb7ce711ee74cb5d2a95927850b082a4d43e212222389cb1c415 |
| 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 | 1fee81a280ea86312b69448e261b418189bfd5b5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width