50 Fun Facts About TypeScript
Learn something new, then test yourself with the quiz.
Know these facts? Prove it.
Take the 50-question quizWhich company unveiled TypeScript in October 2012 after two years of internal development on the language?
Microsoft built the language because its own teams and its customers were struggling to write very large applications in JavaScript. The first public release was called version 0.8.
In 2025 TypeScript's team announced a port of its compiler, promising tenfold faster builds, to which language?
Go was chosen for the native compiler, which until then had been written in TypeScript itself and run as ordinary JavaScript.
What happens to the type annotations in a TypeScript program when the compiler turns it into JavaScript?
They are erased, because type annotations are not part of JavaScript. The annotations exist only to catch mistakes before the program runs.
Which editor's 1.5-million-line TypeScript codebase was checked ten times faster in early tests of the native compiler?
Visual Studio Code is built largely in TypeScript, and a full check of it that had taken 78 seconds finished in under eight with the new compiler.
Which web framework did Google rewrite from the ground up as a TypeScript-based successor to its JavaScript original?
Angular replaced the older AngularJS, and the team dropped the JS from the name so that developers could tell the two frameworks apart.
Which TypeScript type switches off checking for a value, so every property access or call on it is allowed?
The any type tells the compiler to stop checking a value altogether. The compiler also falls back on it when it cannot work out a type, which the noImplicitAny option reports as an error.
Which command, installed by the typescript npm package, checks a .ts file and compiles it into plain JavaScript?
The tsc command is the TypeScript compiler. Run on hello.ts, it writes a hello.js file beside it that looks much like code a person would have written by hand.
Which file tells the compiler that a directory is the root of a TypeScript project and lists the options to use?
A tsconfig.json file is found automatically: started with no input files, the compiler searches the current directory and then each parent directory in turn until it finds one.
Which TypeScript feature, written with angle brackets as in Array<string>, lets one function work over many types?
Generics let a function capture the type it is handed, so an identity function given a string is known to hand a string back, without the checking being switched off.
Which TypeScript keyword names an object type that can later be re-opened to add new properties?
An interface can be written again under the same name and the two definitions merge, which is how extra fields are added to built-in objects such as Window.
Which TypeScript keyword defines a set of named constants, such as the directions Up, Down, Left and Right?
An enum counts its members up from zero unless told otherwise. Unlike most TypeScript features, it is a real object that still exists when the program runs.
Which character sits between two TypeScript types to form a union, so a value may be a string or a boolean?
A vertical bar joins the member types of a union. The compiler then permits only the operations that are valid for every member, until the code checks which one it has.
TypeScript annotations put a type after the variable's name, the reverse of Java, with which character between the two?
A colon follows the name, as in let myName: string. TypeScript avoids the types-on-the-left style of C and Java, where the same line would start with the type.
Which file extension must a TypeScript file have before it can contain JSX, the HTML-like syntax made popular by React?
Only this extension tells the compiler to expect JSX. In .tsx files the older angle-bracket way of telling the compiler a value's type is banned, because it would be mistaken for a tag.
Which TypeScript modifier stops a property from being reassigned, although an object stored in it can still be changed?
The readonly flag is ignored when two types are compared for compatibility, so the same value can still be changed through a second reference whose type lacks the modifier.
Which TypeScript keyword labels a class that cannot be instantiated directly and serves only as a base for subclasses?
An abstract class can leave methods without a body, and a subclass must supply every one of them before objects can be created from it.
Which TypeScript visibility modifier lets a class member be used by subclasses but hides it from outside code?
A protected member is visible only inside its class and subclasses. A subclass is free to open the door wider, though, by redefining the same member as public.
Which TypeScript annotation describes an array of numeric values like [1, 2, 3], as shorthand for the longer Array form?
Writing number[] means exactly the same as Array<number>. The lookalike [number] is a different thing: an array type that holds exactly one element.
Which kind of TypeScript array type knows exactly how many elements it holds and which type sits at each position?
A tuple such as [string, boolean] fixes both length and order, so the compiler reports an error when code reads a position past the end.
What is it called when TypeScript works out a variable's type from its starting value, with no annotation written?
Inference means a variable started with the text Alice is treated as a string without a word of annotation. The same goes for default parameter values and for what a function hands back.
Which single TypeScript compiler option switches on a whole family of tighter type-checking rules at once?
The strict option turns on the whole family together, including noImplicitAny and strictNullChecks, and each member can still be switched off individually.
In TypeScript, what is a line such as type UserID = string, which gives a type a reusable name, called?
An alias only names a type and creates nothing new, so two of them describing the same shape are fully interchangeable.
Which TypeScript feature, written as an @ sign and a name above a class or method, attaches extra behaviour to it?
Decorators are functions called with details of whatever they are attached to. TypeScript offered them as an experiment for years before version 5.0 added the design proposed for JavaScript itself.
Type definitions from the DefinitelyTyped repository are published to npm under which scope, as in the React package?
The @types scope holds definitions for thousands of libraries, each under the same name as the package it describes, so React's types install as @types/react.
What is the TypeScript website's online editor, for trying the language in a browser with nothing installed, called?
The Playground can also share a piece of code as a link, or hand it on to outside tools such as CodeSandbox and StackBlitz.
Which Danish engineer, author of Turbo Pascal and lead architect of C#, went on to design TypeScript?
Anders Hejlsberg wrote a Pascal compiler for the Nascom microcomputer while still at university, and Borland later licensed it and sold it as Turbo Pascal.
Which JavaScript runtime, co-created by Node.js founder Ryan Dahl, supports TypeScript files out of the box?
Deno was unveiled in a 2018 conference talk in which Dahl listed ten things he regretted about the design of Node.js.
Which TypeScript type accepts every possible value but allows nothing to be done with it until its type is checked?
The unknown type is the safe counterpart of switching checks off: a value can be stored in it freely, yet calling it or reading a property from it is an error.
Which TypeScript type describes a function that always throws an exception, so no value ever comes back from it?
The never type stands for values that cannot occur. It also appears once every member of a union has been ruled out, which makes it handy for proving that a switch covers each case.
TypeScript judges two types compatible by comparing their members, not their names: what is this approach called?
Structural typing means an object fits a type whenever it has the required members, with no need to say so in the code. It is often nicknamed duck typing.
What does TypeScript call refining a value that may be a string or a boolean to plain string inside a typeof check?
Narrowing follows the code's own if statements and returns, so inside the checked branch the compiler lets string methods be called on the value without complaint.
Which TypeScript operator takes an object type and produces a union of the names of its properties?
The keyof operator applied to an object with x and y properties gives a type whose only members are the names x and y, which lets a function accept only real property names.
Which built-in TypeScript utility type builds a version of an object type in which every property is optional?
Partial suits update functions, where a caller passes only the fields to change. Its opposite, Required, makes every property compulsory.
Which built-in TypeScript utility type copies an object type but removes the properties whose names are listed?
Omit is the opposite of Pick, which keeps only the listed properties. Exclude sounds similar but removes members from a union instead.
Which TypeScript utility type describes an object whose keys are all one given type and whose values are another?
Record takes two type arguments, keys first and values second, so a table from cat names to cat details can be written in a single short line.
Which built-in TypeScript utility type extracts the type of value that a given function type hands back?
ReturnType is often paired with typeof, so the result of an existing function can be reused as a type without being written out by hand.
What does TypeScript call a combination written Colorful & Circle, which has all the members of both?
An intersection type has every member of both parts, so a value of it needs a color and a radius alike. The idea is mainly used to combine existing object types.
What does TypeScript call adding the words as HTMLCanvasElement after a value, to tell the compiler what it really is?
A type assertion is taken on trust: nothing tests it while the program runs, so a wrong one fails silently instead of raising an error.
Which character, written after a TypeScript expression, tells the compiler the value is neither null nor undefined?
An exclamation point after an expression strips null and undefined from its type with no check at all, so it is safe only when the value is certain to exist.
By default, what does the TypeScript compiler do about its JavaScript file when the code being checked has type errors?
Generates it anyway: the reasoning is that working JavaScript being moved over to TypeScript should not be stopped from running by type errors. A separate compiler option reverses this.
What is a .d.ts document in a TypeScript project, which holds type information only and no runnable code, called?
A declaration file describes code that lives elsewhere. The compiler learns JavaScript's own built-in functions this way, from files named on the pattern lib.something.d.ts.
Which extra files, emitted beside compiled JavaScript, let a debugger show the original TypeScript as a program runs?
Source maps are saved next to each output file with the ending .js.map, and they are switched on by a compiler option of the same name.
Which adjective describes a TypeScript union whose members share a literal property, like kind, that tells them apart?
Discriminated unions let the compiler tell which member it is dealing with from one check of the shared property, as when a shape's kind is either circle or square.
On which code-hosting site was TypeScript first published, before the project moved to GitHub in July 2014?
CodePlex lost the project at the same moment that the team announced a new compiler said to run five times faster than the old one.
What does TypeScript's handbook call rewriting newer JavaScript syntax into an older version of the language, like ES5?
Downleveling is how older versions of the compiler turned a template string into plain string concatenation for browsers that predate 2015. TypeScript 7.0 no longer supports output that old.
A TypeScript function whose result is annotated pet is Fish acts as a custom guard: what is that annotation called?
A type predicate names one of the function's parameters, and whenever the function gives back true the compiler treats that argument as the stated type.
Which operator, new in TypeScript 4.9, checks that an expression matches a type without changing its own type?
The satisfies operator can catch a misspelt property name in an object while each property still keeps its own precise type, such as string for one and an array for another.
What does TypeScript call a construct that loops over the property names of an existing object shape to build a new one?
A mapped type walks through each property name in turn, and it can add or remove modifiers on the way, for instance stripping the optional flag from every property.
Under which internal codename did Luke Hoban begin work on TypeScript straight after finishing F# 2.0?
Strada was the working name, and Hoban has said that his time on F# shaped early parts of the new language's design.
Which TypeScript construct for grouping related code was known as an internal module before version 1.5?
A namespace replaced the older term to match the wording of the ECMAScript 2015 standard, and what had been called external modules became simply modules.
Think you know TypeScript?
Put these facts to the test with the interactive quiz.
Take the 50-question quizTeaching TypeScript?
Make a custom quiz — handy for classrooms and study groups.
Make a quiz on anything