Aşama 2 Soru 6

Anonymous
TypeScript
11/03/2025 5:54 PM
398 B
18
Indexable
Never
type Brand<K, T> = K & { __brand: T };
type UserID = Brand<string, "UserID">;
type PostID = Brand<string, "PostID">;

function logID(id: string) { console.log(id); }

let userID = "user-123" as UserID;
let postID = "post-456" as PostID;

logID(userID);
logID(postID); 

// @ts-expect-error - Bu atamanın HATA vermesi beklenir
userID = postID;

console.log("Soru 16 Başarılı!");
Editor is loading...
Leave a Comment