Title: Partial modules and output optimization · Issue #447 · microsoft/TypeScript · GitHub
Open Graph Title: Partial modules and output optimization · Issue #447 · microsoft/TypeScript
X Title: Partial modules and output optimization · Issue #447 · microsoft/TypeScript
Description: We have a typescript application and a use a file per class. There are lots of benefits to this the major one being source control conflict reduction. We compile our app using the --out compiler flag but I think there is room for some se...
Open Graph Description: We have a typescript application and a use a file per class. There are lots of benefits to this the major one being source control conflict reduction. We compile our app using the --out compiler fl...
X Description: We have a typescript application and a use a file per class. There are lots of benefits to this the major one being source control conflict reduction. We compile our app using the --out compiler fl...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/447
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Partial modules and output optimization","articleBody":"We have a typescript application and a use a file per class. There are lots of benefits to this the major one being source control conflict reduction. \n\nWe compile our app using the --out compiler flag but I think there is room for some serious optimization of the compilers output for modules. \n\nCurrently if you have two classes defined in separate files the compile generates the following JavaScript. \n\n``` javascript\nvar Example;\n(function (Example) {\n (function (Nested) {\n (function (Issue) {\n var bar = (function () {\n function bar() {\n }\n return bar;\n })();\n Issue.bar = bar;\n })(Nested.Issue || (Nested.Issue = {}));\n var Issue = Nested.Issue;\n })(Example.Nested || (Example.Nested = {}));\n var Nested = Example.Nested;\n})(Example || (Example = {}));\n\nvar Example;\n(function (Example) {\n (function (Nested) {\n (function (Issue) {\n var foo = (function () {\n function foo() {\n }\n return foo;\n })();\n Issue.foo = foo;\n })(Nested.Issue || (Nested.Issue = {}));\n var Issue = Nested.Issue;\n })(Example.Nested || (Example.Nested = {}));\n var Nested = Example.Nested;\n})(Example || (Example = {}));\n```\n\nI suggest a compiler flag that composes all classes/ functions etc under a single module declaration? So the output code would be like the example below. This would dramatically reduce the size of the JavaScript the compiler outputs. I estimate that our app which currently compiles to around 15,000 lines of probably be only be 2000 lines if this were available.\n\n``` javascript\nvar Example;\n(function (Example) {\n (function (Nested) {\n (function (Issue) {\n var bar = (function () {\n function bar() {\n }\n return bar;\n })();\n Issue.bar = bar;\n var foo = (function () {\n function foo() {\n }\n return foo;\n })();\n Issue.foo = foo;\n })(Nested.Issue || (Nested.Issue = {}));\n var Issue = Nested.Issue;\n })(Example.Nested || (Example.Nested = {}));\n var Nested = Example.Nested;\n})(Example || (Example = {}));\n```\n","author":{"url":"https://github.com/Davidhanson90","@type":"Person","name":"Davidhanson90"},"datePublished":"2014-08-13T16:42:17Z","url":"https://github.com/microsoft/TypeScript/issues/447"}
| 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:b344087b-fc3c-f301-09c5-0f8d4c5ca224 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A60A:33D24F:15BA1E:1CCC60:6B00C97D |
| html-safe-nonce | d8c304e268c4d2a7f04ceb60669a19f835cd336f8c7d26158952e4ddc2dcf42e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjBBOjMzRDI0RjoxNUJBMUU6MUNDQzYwOjZCMDBDOTdEIiwidmlzaXRvcl9pZCI6IjQ5ODAwNjIzNTQ0Mjg0NDcxMDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 206912aecd1a41cf030c46f1a6e024a54dc985620d6f2406b7ca0cea5829e565 |
| hovercard-subject-tag | issue:40173821 |
| 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/447/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bf090ab3abb67b58e3012698c0a7627596c287ea78e3633f158061523e046dd9/microsoft/TypeScript/issues/447 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bf090ab3abb67b58e3012698c0a7627596c287ea78e3633f158061523e046dd9/microsoft/TypeScript/issues/447 |
| og:image:alt | We have a typescript application and a use a file per class. There are lots of benefits to this the major one being source control conflict reduction. We compile our app using the --out compiler fl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Davidhanson90 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4 |
| 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 | ef013399cf0a3c324bea644a685d7c1e0f06b5b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width