NOTA: Chequear el repo de github, ahi estan todos los ejemplos separados lo mas posible

PRIMITIVOS

const nombre: string = ‘Juan’;

COMPUESTOS ESTRUCTURADOS

//Params tipo number, retorna un number
function sumar(a: number, b: number): number {
	return a+b;
}

const dividir = (a: number, b: number) => a / b;

function saludar(nombre: string = "Mateo", edad: number = 21): string {
	return "Hola, soy ${nombre} y mi edad es ${edad}";
}

DEFINIDOS POR USUARIO

CHEQUEAR 03_DEFINED_BY_USER

class Persona {
	nombre: string;
	
	constructor(nombre: string) {
		this.nombre = nombre;
	}
	
	saludar(){
		console.log("hola, soy ${this.nombre}");
	}
}
//interfaz basica
interface Persona {
	nombre: string;
	edad: number;
}

//i. con props opcionales
interface Persona {
	nombre: string;
	edad: number;
	descripcion?: string;
}

//i. para funciones
interface Comparador {
	(a: number, b: number): boolean;
}

//i. para clase
interface Persona {
	nombre: string;
	edad: number;
	saludar(): void;
}