Files
TEST/error.ts
2025-08-29 11:12:30 +07:00

45 lines
702 B
TypeScript

function add(a: number, b: number): number {
return a + b
}
const result = add('1', 2);
console.log(result)
let unusedVar: string;
function getString(): number {
return "hello"
}
let neverUsed = 123;
let x: any = "abc";
let y: number = x as number;
let a = 5;
function shadow() {
let a = "shadowed";
return a;
}
function noReturnType() {
return true;
}
interface User {
name: string;
age: number;
}
const user: User = { name: "A", age: "20" };
const arr: number[] = [1, "2", 3];
function unreachable() {
return 1;
console.log("This will never run");
}
function useAny(a: any, b: any): any {
return a + b;
}