Title: Replacing object reference before exporting causing problems · Issue #4101 · microsoft/TypeScript · GitHub
Open Graph Title: Replacing object reference before exporting causing problems · Issue #4101 · microsoft/TypeScript
X Title: Replacing object reference before exporting causing problems · Issue #4101 · microsoft/TypeScript
Description: Hi, If I have the following typescript code: var obj = { someKey: 6 }; // For some reason I want to change the object obj = { someKey: 7 }; export {obj}; it compiles to: var obj = { someKey: 6 }; exports.obj = obj; obj = { someKey: 7 }; ...
Open Graph Description: Hi, If I have the following typescript code: var obj = { someKey: 6 }; // For some reason I want to change the object obj = { someKey: 7 }; export {obj}; it compiles to: var obj = { someKey: 6 }; e...
X Description: Hi, If I have the following typescript code: var obj = { someKey: 6 }; // For some reason I want to change the object obj = { someKey: 7 }; export {obj}; it compiles to: var obj = { someKey: 6 }; e...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/4101
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Replacing object reference before exporting causing problems","articleBody":"Hi,\n\nIf I have the following typescript code:\n\n``` javascript\nvar obj = {\n someKey: 6\n};\n\n// For some reason I want to change the object\nobj = {\n someKey: 7\n};\n\nexport {obj};\n```\n\nit compiles to:\n\n``` javascript\nvar obj = {\n someKey: 6\n};\nexports.obj = obj;\nobj = {\n someKey: 7\n};\n```\n\nSo if I importing the object I get:\n\n``` javascript\nimport {obj} from './some-file';\nconsole.log(obj.someKey === 6); // true\n```\n\nBut I was expecting `7`. I.e. I was expecting the following JS code:\n\n``` javascript\nvar obj = {\n someKey: 6\n};\nobj = {\n someKey: 7\n};\nexports.obj = obj;\n```\n\nIs this a bug or expected behavior?\n\nI am using version `1.6.0-dev.20150731` but it has the same behavior in `1.5.3`.\n","author":{"url":"https://github.com/tjoskar","@type":"Person","name":"tjoskar"},"datePublished":"2015-07-31T09:28:20Z","url":"https://github.com/microsoft/TypeScript/issues/4101"}
| 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:2cbafcfe-6e63-905d-effb-a186c2a75f76 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C474:CC1A4:216C95D:2A76EE4:6B017335 |
| html-safe-nonce | c33ac30f8347fa67a82c2f535dea55c2e0643c7df64b072bd8b86579b3e00b6a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDc0OkNDMUE0OjIxNkM5NUQ6MkE3NkVFNDo2QjAxNzMzNSIsInZpc2l0b3JfaWQiOiI1NTcwMjM5NTkxNTk3ODMwOTY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 06a50f83a28b127057a93e8ac7f85ea53032bded8c61c123c0560fda91b4bea2 |
| hovercard-subject-tag | issue:98352047 |
| 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/4101/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39cb76ad1cea970dd5472816b5334b5e67e7d3ebd5c1c3da8176423dd41e327b/microsoft/TypeScript/issues/4101 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39cb76ad1cea970dd5472816b5334b5e67e7d3ebd5c1c3da8176423dd41e327b/microsoft/TypeScript/issues/4101 |
| og:image:alt | Hi, If I have the following typescript code: var obj = { someKey: 6 }; // For some reason I want to change the object obj = { someKey: 7 }; export {obj}; it compiles to: var obj = { someKey: 6 }; e... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tjoskar |
| 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