From 7c243097d1873417744cbb3d7bd7bcbd154084cc Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 16 Feb 2018 10:14:04 -0800 Subject: [PATCH] lodash: Revert ReadonlyArray support (crashes older compilers) (#23710) --- types/lodash/common/common.d.ts | 2 +- types/lodash/lodash-tests.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 5af72d2440..ac3e137b12 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -2,7 +2,7 @@ import _ = require("../index"); type GlobalPartial = Partial; declare module "../index" { type PartialObject = GlobalPartial; - type Many = T | ReadonlyArray; + type Many = T | T[]; // TODO: Should be ReadonlyArray, but requires ts2.5 to not infinitely loop interface LoDashStatic { /** * Creates a lodash object which wraps value to enable implicit method chain sequences. diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index ca33017323..7646cd02a6 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -3775,7 +3775,7 @@ namespace TestCommit { // _.prototype.concat namespace TestConcat { - const numberROA: ReadonlyArray = [0]; + const numberROA: number[] = [0]; // TODO: Should be ReadonlyArray, but see comment on type Many _.concat(1); // $ExpectType number[] _.concat([1]); // $ExpectType number[] @@ -3798,7 +3798,7 @@ namespace TestConcat { _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper - const stringROA: ReadonlyArray = ['']; + const stringROA: string[] = ['']; // TODO: Should be ReadonlyArray, but see comment on type Many _.concat('a'); // $ExpectType string[] _.concat(['a']); // $ExpectType string[] @@ -3822,7 +3822,7 @@ namespace TestConcat { _.chain(stringROA).concat(stringROA, stringROA); // $ExpectType LoDashExplicitWrapper const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; - const objectROA: ReadonlyArray = [{ a: 1, b: 'foo', c: true }]; + const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many _.concat(abcObject); // $ExpectType AbcObject[] _.concat([abcObject]); // $ExpectType AbcObject[] @@ -11802,9 +11802,9 @@ namespace TestOmitBy { namespace TestPick { const obj1: AbcObject | null | undefined = anything; const obj2: AbcObject = anything; - const readonlyArray: ReadonlyArray = ['a', 'b']; + const readonlyArray: string[] = ['a', 'b']; // TODO: Should be ReadonlyArray, but see comment on type Many const literalsArray = ['a' as 'a', 'b' as 'b']; - const roLiteralsArray: ReadonlyArray<'a' | 'b'> = literalsArray; + const roLiteralsArray: Array<'a' | 'b'> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many _.pick(obj1, 'a'); // $ExpectType PartialDeep _.pick(obj1, 0, 'a'); // $ExpectType PartialDeep