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
> Recommended setup for best benefits from type-checking, with support for JSX and ES2016 features.
622
-
> `npm i tslib` - install [`tslib`](https://www.npmjs.com/package/tslib)dependency to externalize helper functions generated by transpiler and normally inlined in your modules to minimize bundle size
621
+
> Recommended setup for best benefits from type-checking, with support for JSX and ES2016 features.
622
+
> Add [`tslib`](https://www.npmjs.com/package/tslib) to minimize bundle size: `npm i tslib` - this will externalize helper functions generated by transpiler and otherwise inlined in your modules
@@ -756,15 +756,15 @@ npm i -D @types/react @types/react-dom @types/react-redux
756
756
```
757
757
758
758
### - when to use `interface` and when `type` to behave consistently?
759
-
> Use `type` when declaring simple object literal structs e.g. Component Props, Component State, Redux State, Redux Action.
760
-
In other cases it's more flexible to use `interface` over `type` because interfaces can be implemented, extended and merged.
761
-
Related `ts-lint` rule: https://palantir.github.io/tslint/rules/interface-over-type-literal/
759
+
> Use `type` when declaring simple object literal structs e.g. Component Props, Component State, Redux State, Redux Action.
760
+
In other cases it's more flexible to use `interface` over `type` because interfaces can be implemented, extended and merged.
761
+
Related `ts-lint` rule: https://palantir.github.io/tslint/rules/interface-over-type-literal/
762
762
763
763
### - should I use React.PropTypes?
764
-
> No. In TypeScript it is completely unnecessary, you will get a much better free type checking and intellisense at compile time when declaring a "generic type" for component: `React.Component<{ myProp:string }, { myState:number}>`, this way you'll never get any runtime errors and get elegant way of describing component external API.
764
+
> No. In TypeScript it is completely unnecessary, you will get a much better free type checking and intellisense at compile time when declaring a "generic type" for component: `React.Component<{ myProp:string }, { myState:number}>`, this way you'll never get any runtime errors and get elegant way of describing component external API.
765
765
766
766
### - how to best declare component instance properties?
767
-
> Don't use old-school React class constructors way, prefer to use Property Initializers (first class support in TypeScript)
767
+
> Don't use old-school React class constructors way, prefer to use Property Initializers (first class support in TypeScript).
0 commit comments