News for hackers. Stuff that matters.
Re:Show HN: Nue – Apps lighter than a React button by mplanchard on Tuesday April 01, 2025 @08:25AM (#43545920)
It’s not real static typing. A compiled typescript project is just javascript, which will still gladly accept incorrect types. The types only matter during compilation.
Re:Show HN: Nue – Apps lighter than a React button by recursive on Tuesday April 01, 2025 @01:50PM (#43549628)
This is the real-est static typing that exists. "Static" refers to build time. By definition static types are checked at build time, not run time. If you want types to be checked at run time, that's called "dynamic" typing.
Re:Show HN: Nue – Apps lighter than a React button by mplanchard on Tuesday April 01, 2025 @02:43PM (#43550118)
Sure, you're technically correct. But TS is compiled in to JS, which is dynamically typed at runtime. You're still ultimately in a dynamically typed language.

In addition, in a typical statically typed, compiled language, your only place where you interact with data that isn't guaranteed to be type-conformant is at a foreign function interface, whereas in Typescript all your interaction with third-party libraries is via regular JS and may or may not be type conformant.

Re:Show HN: Nue – Apps lighter than a React button by recursive on Tuesday April 01, 2025 @03:08PM (#43550324)
Is there such a thing as a statically typed language? CPU opcodes don't type-check their parameters.
Re:Show HN: Nue – Apps lighter than a React button by throwaway894345 on Tuesday April 01, 2025 @03:12PM (#43550360)
Rust compiles into WASM, x86, etc, which are dynamically typed for all intents and purposes. They certainly don't understand or enforce Rust's type system invariants any more than JavaScript enforces TypeScript invariants. If you call a Rust function from WASM and pass it malformed data, the WASM runtime will happily execute it.

(pretty sure WASM actually has some integer types, so I guess maybe it is technically "statically typed" but not in any interesting sense--we could similarly say that JavaScript is "statically typed" because every variable has a static "any" type).

Re:Show HN: Nue – Apps lighter than a React button by johnfn on Tuesday April 01, 2025 @09:36PM (#43552948)
And Go/C/Rust compiles to ASM, a dynamically typed language at runtime.
Re:Show HN: Nue – Apps lighter than a React button by oynqr on Tuesday April 01, 2025 @02:29PM (#43550004)
> The types only matter during compilation.

That's pretty much the definition of static typing.

Re:Show HN: Nue – Apps lighter than a React button by throwaway894345 on Tuesday April 01, 2025 @03:09PM (#43550340)
You're confusing "real static typing" with runtime type information. TypeScript has "real static typing" (if you disagree, ponder for a moment the meaning of "static"). A TypeScript program cannot natively query the _TypeScript type_ (not to be confused with the corresponding JavaScript type) of one of its variables in the way, for example, Go can. But neither can C, or C++, or Rust, all of which are unquestioningly statically typed.