Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skn0tt/react-and-typescript-talk
https://github.com/skn0tt/react-and-typescript-talk
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/skn0tt/react-and-typescript-talk
- Owner: Skn0tt
- Created: 2019-07-03T06:34:12.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T14:51:10.000Z (11 months ago)
- Last Synced: 2024-10-06T04:02:12.904Z (about 1 month ago)
- Language: JavaScript
- Size: 1.21 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Talk: React and Typescript
- [Slides](https://docs.google.com/presentation/d/1kMeWBTA-TU0u7nwAM4jm6o0vqtpP3MJZC9dqCbz9dh0/edit?usp=sharing)
- [Blog Post](https://simonknott.de/articles/Using-TypeScript-with-React.html)This repository contains the corresponding code to my talk about React and TypeScript.
## Example Code
```js
function add(a, b) {
return a + b;
}const favNumber = add(31, 11);
``````ts
function add(a: number, b: number): number {
return a + b;
}const favNumber: number = add(31, 11);
``````ts
function add(a: number, b: number) {
return a + b;
}const favNumber = add(31, 11);
``````ts
interface User {
firstName: string;
lastName: string;
age: number;
state: UserState;
}enum UserState {
ACTIVE,
INACTIVE,
INVITED,
}
``````ts
interface FunkyUser extends User {
isDancing: boolean;
}
``````ts
type UserState =
"active" |
"inactive" |
"invited";
``````ts
class JavaLover implements User {
private firstName: string;
private lastName: string;
private age: number;
private state: UserState;
getOpinion() {
return [ "!!JAVA!1!" ];
}
}
```