Examples · learn/25-js-interop · 274 of 339
data
tin run examples/learn/25-js-interop/data.tinimport js "./shapes.mjs"
type Point = { x: float, y: float }
extern fn corners(sides: int, radius: float): Point[] // JS returns objects; Tin checks the shape
extern fn slowUpper(s: string): string // an async JS function: just call it
fn main() {
let square = corners(4, 1.0)
print("{square.len} corners, first at ({square[0].x}, {square[0].y})")
print(slowUpper("tin"))
}