We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// Common 인터페이스 정의 interface Common { name: string; } // 제네릭 타입 매개변수를 Common으로 지정 function showName<T extends Common>(data: T): string { return data.name; } // 사용 예시 const user = { name: "a", age: 10 }; const car = { name: "bmw", color: "red" }; const book = { name: "TypeScript Handbook", price: 3000 }; console.log(showName(user)); // 출력: "a" console.log(showName(car)); // 출력: "bmw" console.log(showName(book)); // 출력: "TypeScript Handbook"
The text was updated successfully, but these errors were encountered:
4BFC
No branches or pull requests
index
The text was updated successfully, but these errors were encountered: