[{"data":1,"prerenderedAt":224},["ShallowReactive",2],{"term-i\u002Finterface":3,"related-i\u002Finterface":210},{"id":4,"title":5,"acronym":6,"body":7,"category":192,"description":193,"difficulty":194,"extension":195,"letter":196,"meta":197,"navigation":104,"path":198,"related":199,"seo":204,"sitemap":205,"stem":208,"subcategory":6,"__hash__":209},"terms\u002Fterms\u002Fi\u002Finterface.md","Interface",null,{"type":8,"value":9,"toc":186},"minimark",[10,15,19,23,26,30,175,179,182],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"An interface is like a job description. It says 'whatever fills this role must be able to do X, Y, and Z' without caring how they do it. A human or a robot can both fill the role as long as they meet the requirements.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"An interface defines a contract — a set of method signatures and property shapes that a class or object must implement. It enables polymorphism and decoupled code by programming to abstractions rather than concrete implementations.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F TypeScript interface\ninterface Animal {\n  name: string;\n  speak(): string;\n}\n\nclass Dog implements Animal {\n  name = \"Rex\";\n  speak() { return \"Woof!\"; }\n}\n","typescript","",[38,39,40,49,64,80,93,99,106,122,142,170],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F TypeScript interface\n",[41,50,52,56,60],{"class":43,"line":51},2,[41,53,55],{"class":54},"spNyl","interface",[41,57,59],{"class":58},"sBMFI"," Animal",[41,61,63],{"class":62},"sMK4o"," {\n",[41,65,67,71,74,77],{"class":43,"line":66},3,[41,68,70],{"class":69},"swJcz","  name",[41,72,73],{"class":62},":",[41,75,76],{"class":58}," string",[41,78,79],{"class":62},";\n",[41,81,83,86,89,91],{"class":43,"line":82},4,[41,84,85],{"class":69},"  speak",[41,87,88],{"class":62},"():",[41,90,76],{"class":58},[41,92,79],{"class":62},[41,94,96],{"class":43,"line":95},5,[41,97,98],{"class":62},"}\n",[41,100,102],{"class":43,"line":101},6,[41,103,105],{"emptyLinePlaceholder":104},true,"\n",[41,107,109,112,115,118,120],{"class":43,"line":108},7,[41,110,111],{"class":54},"class",[41,113,114],{"class":58}," Dog",[41,116,117],{"class":54}," implements",[41,119,59],{"class":58},[41,121,63],{"class":62},[41,123,125,127,130,133,137,140],{"class":43,"line":124},8,[41,126,70],{"class":69},[41,128,129],{"class":62}," =",[41,131,132],{"class":62}," \"",[41,134,136],{"class":135},"sfazB","Rex",[41,138,139],{"class":62},"\"",[41,141,79],{"class":62},[41,143,145,147,150,153,157,159,162,164,167],{"class":43,"line":144},9,[41,146,85],{"class":69},[41,148,149],{"class":62},"()",[41,151,152],{"class":62}," {",[41,154,156],{"class":155},"s7zQu"," return",[41,158,132],{"class":62},[41,160,161],{"class":135},"Woof!",[41,163,139],{"class":62},[41,165,166],{"class":62},";",[41,168,169],{"class":62}," }\n",[41,171,173],{"class":43,"line":172},10,[41,174,98],{"class":62},[11,176,178],{"id":177},"when-youll-hear-this","When You'll Hear This",[16,180,181],{},"\"Define an interface for the payment provider so we can swap Stripe for PayPal later.\" \u002F \"That class doesn't implement the interface correctly.\"",[183,184,185],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":51,"depth":51,"links":187},[188,189,190,191],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":177,"depth":51,"text":178},"general","An interface is like a job description. It says 'whatever fills this role must be able to do X, Y, and Z' without caring how they do it.","intermediate","md","i",{},"\u002Fterms\u002Fi\u002Finterface",[200,201,202,203],"Generic","OOP","Class","Type Inference",{"title":5,"description":193},{"changefreq":206,"priority":207},"weekly",0.7,"terms\u002Fi\u002Finterface","rbJYxpYx9aaoQq9VXLSwA0YxYxGEZmwPK6gtborlYDs",[211,215,218,221],{"title":202,"path":212,"acronym":6,"category":192,"difficulty":213,"description":214},"\u002Fterms\u002Fc\u002Fclass","beginner","A class is a blueprint for creating objects.",{"title":200,"path":216,"acronym":6,"category":192,"difficulty":194,"description":217},"\u002Fterms\u002Fg\u002Fgeneric","A generic is like a recipe that works for any ingredient.",{"title":201,"path":219,"acronym":201,"category":192,"difficulty":194,"description":220},"\u002Fterms\u002Fo\u002Foop","OOP is a way of organising code by modelling the world as objects — things that have properties (what they are) and methods (what they do).",{"title":203,"path":222,"acronym":6,"category":192,"difficulty":194,"description":223},"\u002Fterms\u002Ft\u002Ftype-inference","Type inference is the compiler being smart enough to figure out what type something is without you having to spell it out.",1776518289176]