FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour TypeScript - Concerns from a Harbour Programmer
Posts: 7020
Joined: Fri Oct 07, 2005 07:07 PM

TypeScript - Concerns from a Harbour Programmer

Posted: Mon Feb 23, 2026 07:06 AM

Hello friends,

A Harbour developer is used to working in a strongly data- and procedure-oriented style, often with clear, linear flows and fewer layers of abstraction. From this perspective, TypeScript can feel like an unnecessary academization of JavaScript. The concern is that one might spend more time dealing with type constructs than actually solving the core problem. There is also the impression of having to secure things twice: once logically in the code itself and once formally within the type system. In addition, the dependency on a toolchain โ€” compiler, Node, bundler โ€” may be perceived as unnecessary complexity, especially for someone who has previously worked comfortably without a build process.

Best regards, Otto

Posts: 0
Joined: Wed Aug 26, 2026 09:41 AM

Re: TypeScript - Concerns from a Harbour Programmer

Posted: Sun Aug 30, 2026 02:30 AM

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.

Continue the discussion