- snippets from live coding session
- Tomasz Ducin, @tomasz_ducin
- Wrocław TypeScript #3, 2019.03.27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'AuthorizeDevice', | |
initial: 'chooseMethod', | |
states: { | |
chooseMethod: { | |
on: { | |
CHOOSE_ADD_DEVICE: 'addDeviceForm', | |
} | |
}, | |
addDeviceForm: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'AuthorizeDevice', | |
initial: 'chooseMethod', | |
states: { | |
chooseMethod: { | |
on: { | |
CHOOSE_ALLOW_ONCE: 'allowOnceToken', | |
CHOOSE_ADD_DEVICE: 'addDeviceForm', | |
CHOOSE_LOGOUT: 'loggedOut', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CORRECT SUBMIT EVENT: | |
// { | |
// "type": "SUBMIT", | |
// "password": "1234" | |
// } | |
// pure mocks | |
const delay = (time) => { | |
return new Promise((res, rej) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "object", | |
"properties": { | |
"orderId": { | |
"type": "string", | |
"faker": "random.uuid" | |
}, | |
"customer": { | |
"type": "string", | |
"faker": "name.findName" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { INC } from './constants'; | |
export const Inc = () => ({ | |
type: INC as typeof INC | |
}) | |
export type Actions = | |
| ReturnType<typeof Inc> |
- snippets from live coding session
- Tomasz Ducin, @tomasz_ducin
- Warsaw TypeScript #2, 2019.02.06
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lorem Ipsum License | |
Copyright (c) [year] [fullname] | |
Permission is Lorem ipsum hereby granted, dolor sit amet, free of charge, | |
to any person obtaining a copy consectetur adipiscing elit. Proin nibh augue | |
of this software and associated documentation files (the "Software"), | |
suscipit a, scelerisque sed, to deal lacinia in, mi. Cras vel lorem. | |
Etiam pellentesque aliquet tellus, in the Software without restriction, | |
Phasellus pharetra nulla ac diam. Quisque semper justo at risus including |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const API_URL = 'http://localhost:3011/' | |
const OfficeModel = { | |
getCollection(){ | |
return fetch(`${API_URL}offices`) | |
.then(res => res.json()) | |
}, | |
async __extendOfficeWithEmployees(office){ | |
const employees = await EmployeeModel.getCollection(office.city) | |
return { ...office, employees } |
NewerOlder