Run ❯
Get your own Node server
❯Run Code Ctrl+Alt+R
Change Orientation Ctrl+Alt+O
Change Theme Ctrl+Alt+D
Go to Spaces Ctrl+Alt+P
// Conditional types (runtime illustration) type IsString
= T extends string ? true : false; type ArrayElement
= T extends (infer U)[] ? U : never; const arr = [1, 2, 3]; console.log(typeof arr[0]); // 'number' function isString(x: unknown): boolean { return typeof x === "string"; } console.log(isString("hello")); // true console.log(isString(42)); // false
number true false