| TypeScript Notation | Our Notation |
|---|---|
{ name: string, age: number, [otherField: string]: boolean } | name → string age → number otherField → boolean |
| string[] | index → string |
function doubleNum(x) { return x * 2 } let y = doubleNum(5) | function doubleNum(x) { return x * 2 } let y = doubleNum(5) |
Basic Click to expand the function calls. | function threeTimesNum(x: number) { return x * 3 } function sixTimesNum(x: number) { return threeTimesNum(x) * 2 } let z = sixTimesNum(5) |
Substitution Inputs are paramaterized when needed. | function twoTimesNum(x: number) { return x * 2 } function squareNum(x: number) { return x * x } let z = squareNum(twoTimesNum(5)) |
Limitations Limitations (right example) arise from first-class functions with implicit parameters (NP-hard to track). TS doesn't have ownership like rust, so it itself to deal with async/await. Even with this limitation, expansion is useful to see the the shape of primitive calls in your code. Usually in complex scenarios you just want to look at the code anyway. | type User = name → string age → number function doThingsToUser(user: User, ...fns: index → (User)→undefined for (const f of fns) {f(user)} } function setUserName(user: User) { user.name = 'Bob' } let user = { name: 'Max', age: 99 } doThingsToUser(user, setUserName) |