-
Notifications
You must be signed in to change notification settings - Fork 99
Update tsconfig and corresponding docs #1488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3271c7b
dafae6d
7d490d3
c265d74
4b914f8
a9e3fff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,70 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2020", | ||
"allowJs": true, | ||
"target": "ES2021", | ||
"module": "ES2020", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"alwaysStrict": true, | ||
"strictNullChecks": true, | ||
"strictPropertyInitialization": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
|
||
// Trying to check Ember apps and addons with `allowJs: true` is a recipe | ||
// for many unresolveable type errors, because with *considerable* extra | ||
// configuration it ends up including many files which are *not* valid and | ||
// cannot be: they *appear* to be resolve-able to TS, but are in fact not in | ||
// valid Node-resolveable locations and may not have TS-ready types. This | ||
// will likely improve over time | ||
"allowJs": false, | ||
|
||
// --- TS for SemVer Types compatibility | ||
// Strictness settings -- you should *not* change these: Ember code is not | ||
// guaranteed to type check with these set to looser values. | ||
"strict": true, | ||
"noUncheckedIndexedAccess": true, | ||
|
||
// Interop: these are viral and will require anyone downstream of your | ||
// package to *also* set them to true. If you *must* enable them to consume | ||
// an upstream package, you should document that for downstream consumers to | ||
// be aware of. | ||
// | ||
// These *are* safe for apps to enable, since they do not *have* downstream | ||
// consumers; but leaving them off is still preferred when possible, since | ||
// it makes it easier to switch between apps and addons and have the same | ||
// rules for what can be imported and how. | ||
"allowSyntheticDefaultImports": false, | ||
"esModuleInterop": false, | ||
chriskrycho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// --- Lint-style rules | ||
|
||
// TypeScript also supplies some lint-style checks; nearly all of them are | ||
// better handled by ESLint with the `@typescript-eslint`. This one is more | ||
// like a safety check, though, so we leave it on. | ||
"noPropertyAccessFromIndexSignature": true, | ||
|
||
// --- Compilation/integration settings | ||
// Setting `noEmitOnError` here allows ember-cli-typescript to catch errors | ||
// and inject them into Ember CLI's build error reporting, which provides | ||
// nice feedback for when | ||
"noEmitOnError": true, | ||
chriskrycho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// We use Babel for emitting runtime code, because it's very important that | ||
// we always and only use the same transpiler for non-stable features, in | ||
// particular decorators. If you were to change this to `true`, it could | ||
// lead to accidentally generating code with `tsc` instead of Babel, and | ||
// could thereby result in broken code at runtime. | ||
"noEmit": true, | ||
|
||
// Ember makes heavy use of decorators; TS does not support them at all | ||
// without this flag. | ||
"experimentalDecorators": true, | ||
|
||
// Support generation of source maps. Note: you must *also* enable source | ||
// maps in your `ember-cli-babel` config and/or `babel.config.js`. | ||
"declaration": true, | ||
"declarationMap": true, | ||
"inlineSourceMap": true, | ||
"inlineSources": true, | ||
Comment on lines
+59
to
62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that we set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't actually know! These are what I added four years ago. 😬 |
||
|
||
// The combination of `baseUrl` with `paths` allows Ember's classic package | ||
// layout, which is not resolveable with the Node resolution algorithm, to | ||
// work with TypeScript. | ||
"baseUrl": ".", | ||
"module": "es6", | ||
"experimentalDecorators": true, | ||
"paths": <%= pathsFor(dasherizedPackageName) %> | ||
}, | ||
"include": <%= includes %> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not actionable yet, but I suspect we're going to want to change this to
node12
as soon as that graduates from nightly, since Webpack 5 (and so by extension,ember-auto-import
and Embroider) honorexports
config.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Hoping they ship that in 4.7 and we can flip it on. 🤞🏼