Upgrade typescript to 2.9.2 (#20757) (#20865)

This upgrades TypeScript to version 2.9.2. My main motivation is the support for generic type arguments in JSX elements and tagged templates (e.g. for `styled-components`).

Problems arising from breaking changes in the new TypeScript version have been mitigated by:

* setting the `keyofStringsOnly` option until impacted code has been
  future-proofed
* Restricting some joi-related generics

See the [release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html) for details.

Some follow-up tasks should be:

* Update EUI to support the new `keyof` behaviour
* Update new platform TypeScript code to support new `keyof` behaviour
* Remove `keyofStringsOnly` setting
This commit is contained in:
Felix Stürmer 2018-07-17 11:23:09 +02:00 committed by GitHub
parent d354507d49
commit 021ca43849
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1038 additions and 1269 deletions

View file

@ -343,7 +343,7 @@
"tslint": "^5.10.0",
"tslint-config-prettier": "^1.12.0",
"tslint-plugin-prettier": "^1.3.0",
"typescript": "^2.8.3",
"typescript": "^2.9.2",
"vinyl-fs": "^3.0.2",
"xml2js": "^0.4.19",
"xmlbuilder": "9.0.4",

File diff suppressed because one or more lines are too long

View file

@ -60,7 +60,7 @@
"strong-log-transformer": "^1.0.6",
"tempy": "^0.2.1",
"ts-loader": "^3.5.0",
"typescript": "^2.8.1",
"typescript": "^2.9.2",
"webpack": "^3.11.0",
"wrap-ansi": "^3.0.1",
"write-pkg": "^3.1.0"

View file

@ -3592,9 +3592,9 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@^2.8.1:
version "2.8.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.1.tgz#6160e4f8f195d5ba81d4876f9c0cc1fbc0820624"
typescript@^2.9.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
uglify-js@^2.8.29:
version "2.8.29"

View file

@ -11,6 +11,6 @@
},
"devDependencies": {
"@types/jest": "^22.2.2",
"typescript": "^2.8.1"
"typescript": "^2.9.2"
}
}

View file

@ -6,6 +6,6 @@
version "22.2.2"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-22.2.2.tgz#afe5dacbd00d65325f52da0ed3e76e259629ac9d"
typescript@^2.8.1:
version "2.8.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.1.tgz#6160e4f8f195d5ba81d4876f9c0cc1fbc0820624"
typescript@^2.9.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"

View file

@ -29,6 +29,7 @@ import {
ByteSizeOptions,
ByteSizeType,
ConditionalType,
ConditionalTypeValue,
DurationOptions,
DurationType,
LiteralType,
@ -146,7 +147,7 @@ function siblingRef<T>(key: string): SiblingReference<T> {
return new SiblingReference(key);
}
function conditional<A, B, C>(
function conditional<A extends ConditionalTypeValue, B, C>(
leftOperand: Reference<A>,
rightOperand: Reference<A> | A,
equalType: Type<B>,

View file

@ -22,6 +22,7 @@ import {
JoiRoot,
Reference,
Rules,
SchemaLike,
State,
ValidationErrorItem,
ValidationOptions,
@ -31,7 +32,7 @@ import { isDuration } from 'moment';
import { ByteSizeValue, ensureByteSizeValue } from '../byte_size_value';
import { ensureDuration } from '../duration';
export { AnySchema, Reference, ValidationErrorItem };
export { AnySchema, Reference, SchemaLike, ValidationErrorItem };
function isMap<K, V>(o: any): o is Map<K, V> {
return o instanceof Map;

View file

@ -22,7 +22,9 @@ import { internals } from '../internals';
import { Reference } from '../references';
import { Type, TypeOptions } from './type';
export class ConditionalType<A, B, C> extends Type<B | C> {
export type ConditionalTypeValue = string | number | boolean | object | null;
export class ConditionalType<A extends ConditionalTypeValue, B, C> extends Type<B | C> {
constructor(
leftOperand: Reference<A>,
rightOperand: Reference<A> | A,

View file

@ -22,7 +22,7 @@ export { AnyType } from './any_type';
export { ArrayOptions, ArrayType } from './array_type';
export { BooleanType } from './boolean_type';
export { ByteSizeOptions, ByteSizeType } from './byte_size_type';
export { ConditionalType } from './conditional_type';
export { ConditionalType, ConditionalTypeValue } from './conditional_type';
export { DurationOptions, DurationType } from './duration_type';
export { LiteralType } from './literal_type';
export { MaybeType } from './maybe_type';

View file

@ -39,7 +39,10 @@
"moduleResolution": "node",
// Disallow inconsistently-cased references to the same file.
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
// Disable the breaking keyof behaviour introduced in TS 2.9.2 until EUI is updated to support that too
"keyofStringsOnly": true
},
"include": [
"src/**/*"

View file

@ -70,7 +70,7 @@
"supertest-as-promised": "4.0.2",
"tmp": "0.0.31",
"tree-kill": "^1.1.0",
"typescript": "^2.8.3",
"typescript": "^2.9.2",
"vinyl-fs": "^3.0.2",
"xml-crypto": "^0.10.1",
"xml2js": "^0.4.19",

View file

@ -7749,9 +7749,9 @@ typedarray@^0.0.6, typedarray@~0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@^2.8.3:
version "2.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170"
typescript@^2.9.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
ua-parser-js@^0.7.9:
version "0.7.17"

View file

@ -13221,9 +13221,9 @@ typedarray@^0.0.6, typedarray@~0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@^2.8.3:
version "2.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170"
typescript@^2.9.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
ua-parser-js@^0.7.9:
version "0.7.17"