mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -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.
This commit is contained in:
parent
d91be57f61
commit
73c816652c
15 changed files with 45 additions and 25 deletions
|
@ -204,6 +204,7 @@
|
|||
"topojson-client": "3.0.0",
|
||||
"trunc-html": "1.0.2",
|
||||
"trunc-text": "1.0.2",
|
||||
"tslib": "^1.9.3",
|
||||
"type-detect": "^4.0.8",
|
||||
"uglifyjs-webpack-plugin": "^1.2.7",
|
||||
"ui-select": "0.19.6",
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"babel-preset-env": "^1.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"moment": "^2.13.0"
|
||||
"moment": "^2.13.0",
|
||||
"tslib": "^1.9.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1557,6 +1557,10 @@ trim-right@^1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
|
||||
|
||||
tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
tunnel-agent@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
"execa": "^0.10.0",
|
||||
"moment": "^2.20.1",
|
||||
"rxjs": "^6.2.1",
|
||||
"tree-kill": "^1.2.0"
|
||||
"tree-kill": "^1.2.0",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
|
|
|
@ -1797,9 +1797,9 @@ trim-right@^1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
|
||||
|
||||
tslib@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
|
||||
tslib@^1.9.0, tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
tunnel-agent@^0.6.0:
|
||||
version "0.6.0"
|
||||
|
|
|
@ -424,7 +424,7 @@ tree-kill@^1.2.0:
|
|||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36"
|
||||
|
||||
tslib@^1.9.0:
|
||||
tslib@^1.9.0, tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
|
|
|
@ -64,5 +64,8 @@
|
|||
"webpack": "^3.11.0",
|
||||
"wrap-ansi": "^3.0.1",
|
||||
"write-pkg": "^3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^1.9.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3570,9 +3570,9 @@ ts-loader@^3.5.0:
|
|||
micromatch "^3.1.4"
|
||||
semver "^5.0.1"
|
||||
|
||||
tslib@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
|
||||
tslib@^1.9.0, tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
tty-browserify@0.0.0:
|
||||
version "0.0.0"
|
||||
|
|
|
@ -12,5 +12,8 @@
|
|||
"devDependencies": {
|
||||
"@types/jest": "^22.2.2",
|
||||
"typescript": "^2.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^1.9.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
|
||||
|
||||
"@types/jest@^22.2.2":
|
||||
version "22.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-22.2.2.tgz#afe5dacbd00d65325f52da0ed3e76e259629ac9d"
|
||||
version "22.2.3"
|
||||
resolved "http://registry.npmjs.org/@types/jest/-/jest-22.2.3.tgz#0157c0316dc3722c43a7b71de3fdf3acbccef10d"
|
||||
|
||||
tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
typescript@^2.9.2:
|
||||
version "2.9.2"
|
||||
|
|
|
@ -1638,9 +1638,9 @@ trim-right@^1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
|
||||
|
||||
tslib@^1.9.0:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.1.tgz#a5d1f0532a49221c87755cfcc89ca37197242ba7"
|
||||
tslib@^1.9.0, tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
user-home@^1.1.1:
|
||||
version "1.1.1"
|
||||
|
|
|
@ -42,7 +42,13 @@
|
|||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
// Disable the breaking keyof behaviour introduced in TS 2.9.2 until EUI is updated to support that too
|
||||
"keyofStringsOnly": true
|
||||
"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/**/*"
|
||||
|
|
|
@ -160,6 +160,7 @@
|
|||
"styled-components": "3.3.3",
|
||||
"tar-fs": "1.13.0",
|
||||
"tinycolor2": "1.3.0",
|
||||
"tslib": "^1.9.3",
|
||||
"ui-select": "0.19.4",
|
||||
"unbzip2-stream": "1.0.9",
|
||||
"uuid": "3.0.1",
|
||||
|
|
|
@ -8176,9 +8176,9 @@ trim-right@^1.0.1:
|
|||
dependencies:
|
||||
glob "^6.0.4"
|
||||
|
||||
tslib@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
|
||||
tslib@^1.9.0, tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
tunnel-agent@^0.6.0:
|
||||
version "0.6.0"
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -13598,13 +13598,9 @@ ts-node@^6.0.3:
|
|||
source-map-support "^0.5.3"
|
||||
yn "^2.0.0"
|
||||
|
||||
tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.1.tgz#a5d1f0532a49221c87755cfcc89ca37197242ba7"
|
||||
|
||||
tslib@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
|
||||
tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
|
||||
tslint-config-prettier@^1.12.0:
|
||||
version "1.12.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue