Aprende TypeScript
Tipos, interfaces, uniones y funciones. Editor Monaco con autocompletado TypeScript, ejecución en el navegador y verificación—aprende practicando.
- Paso 1
TypeScript 1: tipos básicos
Welcome to TypeScript! TypeScript is JavaScript with **types**. Types tell the compiler what kind of...
Comenzar lección - Paso 2
TypeScript 2: arrays tipados
In TypeScript we can type arrays. `string[]` means 'array of strings', and `number[]` means 'array o...
Comenzar lección - Paso 3
TypeScript 3: funciones con tipos
Functions in TypeScript can have types on parameters and return type. `function name(param: type): r...
Comenzar lección - Paso 4
TypeScript 4: tipo Boolean
The `boolean` type can only be `true` or `false`. Perfect for conditionals....
Comenzar lección - Paso 5
TypeScript 5: interfaces
**Interfaces** are like blueprints for objects. Once defined, you can use them to type objects....
Comenzar lección - Paso 6
TypeScript 6: parámetros opcionales
Sometimes we want a parameter to be optional. In TypeScript use `?` after the name: `param?: type`...
Comenzar lección - Paso 7
TypeScript 7: tipos unión
A **union type** allows a variable to be one of several types. Use `|`: `string | number` means 'tex...
Comenzar lección - Paso 8
TypeScript 8: retorno void
Some functions don't return anything (e.g. just log). Use `: void` as the return type....
Comenzar lección - Paso 9
TypeScript 9: tipos literales
A **literal type** means the value can only be exactly that string or number. `"rojo" | "azul" | "ve...
Comenzar lección - Paso 10
TypeScript 10: arrays de objetos tipados
We can create arrays of objects using interfaces. `Persona[]` means 'array of Persona objects'....
Comenzar lección