You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Breaking-Changes.md
+56-1
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The module loader needs to be updated to [v0.17.1](https://github.com/ModuleLoad
18
18
19
19
#### Strict object literal assignment checking
20
20
21
-
The changes make it an error to specify properties in an object literal that were not specified on the target type, when assigned to a variable or passed for a parameter of a non-empty target type.
21
+
It is an error to specify properties in an object literal that were not specified on the target type, when assigned to a variable or passed for a parameter of a non-empty target type.
22
22
23
23
**Example:**
24
24
@@ -50,6 +50,61 @@ var y: Foo;
50
50
y= <Bar>{ foo: 1, bar: 2 };
51
51
```
52
52
53
+
#### Function and class default export declarations can no longer merge with entities intersecting in their meaning
54
+
55
+
Declaring an entity with the same name and in the same space as a default export declaration is now an error; for example,
56
+
57
+
```TypeScript
58
+
exportdefaultfunction foo() {
59
+
}
60
+
61
+
namespacefoo {
62
+
var x =100;
63
+
}
64
+
```
65
+
66
+
and
67
+
68
+
```TypeScript
69
+
exportdefaultclassFoo {
70
+
a:number;
71
+
}
72
+
73
+
interfaceFoo {
74
+
b:string;
75
+
}
76
+
```
77
+
78
+
both cause an error.
79
+
80
+
However, in the following example, merging is allowed because the namespace does does not have a meaning in the value space:
81
+
82
+
```TypeScript
83
+
exportdefaultclassFoo {
84
+
}
85
+
86
+
namespaceFoo {
87
+
}
88
+
```
89
+
90
+
**Recommendations:**
91
+
92
+
Declare a local for your default export and use a separate `export default` statement as so:
93
+
94
+
```TypeScript
95
+
classFoo {
96
+
a:number;
97
+
}
98
+
99
+
interfacefoo {
100
+
b:string;
101
+
}
102
+
103
+
exportdefaultFoo;
104
+
```
105
+
106
+
For more details see [the originating issue](https://github.com/Microsoft/TypeScript/issues/3095).
107
+
53
108
# TypeScript 1.5
54
109
55
110
For full list of breaking changes see the [breaking change issues](https://github.com/Microsoft/TypeScript/issues?q=is%3Aissue+milestone%3A%22TypeScript+1.5%22+label%3A%22breaking+change%22).
0 commit comments