642 B
Executable File
642 B
Executable File
Python to TypeScript Mini Map
Quick syntax map for common constructs.
Function typing
def fn(x: int) -> str:
return str(x)
function fn(x: number): string {
return String(x);
}
Lambda / Arrow
lambda x: x + 1
(x) => x + 1
Fallback for missing values
value = x if x is not None else 'fallback'
const value = x ?? 'fallback';
String interpolation
f"{year}-{month}-{day}"
`${year}-${month}-${day}`
Searching first match
next((p for p in parts if p['type'] == 'year'), None)
parts.find((p) => p.type === 'year')