Add tests

This commit is contained in:
Anders Hejlsberg 2019-01-15 14:44:57 -08:00
parent db840f41c5
commit cff7874288
2 changed files with 32 additions and 0 deletions

View file

@ -30,6 +30,14 @@ type B = { b: string };
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };
type T50 = Readonly<string[]>;
type T51 = Readonly<[number, number]>;
type T52 = Partial<Readonly<string[]>>;
type T53 = Readonly<Partial<string[]>>;
type T54 = ReadWrite<Required<T53>>;
declare function unboxify<T>(x: Boxified<T>): T;
declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]];

View file

@ -0,0 +1,24 @@
// @strict: true
type T10 = string[];
type T11 = Array<string>;
type T12 = readonly string[];
type T13 = ReadonlyArray<string>;
type T20 = [number, number];
type T21 = readonly [number, number];
function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
ma = ra; // Error
ma = mt;
ma = rt; // Error
ra = ma;
ra = mt;
ra = rt;
mt = ma; // Error
mt = ra; // Error
mt = rt; // Error
rt = ma; // Error
rt = ra; // Error
rt = mt;
}