mirror of
https://github.com/elastic/kibana.git
synced 2025-04-21 16:29:04 -04:00
I was surprised when I tried to spread a `Set` in TypeScript and the browser complained about `Set.slice()` not being defined. This is because TypeScript does not automatically enable support for iterators when targeting earlier ES versions, like we do in the browser, unless you use the `"downlevelIteration": true` compiler option. This injects some helpers into the necessary files for reading/spreading iterators, which can be stuffed behind an import statement with using the `"importHelpers": true` compiler option and include `tslib` in our dependencies. This is already a dependency of several of our packages, so it shouldn't cause any additional modules.
59 lines
2 KiB
JSON
59 lines
2 KiB
JSON
{
|
|
"compilerOptions": {
|
|
"baseUrl": ".",
|
|
"paths": {
|
|
"ui/*": ["src/ui/public/*"]
|
|
},
|
|
// Support .tsx files and transform JSX into calls to React.createElement
|
|
"jsx": "react",
|
|
|
|
// Enables all strict type checking options.
|
|
"strict": true,
|
|
|
|
// enables "core language features"
|
|
"lib": [
|
|
// ESNext auto includes previous versions all the way back to es5
|
|
"esnext",
|
|
// includes support for browser APIs
|
|
"dom"
|
|
],
|
|
|
|
// Node 8 should support everything output by esnext, we override this
|
|
// in webpack with loader-level compiler options
|
|
"target": "esnext",
|
|
|
|
// Use commonjs for node, overridden in webpack to keep import statements
|
|
// to maintain support for things like `await import()`
|
|
"module": "commonjs",
|
|
|
|
// Allows default imports from modules with no default export. This does not affect code emit, just type checking.
|
|
// We have to enable this option explicitly since `esModuleInterop` doesn't enable it automatically when ES2015 or
|
|
// ESNext module format is used.
|
|
"allowSyntheticDefaultImports": true,
|
|
|
|
// Emits __importStar and __importDefault helpers for runtime babel ecosystem compatibility.
|
|
"esModuleInterop": true,
|
|
|
|
// Resolve modules in the same way as Node.js. Aka make `require` works the
|
|
// same in TypeScript as it does in Node.js.
|
|
"moduleResolution": "node",
|
|
|
|
// Disallow inconsistently-cased references to the same file.
|
|
"forceConsistentCasingInFileNames": true,
|
|
|
|
// Disable the breaking keyof behaviour introduced in TS 2.9.2 until EUI is updated to support that too
|
|
"keyofStringsOnly": true,
|
|
|
|
// Provide full support for iterables in for..of, spread and destructuring when targeting ES5 or ES3.
|
|
"downlevelIteration": true,
|
|
|
|
// import tslib helpers rather than inlining helpers for iteration or spreading, for instance
|
|
"importHelpers": true
|
|
},
|
|
"include": [
|
|
"src/**/*"
|
|
],
|
|
"exclude": [
|
|
"src/**/__fixtures__/**/*"
|
|
]
|
|
}
|