Skip to content

Commit e666582

Browse files
authored
Update README.md
1 parent 928b59b commit e666582

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,8 @@ class MyComponent extends React.Component<Props, State> {
846846
}
847847
```
848848
849-
### - is it better to use `interface` or `type` as convention?
850-
> In general this is a matter of taste, you can extend and implement type the same as an interface. The only major difference is that you will get a compiler error when extending and interface with incompatible properties, in contrary to merging types (&) operation, but otherwise they are synonymous.
849+
### - differences between `interface` declarations and `type` aliases
850+
> From practical point of view `interface` types will use it's identity when showing compiler errors, while `type` aliases will be always unwinded to show all the nested types it consists of. This can be too noisy when reading compiler errors and I like to leverage this distinction to hide some not important type details in reported type errors
851851
Related `ts-lint` rule: https://palantir.github.io/tslint/rules/interface-over-type-literal/
852852
853853
---

0 commit comments

Comments
 (0)