Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
903863a
Respect readonly mapped type modifier when mapping arrays and tuples
ahejlsberg Jan 12, 2019
bb8378f
Support 'readonly' type modifier on array and tuple types
ahejlsberg Jan 15, 2019
7b00a29
Accept new baselines
ahejlsberg Jan 15, 2019
db840f4
Update array/tuple relationship checking
ahejlsberg Jan 15, 2019
cff7874
Add tests
ahejlsberg Jan 15, 2019
a7ca7f4
Accept new baselines
ahejlsberg Jan 15, 2019
2256f91
Fix typo
ahejlsberg Jan 16, 2019
2ccc106
Add more tests
ahejlsberg Jan 16, 2019
b611a51
Accept new baselines
ahejlsberg Jan 16, 2019
0eac506
Add .d.ts generation test
ahejlsberg Jan 16, 2019
d24a63d
Accept new baselines
ahejlsberg Jan 16, 2019
e581649
Allow rest parameter type to be a readonly array or tuple
ahejlsberg Jan 17, 2019
2200d35
Add tests
ahejlsberg Jan 18, 2019
ef89d26
Accept new baselines
ahejlsberg Jan 18, 2019
4706a06
Merge branch 'master' into readonlyArrayTuple
ahejlsberg Jan 26, 2019
e290559
Add tests for decorators and declaration emit from error free source
ahejlsberg Jan 26, 2019
cd1f289
Accept new baselines
ahejlsberg Jan 26, 2019
4335f44
Tuples are known to be covaraint
ahejlsberg Jan 28, 2019
ea38146
Error on union types that are too complex to represent
ahejlsberg Jan 28, 2019
e727845
Higher complexity limit for unions of primitives only
ahejlsberg Jan 28, 2019
d86612c
Accept new baselines
ahejlsberg Jan 28, 2019
45af34d
Add subtype reduction complexity limit test
ahejlsberg Jan 28, 2019
54ba2cc
Accept new baselines
ahejlsberg Jan 28, 2019
151fac9
Merge branch 'master' into readonlyArrayTuple
ahejlsberg Jan 28, 2019
ff42c3d
Handle readonly arrays and tuples in decorator metadata serialization
ahejlsberg Jan 29, 2019
815f133
Accept new baselines
ahejlsberg Jan 29, 2019
3324684
Fix lint error
ahejlsberg Jan 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests
  • Loading branch information
ahejlsberg committed Jan 15, 2019
commit cff78742889785cca3ec18108777bd890b9a2b2b
Original file line number Diff line number Diff line change
Expand Up @@ -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>[]];
Expand Down
24 changes: 24 additions & 0 deletions tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts
Original file line number Diff line number Diff line change
@@ -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;
}