Title: function object parameter destructure field without default value will be ignored · Issue #59920 · microsoft/TypeScript · GitHub
Open Graph Title: function object parameter destructure field without default value will be ignored · Issue #59920 · microsoft/TypeScript
X Title: function object parameter destructure field without default value will be ignored · Issue #59920 · microsoft/TypeScript
Description: 🔎 Search Terms js, function, parameter, destructure, required 🕗 Version & Regression Information This changed between versions 5.6 and latest nightly We use ts 5.5 no this issue, after upgrade this issue occur. ⏯ Playground Link ts playg...
Open Graph Description: 🔎 Search Terms js, function, parameter, destructure, required 🕗 Version & Regression Information This changed between versions 5.6 and latest nightly We use ts 5.5 no this issue, after upgrade this...
X Description: 🔎 Search Terms js, function, parameter, destructure, required 🕗 Version & Regression Information This changed between versions 5.6 and latest nightly We use ts 5.5 no this issue, after upgrade ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/59920
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"function object parameter destructure field without default value will be ignored","articleBody":"### 🔎 Search Terms\r\n\r\njs, function, parameter, destructure, required\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 5.6 and latest nightly\r\n- We use ts 5.5 no this issue, after upgrade this issue occur.\r\n\r\n### ⏯ Playground Link\r\n\r\n- [ts playground](https://www.typescriptlang.org/dev/bug-workbench/?allowJs=true&ts=5.7.0-dev.20240904#code/PTAEAEEMBtoewO4CkDOAuUAXATgVwKYBQhIEAZgJbT4B2kAtvhrplSgHQBWKx+AHgAc42TKADGcGilEBzfJgCqKfNgAK2OJWoAhAJ5KVdRqAC8oABQBvQqFC5l2I-gA0N0AgqYAFgFF6kKlNQMhhlV1sPbwA5OFZKMUhWSQBleVYaGRQgkOgwwgBfIMt8gEpTAD5Qa1tseVxHKvyAbgKWkjBwLVoGJlB-Chp2TB5CCnohESrQOUUHdU0qfD0DRx7QQrINelAAcnZgFjYdtpmV+a7lhycrN3tDHowd6F0d11KmoA)\r\n- [stackblitz](https://stackblitz.com/edit/vitejs-vite-usm5mx\r\n)\r\n### 💻 Code\r\n\r\n```js\r\n// utils.js\r\n\r\nexport const getUserProfileByUsername = ({\r\n username,\r\n withEmail = false,\r\n withNotificationSettings = false,\r\n} = {}) => {\r\n return {};\r\n};\r\n```\r\n\r\n```ts\r\n// main.ts\r\nimport { getUserProfileByUsername } from './utils';\r\n\r\ngetUserProfileByUsername({\r\n username: 'ly',\r\n});\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\n```node\r\nsrc/main.ts:4:3 - error TS2353: Object literal may only specify known properties, and 'username' does not exist in type '{ withEmail?: boolean | undefined; withNotificationSettings?: boolean | undefined; }'.\r\n\r\n4 username: 'ly',\r\n ~~~~~~~~\r\n\r\n\r\nFound 1 error in src/main.ts:4\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\nno ts validate error\r\n\r\n### Additional information about the issue\r\n\r\nts 5.x not this issue, must be introduced by 5.6","author":{"url":"https://github.com/tjx666","@type":"Person","name":"tjx666"},"datePublished":"2024-09-10T04:18:56Z","url":"https://github.com/microsoft/TypeScript/issues/59920"}
| 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:2173cd83-0e99-bbad-df16-74cedb2b2eec |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 873E:21AC3F:EC786B:12E3D58:6B00F615 |
| html-safe-nonce | 3197417f12733c90817e3322ea2e7ef80d8bdad9f3659b4ca991c28724fecf63 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzNFOjIxQUMzRjpFQzc4NkI6MTJFM0Q1ODo2QjAwRjYxNSIsInZpc2l0b3JfaWQiOiIzNTE1Njk4NzI2NjQ1NTkzNjIxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1315e47f5ca3d898fb0bc7046eaa8fd0a6e5dfba5e7ecfd519072602d0219726 |
| hovercard-subject-tag | issue:2515360951 |
| 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/59920/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cfc8b8c6f97c290f0d886ec71565fcf617c2bf718e2aabcccd84b506ca29a3ba/microsoft/TypeScript/issues/59920 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cfc8b8c6f97c290f0d886ec71565fcf617c2bf718e2aabcccd84b506ca29a3ba/microsoft/TypeScript/issues/59920 |
| og:image:alt | 🔎 Search Terms js, function, parameter, destructure, required 🕗 Version & Regression Information This changed between versions 5.6 and latest nightly We use ts 5.5 no this issue, after upgrade this... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tjx666 |
| 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