Typescript

¡Supera tus tareas y exámenes ahora con Quizwiz!

type erasure

The process by which the Typescript compiler removes type annotations & interface definitions, when generating the compiled javascript code.

type inference

The process by which types are determined at compile time in the absence of explicit type annotations.

best common type

The best common type includes all properties with the same name and types that are present in all the values in the expression.

contextual typing

When the compiler bases its types on the location of the expression. window.onclick = function(event) { //var button = event.button; }

widened types

When the result of an expression / function call / assignment is null or undefined, the inferred type for the variable is the "widened" type any. examples of widening types: var foo = undefined; // foo is an any var foo = null; // foo is an any var foo = fnThatReturnsNull(); // foo is an any

structural typing

a flavor of typechecking that enforces that the **shape** of a thing meets a given contract (interface / type definition). contrast w/nominal typing (instanceOf check)

ambient declarations

a system for specifying types for external js libraries. uses the "declare" keyword, to expose typing information to the TS compiler.

interface extensibility

all interface definition blocks from the same common root are combined into a single type.

.d.ts convention

ambient type declarations are contained in files that end in .d.ts each module / var / function / class / enum in the file must be preceded with a 'declare' keyword, and this is enforced by the TS compiler.

declare keyword

tells TS compiler that the following code block contains only type information and no implementation used for ambient declarations

duplicate identifier error

thrown by TS detects multiple post-compile identifiers with the same name.


Conjuntos de estudio relacionados

Theology Chapter 2 Test 10/26/20

View Set

ANATOMY Exam #2: The Lungs & Mediastinum

View Set

Ch 28: Obstructive Pulmonary Diseases

View Set

2018 Core Practice Exam (9th Edition Manual)

View Set

The Point Assessing Head and Neck

View Set

Evolve Adaptive Quiz: Med-Surg, Respiratory

View Set