TypeScript Method Override: override Keyword and super Calls
A subclass replaces a parent method by overriding it. Learn the override keyword, noImplicitOverride, super calls and the rules the compiler checks.
A subclass replaces a parent method by overriding it. Learn the override keyword, noImplicitOverride, super calls and the rules the compiler checks.
An interface cannot be instantiated with new, but any object with the right shape matches it. Learn seven ways to create such objects and when to use each.
instanceof checks whether an object was created by a class and narrows its type. Learn how it works, where it fails, and how to check interfaces with in and type guards.
An interface describes a shape and disappears after compilation; a class describes a shape, holds code and exists at runtime. Compare them feature by feature.
TypeScript generics let one function, class or interface work with many types while the compiler checks every value. Examples cover constraints, keyof, defaults and const type parameters.
Extend a TypeScript interface with extends, combine several parents, merge declarations, and learn when an intersection type (&) is the better fit.
A TypeScript interface names the shape of an object. Learn to declare one, use optional and readonly properties, implement it in a class, and choose between an interface and a type alias.
TypeScript exception handling uses try, catch, finally and throw, with an unknown catch variable under strict. Examples cover custom Error classes, cause, instanceof and async errors.
A Record types a plain object; a Map is a runtime collection. Compare them on keys, order, JSON, type checks and user input, and convert one into the other.
Record
TypeScript checks types at compile time and outputs plain JavaScript; JavaScript checks them only at runtime. A side-by-side comparison with real compiler errors.
Optional parameters may be left out and are undefined inside the function; default parameters fill in a value instead. Examples cover undefined vs null, order rules and options objects.
Remove items from a TypeScript array by position or by value, in place or on a copy, with the common bugs (-1 index, splice in a loop, delete) shown and fixed.
Add items to the end, start or any index of a TypeScript array, or to a new array with spread, concat() and toSpliced(), with the compiler errors explained.
Get the current date in TypeScript, create dates, add days and months, compare and format them, and avoid the time zone and JSON pitfalls of the Date object.
All TypeScript tutorials on howtodoinjava.com, grouped by topic: basics, types, operators, arrays, collections, functions, interfaces and classes.
Number.isFinite() is the reliable way to check if a variable is a number in JavaScript. Learn why typeof and the global isNaN() let bad values through, how to validate numeric strings from forms, and how to write a TypeScript type guard.
A callback function in TypeScript is a function passed to another function and called later. Examples cover callback types, passing parameters, error-first callbacks, Promises and async/await.
Function overloading in TypeScript gives one function several call signatures and a single implementation. Examples cover classes, constructors, call signatures and the simpler alternatives.
A rest parameter collects any number of arguments into one typed array, and a spread argument expands an array back into arguments. Examples cover function types, tuples and typed wrappers.
How template strings work in TypeScript: placeholders and expressions, multi-line text, tagged templates and String.raw, and template literal types that check string patterns at compile time.
A TypeScript Set stores unique values in insertion order. Create one, add and check values, remove duplicates from arrays, and compare sets with the ES2025 methods.
TypeScript Map with tested examples: create, update and iterate entries, handle undefined from get(), convert to JSON, sort, and choose Map vs Record.
The classic for loop, for…of, for…in and forEach() in TypeScript, with break, continue, labels, and iteration over Map, Set and object entries.
What each tsconfig.json option does, the real tsc –init output of TypeScript 7.0.2, three stricter options worth enabling, and the old options TypeScript 7 removed.
Literal types restrict a value to an exact list such as “small” | “medium” | “large”. Learn widening, as const, deriving unions from arrays, checking user input and Record lookups.
Numeric, string and const enums in TypeScript, reverse mapping and string-to-enum conversion, plus why Node.js type stripping and erasableSyntaxOnly reject enums and what to use instead.
undefined means a value was never set, null means it was set to “nothing” on purpose. Learn where each comes from, how they differ, and how strictNullChecks, ?? and ?. handle them.
How TypeScript union types work, how to narrow them with typeof, instanceof, in and type guards, and how discriminated unions with an exhaustive switch catch forgotten cases.
The difference between == and === in TypeScript with real results, the type conversion rules of ==, the compiler checks, and the one accepted use of == null.
How the three dots copy and merge arrays and objects, pass arguments and collect rest values in TypeScript, with tested examples and the compiler errors that go with them.
How &&, || and ! short-circuit and return operands in TypeScript, when to use ?? instead of ||, optional chaining, logical assignment, and the compiler checks for always-truthy conditions.
How ===, !==, <, >, <= and >= behave in TypeScript for numbers, strings, dates and objects, and which comparisons the compiler rejects.
An overview of the TypeScript type system: primitive types, inference, any vs unknown vs never, arrays and tuples, object types, unions and generics, with examples tested on TypeScript 7.0.2.
Install TypeScript 7 with npm, compile a first program with tsc, set up tsconfig.json, and run .ts files directly with Node.js 22 type stripping.
Every TypeScript arithmetic operator with real results, plus the cases that surprise beginners: decimal division, negative remainders, ** and the compiler errors for strings and unions.
var is function-scoped, let and const are block-scoped, and const cannot be reassigned. Examples cover the temporal dead zone, loop closures, const objects and TypeScript literal types.
Hoisting makes every declaration exist from the start of its scope. var reads as undefined, let, const and class throw in the temporal dead zone, and function declarations work anywhere.
JavaScript has eight falsy values; everything else, including “0”, [] and {}, is truthy. Learn where the conversion happens, how TypeScript narrows with it, and the bugs it causes.
A transpiler outputs source code at the same level as its input; a classic compiler outputs bytecode or machine code. Real javac, tsc and Node.js output shows the difference.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.