Title: Better compile time polyfill support by splitting lib .d.ts files into smallest segments possible · Issue #25567 · microsoft/TypeScript · GitHub
Open Graph Title: Better compile time polyfill support by splitting lib .d.ts files into smallest segments possible · Issue #25567 · microsoft/TypeScript
X Title: Better compile time polyfill support by splitting lib .d.ts files into smallest segments possible · Issue #25567 · microsoft/TypeScript
Description: Search Terms lib, polyfill Suggestion Split the existing lib .d.ts files into smaller feature segments so each feature can be included selectively as desired. Use Cases I work at a company with a large collection of independently shippin...
Open Graph Description: Search Terms lib, polyfill Suggestion Split the existing lib .d.ts files into smaller feature segments so each feature can be included selectively as desired. Use Cases I work at a company with a l...
X Description: Search Terms lib, polyfill Suggestion Split the existing lib .d.ts files into smaller feature segments so each feature can be included selectively as desired. Use Cases I work at a company with a l...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/25567
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Better compile time polyfill support by splitting lib .d.ts files into smallest segments possible","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the \"Common Feature Requests\" section.\r\n\r\n-->\r\n\r\n## Search Terms\r\nlib, polyfill\r\n\r\n## Suggestion\r\n\r\n\u003c!-- A summary of what you'd like to see added or changed -->\r\n\r\nSplit the existing lib .d.ts files into smaller feature segments so each feature can be included selectively as desired.\r\n\r\n## Use Cases\r\n\r\n\u003c!--\r\nWhat do you want to use this for?\r\nWhat shortcomings exist with current approaches?\r\n-->\r\n\r\nI work at a company with a large collection of independently shipping web modules/apps.\r\n\r\nToday we use the following method to detect at compile time if a polyfill will be required for the browsers we support (IE11+ in our case).\r\n\r\n1. Setup our tsconfig.json lib to only specify \"es5\" and \"dom\"\r\n2. If a newer JS feature is desired selectively add its definition to tsconfig.json lib and polyfill that specific feature\r\n\r\nThe problem is that the current definitions for tsconfig.json lib are often much larger then we would like.\r\n\r\nFor example:\r\nIf we want to use the feature `Array[].findIndex` using this above described method we would add \"es2015.core\" to the tsconfig.json and a corresponding `Array[].findIndex` polyfill. This works but unintentionally results in a plethora of other features (`Array.find`, `Array.from`, ...) that now will compile without problems but are not polyfilled.\r\n\r\nIf we want to be sure to avoid unintentionally using a \"es2015.core\" feature we have not polyfilled we would have to polyfill all of the features but would really like to avoid doing that.\r\n\r\n## Examples\r\n\r\n\u003c!-- Show how this would be used and what the behavior would be -->\r\n\r\nWould be great if the type definitions were split in a similar way to [core-js](https://github.com/zloirock/core-js). They do a fantastic job of allowing selective polyfills as well as collections of polyfills.\r\n\r\nso for the array methods \"es2015.core\" would be split into \"es2015.array\" which would be a composition of independently usable more specific cases (for example \"es2015.array.findIndex\").\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n* [x] This wouldn't be a breaking change in existing TypeScript / JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. new expression-level syntax)\r\n\r\n","author":{"url":"https://github.com/greyepoxy","@type":"Person","name":"greyepoxy"},"datePublished":"2018-07-10T23:27:12Z","url":"https://github.com/microsoft/TypeScript/issues/25567"}
| 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:39198073-9ec5-854a-d97b-389f181ffed5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF7E:3CBAFA:7CC5CC:AE23DB:6B048BFA |
| html-safe-nonce | a559092cee2dd386123b22fa0257fbee06dc6d5a7439655af2b33adb51bef826 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjdFOjNDQkFGQTo3Q0M1Q0M6QUUyM0RCOjZCMDQ4QkZBIiwidmlzaXRvcl9pZCI6Ijc5OTQ1MTE1MjIyMjU0OTA5MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a8ac8430dc9942842dccd93baa5ad2eb9a597b37ee68f78c1b5808c2ca16da63 |
| hovercard-subject-tag | issue:340040673 |
| 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/25567/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d20a05b49067c56b00ab48cec9e8cca11cc5ed0af1e2db7f67d839953bfcf409/microsoft/TypeScript/issues/25567 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d20a05b49067c56b00ab48cec9e8cca11cc5ed0af1e2db7f67d839953bfcf409/microsoft/TypeScript/issues/25567 |
| og:image:alt | Search Terms lib, polyfill Suggestion Split the existing lib .d.ts files into smaller feature segments so each feature can be included selectively as desired. Use Cases I work at a company with a l... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | greyepoxy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9b297275a74a2c9a35898175c9477837c635d4f579277ebff3b2d6ebd012e247 |
| 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 | b51ce57ca6d4565a42856fc1c9897077c794597f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width