Hacker News new | ask | show | jobs
by vict00r99 129 days ago
You don't map the types, you map the behavior.

Define a behavioral contract (inputs, outputs, edge cases) with test cases, and let each language handle types idiomatically. `dict[str, Any]` becomes `Record<string, unknown>` in TS, `map[string]interface{}` in Go, `HashMap<String, Box<dyn Any>>` in Rust. You don't force one type system onto another.

For dynamic languages, type hints document intent but tests enforce the contract. If the function accepts the specified inputs and produces the specified outputs, the contract is satisfied, regardless of whether types are checked at compile time or runtime.

What do you think?