Skip to content

Commit bd1a80d

Browse files
Updated Breaking Changes (markdown)
1 parent a0e0718 commit bd1a80d

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

Breaking-Changes.md

+56-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The module loader needs to be updated to [v0.17.1](https://github.com/ModuleLoad
1818

1919
#### Strict object literal assignment checking
2020

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.
2222

2323
**Example:**
2424

@@ -50,6 +50,61 @@ var y: Foo;
5050
y = <Bar>{ foo: 1, bar: 2 };
5151
```
5252

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+
export default function foo() {
59+
}
60+
61+
namespace foo {
62+
var x = 100;
63+
}
64+
```
65+
66+
and
67+
68+
```TypeScript
69+
export default class Foo {
70+
a: number;
71+
}
72+
73+
interface Foo {
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+
export default class Foo {
84+
}
85+
86+
namespace Foo {
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+
class Foo {
96+
a: number;
97+
}
98+
99+
interface foo {
100+
b: string;
101+
}
102+
103+
export default Foo;
104+
```
105+
106+
For more details see [the originating issue](https://github.com/Microsoft/TypeScript/issues/3095).
107+
53108
# TypeScript 1.5
54109

55110
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

Comments
 (0)