Skip to main content

Pure Ts Tour ((full)) Here

function isCat(animal: Cat | Dog): animal is Cat return (animal as Cat).meow !== undefined;

// Rest parameters function sumAll(...nums: number[]): number return nums.reduce((acc, n) => acc + n, 0); pure ts tour

// Typed parameters and return value function greet(name: string, greeting?: string): string return `$greeting ?? "Hello", $name`; function isCat(animal: Cat | Dog): animal is Cat