Title: Default compiler options · Issue #9642 · microsoft/TypeScript · GitHub
Open Graph Title: Default compiler options · Issue #9642 · microsoft/TypeScript
X Title: Default compiler options · Issue #9642 · microsoft/TypeScript
Description: At the moment there are a bunch of opt-in compiler flags that are off by default. In most cases, they fix or add some behavior to the compilation that would have otherwise been a breaking change. This makes perfect sense for existing pro...
Open Graph Description: At the moment there are a bunch of opt-in compiler flags that are off by default. In most cases, they fix or add some behavior to the compilation that would have otherwise been a breaking change. T...
X Description: At the moment there are a bunch of opt-in compiler flags that are off by default. In most cases, they fix or add some behavior to the compilation that would have otherwise been a breaking change. T...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9642
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Default compiler options","articleBody":"At the moment there are a bunch of opt-in compiler flags that are off by default. In most cases, they fix or add some behavior to the compilation that would have otherwise been a breaking change. This makes perfect sense for existing projects, but it shouldn't be default behavior for new ones.\n\nIMHO, TS 2.0 would have been a good opportunity to turn some opt-in flags into opt-outs at least, if not removing them altogether. Avoiding breaking changes lead to a configuration nightmare where there are a dozen options doing similar things in slightly different manners. I hope you will take this into account for future releases.\n\nFor now my proposal would be to simply change the output of `tsc --init`. It won't affect users that create a tsconfig file from scratch, but it will at least give some useful defaults for the others, while keeping transparent what options were explicitly used.\n\nRunning `tsc --init`, yields this:\n\n```\n{\n \"compilerOptions\": {\n \"module\": \"commonjs\",\n \"target\": \"es5\",\n \"noImplicitAny\": false,\n \"sourceMap\": false\n },\n \"exclude\": [\n \"node_modules\"\n ]\n}\n```\n\nProposal:\n\n```\n{\n \"compilerOptions\": {\n \"module\": \"commonjs\",\n \"target\": \"es5\",\n \"noImplicitAny\": true,\n \"noImplicitThis\": true,\n \"noImplicitReturns\": true,\n \"strictNullChecks\": true\n \"sourceMap\": false\n },\n \"exclude\": [\n \"node_modules\"\n ]\n}\n```\n\nMy reasoning here is that new projects should have the stricter settings, because there is no legacy JavaScript code being migrated. The `noImplicit*` options make it easier to have good, type-safe code from the start, especially for new users, who don't understand the difference or see its advantages.\n","author":{"url":"https://github.com/use-strict","@type":"Person","name":"use-strict"},"datePublished":"2016-07-12T14:12:45Z","url":"https://github.com/microsoft/TypeScript/issues/9642"}
| 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:fd951985-340f-c05a-f884-afe89734fa1c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD56:428E1:31864:42893:6B0093EA |
| html-safe-nonce | 50aa0cc6c212c32b548da6e6a3ac3f754d5da18866894d2680fdfaeebed4da7c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDU2OjQyOEUxOjMxODY0OjQyODkzOjZCMDA5M0VBIiwidmlzaXRvcl9pZCI6IjY3MDEzMTI4OTM5MjI2MTIyMDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 17a8634590ad9c6c9a15b9262d588ee802b09ee61516464f6fa2ce8b90ea116e |
| hovercard-subject-tag | issue:165090570 |
| 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/9642/issue_layout |
| twitter:image | https://opengraph.githubassets.com/10fa3151069b2a429d46dca5180ef4944043271b55ad7eeb0c6eec4691e6ddb4/microsoft/TypeScript/issues/9642 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/10fa3151069b2a429d46dca5180ef4944043271b55ad7eeb0c6eec4691e6ddb4/microsoft/TypeScript/issues/9642 |
| og:image:alt | At the moment there are a bunch of opt-in compiler flags that are off by default. In most cases, they fix or add some behavior to the compilation that would have otherwise been a breaking change. T... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | use-strict |
| hostname | github.com |
| expected-hostname | github.com |
| None | c710a5cb5c47be60abfe6e8410436d409906979dbed614ef09f29c60f5535b08 |
| 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 | be616a2a6ec1c609d6e002896dff5352d5c5f28b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width