Questions

TypeScript questions

Choose a question page, learn the concept, then test your understanding with a quiz.

How to Watch and Reload ts-node When TypeScript Files Change

Learn how to watch TypeScript files and automatically restart a ts-node dev server using practical tools and examples.

typescriptdevelopment-environmentnodemon

Interfaces vs Type Aliases in TypeScript

Learn the difference between interface and type in TypeScript, when to use each, and how they behave in real codebases.

typescriptinterfacetypescript-types

JSX.Element vs ReactNode vs ReactElement in React TypeScript

Learn the difference between JSX.Element, ReactNode, and ReactElement in React TypeScript, including null returns and component typing.

typescriptjavascriptreactjs

JavaScript Optional Chaining with Arrays and Functions

Learn JavaScript optional chaining for array indexes and optional function calls, with syntax, examples, errors, and safe patterns.

typescriptjavascriptarraysfunction

Key-Value Pairs in TypeScript: Objects, Records, and Maps

Learn how to represent key-value pairs in TypeScript with object index signatures, Record types, and Map, with practical examples and guidance.

typescript

Loop Through a String-Keyed Dictionary in TypeScript

Learn how to iterate over keys and values in TypeScript string-keyed dictionaries using Object.keys, Object.entries, and safe typing.

typescriptjavascript

Optional Chaining in TypeScript: Does TypeScript Support `?.` and What Is It Called?

Learn whether TypeScript supports the `?.` operator, what it is called, how it works, and how to use optional chaining safely in TypeScript.

typescript

React Event Types in TypeScript: onChange, onSubmit, and target

Learn the correct React event types in TypeScript, including ChangeEvent and FormEvent, and safely access input values and names.

typescriptjavascriptreactjs

React Refs in TypeScript: Typing DOM Elements Safely

Learn how to type React refs in TypeScript for safe DOM access, autocomplete, null checks, and modern class or function components.

typescriptreactjs

Runtime Interface Type Checks in TypeScript: Why `instanceof` Does Not Work

Learn why TypeScript interfaces do not exist at runtime, why `instanceof` fails, and how to safely check object shapes instead.

typescriptjavascriptinterface

Runtime Type Checks in TypeScript: Classes, Interfaces, instanceof, and Type Guards

Learn how runtime type checks work in TypeScript using instanceof, type guards, and why interfaces cannot be checked directly.

typescripttypecheckingtypeguards

String Interpolation in TypeScript: Template Literals

Learn TypeScript string interpolation with template literals, backticks, and ${} expressions, including examples, pitfalls, and practical uses.

typescriptjavascriptstring-interpolation

String vs string in TypeScript: Primitive vs Wrapper Object

Learn the difference between string and String in TypeScript, why assignment fails, and when to use the primitive type instead.

typescript

Strongly Typed Function Parameters in TypeScript

Learn how to type callback function parameters in TypeScript using function signatures instead of Function for safer code.

typescript

Subject vs BehaviorSubject in RxJS: What’s the Difference?

Learn the difference between Subject and BehaviorSubject in RxJS, including current value behavior, subscriptions, and real examples.

typescriptangularrxjsbehaviorsubject

Suppress TypeScript Errors for One Line: TSLint vs TypeScript

Learn why TSLint disable comments do not suppress TypeScript type errors, and safely handle untyped jQuery plugin properties per line.

typescriptjavascriptjquerysummernote

Testing Private Methods in Angular TypeScript with Jasmine

Learn practical ways to test Angular TypeScript classes with Jasmine, including private methods, public behavior, spies, and true #private fields.

typescriptangularunit-testingjasmine

TypeScript Arrow Functions with Generics: Syntax and Examples

Learn the syntax for generic arrow functions in TypeScript with clear examples, pitfalls, and practical usage in real code.

typescript

TypeScript Class Initialization and Field Initializers

Learn how to initialize TypeScript classes, set fields, and use constructors or object assignment instead of C#-style object initializers.

typescript

TypeScript Comments and JSDoc Documentation Syntax

Learn TypeScript comment syntax, JSDoc documentation comments, and how triple-slash directives differ from C# XML documentation comments.

typescriptcomments

Page 6 of 9 - 162 questions