Skip to content

Commit

Permalink
Merge pull request #574 from jaimemarijke/patch-2
Browse files Browse the repository at this point in the history
Remove Location and clarify ImageControl error
  • Loading branch information
Orta committed May 12, 2020
2 parents d0b1024 + 8d79e41 commit fcc15c5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/handbook-v1/en/Interfaces.md
Expand Up @@ -652,13 +652,10 @@ class TextBox extends Control {
select() {}
}

// Error: Property 'state' is missing in type 'Image'.
class ImageControl implements SelectableControl {
private state: any;
select() {}
}

class Location {}
```

In the above example, `SelectableControl` contains all of the members of `Control`, including the private `state` property.
Expand All @@ -667,4 +664,4 @@ This is because only descendants of `Control` will have a `state` private member

Within the `Control` class it is possible to access the `state` private member through an instance of `SelectableControl`.
Effectively, a `SelectableControl` acts like a `Control` that is known to have a `select` method.
The `Button` and `TextBox` classes are subtypes of `SelectableControl` (because they both inherit from `Control` and have a `select` method), but the `Image` and `Location` classes are not.
The `Button` and `TextBox` classes are subtypes of `SelectableControl` (because they both inherit from `Control` and have a `select` method). The `ImageControl` class has it's own `state` private member rather than extending `Control`, so it cannot implement `SelectableControl`.

0 comments on commit fcc15c5

Please sign in to comment.