-
Notifications
You must be signed in to change notification settings - Fork 0
Inference and type annotations
Jorge Castro edited this page Nov 10, 2025
·
1 revision
let count = 10;
let message = "Hello World!";
let isActive = true;
let items = [1, 2, 3, 4, 5];
let user = { name: "Alice", age: 30 };let total: number = 100;
let greeting: string = "Welcome!";
let isLoggedIn: boolean = false;
let numbers: number[] = [10, 20, 30];
let fruits: Array<string> = ["apple", "banana", "cherry"];
let profile: { username: string; email: string } = { username: "bob", email: "bob@example.com" };function greetUser(name: string) {
return `Hi, ${name}!`;
}
const multiply = (x: number, y: number) => x * y;
function add(a: number, b: number) {
return a + b;
}declare function format(value: number): string;
function addNumbers(a, b) {
return a + b;
}
function addValues(a: number, b: string) {
return a + b;
}
function greetPerson(name) {
return `Hi, ${name}!`;
}
function multiplyValues(a: number, b: number) {
return format(a * b);
}- Sync-Obsidian-with-GitHub-on-iOS
- Obsidian-community-plugins
- Optimizing-Novel-Word-Count-Plugin-for-Git-Users
- What is TypeScript, and why you should use it
- Quick setup
- Inference and type annotations
- Fundamental Types
- Object Types
- Union Types
- Type Aliases and Interfaces
- Type Assertions
- Literal Types
- null and undefined
- Narrowing
- Creating Types from Types
- Common Built‐in and Utility Types
- tsc CLI ‐ (The Compiler)
- Avoid using Object or {}
- Ignoring TypeScript errors
- TypeScript resources