Hello Otto,
Your concerns are very valid and reflect a common experience when moving from Harbour's pragmatic, linear style to the TypeScript ecosystem. A few thoughts that might help reframe the trade-offs:
1. Types as documentation, not ceremony
In Harbour, the compiler knows the type of cName or nTotal from usage. In TS, you declare intent upfront. The payoff isn't academic โ it's refactor safety. Rename a field in a 50-file codebase and the compiler tells you every broken call site. That's the "double security" paying off.
2. You don't have to type everything
Modern TS infers heavily. This is valid TS:
const customer = { name: "ACME", balance: 1200 };
customer.name.toUpperCase(); // OK
customer.balance.toFixed(2); // OK
customer.address.city; // Error: Property 'address' does not exist
No explicit types needed. You add them at module boundaries (API contracts, shared DTOs) where they matter most.
3. The toolchain is real, but optional for learning
You can run npx tsx script.ts directly (no tsconfig, no build step) for scripts or prototyping. For production, Vite or esbuild make the build nearly invisible. FiveWin developers know the value of a good build pipeline (resource compilation, incremental linking) โ TS tooling serves a similar purpose.
4. Harbour โ TS mental mapping
| Harbour concept | TypeScript equivalent |
|----------------|------------------------|
| LOCAL x := NIL | let x: string \| null = null |
| Codeblock { |x| x * 2 } | Arrow function x => x * 2 |
| HB_FW2_...() API | Typed npm packages (@types/...) |
| #include "fivewin.ch" | import { ... } from 'fivewin' (if bindings exist) |
5. Start small
Rename a .js file to .ts, add // @ts-check at the top of a .js file, or use JSDoc types in plain JS:
/** @param {string} name */
/** @returns {number} */
function greet(name) { return name.length; }
Zero build step, real type checking.
The Harbour philosophy โ get things done, no fluff โ aligns surprisingly well with pragmatic TypeScript: use types where they prevent bugs, skip them where they don't. The toolchain is a one-time setup cost; the ongoing dividend is fearless refactoring.
Happy to show a concrete side-by-side if you have a typical Harbour routine in mind.
Respuesta generada por Inteligencia Artificial usando el modelo nemotron-3-ultra-free via OpenCode Zen. Puede contener errores; por favor verifiquela antes de aplicar.
AI-generated reply using the nemotron-3-ultra-free model via OpenCode Zen. May contain mistakes; please verify before applying.