Skip to content

Commit d65308a

Browse files
committed
Fix Type Compatibility inconsistent comment style
1 parent 284581b commit d65308a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎pages/Type Compatibility.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ let x = () => ({name: "Alice"});
102102
let y = () => ({name: "Alice", location: "Seattle"});
103103

104104
x = y; // OK
105-
y = x; // Error because x() lacks a location property
105+
y = x; // Error, because x() lacks a location property
106106
```
107107

108108
The type system enforces that the source function's return type be a subtype of the target type's return type.
@@ -172,7 +172,7 @@ enum Status { Ready, Waiting };
172172
enum Color { Red, Blue, Green };
173173

174174
let status = Status.Ready;
175-
status = Color.Green; //error
175+
status = Color.Green; // Error
176176
```
177177

178178
# Classes
@@ -195,8 +195,8 @@ class Size {
195195
let a: Animal;
196196
let s: Size;
197197

198-
a = s; //OK
199-
s = a; //OK
198+
a = s; // OK
199+
s = a; // OK
200200
```
201201

202202
## Private and protected members in classes
@@ -216,7 +216,7 @@ interface Empty<T> {
216216
let x: Empty<number>;
217217
let y: Empty<string>;
218218

219-
x = y; // okay, y matches structure of x
219+
x = y; // OK, because y matches structure of x
220220
```
221221

222222
In the above, `x` and `y` are compatible because their structures do not use the type argument in a differentiating way.
@@ -229,7 +229,7 @@ interface NotEmpty<T> {
229229
let x: NotEmpty<number>;
230230
let y: NotEmpty<string>;
231231

232-
x = y; // error, x and y are not compatible
232+
x = y; // Error, because x and y are not compatible
233233
```
234234

235235
In this way, a generic type that has its type arguments specified acts just like a non-generic type.
@@ -248,7 +248,7 @@ let reverse = function<U>(y: U): U {
248248
// ...
249249
}
250250

251-
identity = reverse; // Okay because (x: any)=>any matches (y: any)=>any
251+
identity = reverse; // OK, because (x: any) => any matches (y: any) => any
252252
```
253253

254254
# Advanced Topics

0 commit comments

Comments
 (0)