[{"data":1,"prerenderedAt":188},["ShallowReactive",2],{"term-t\u002Ftype-inference":3,"related-t\u002Ftype-inference":174},{"id":4,"title":5,"acronym":6,"body":7,"category":155,"description":156,"difficulty":157,"extension":158,"letter":159,"meta":160,"navigation":161,"path":162,"related":163,"seo":168,"sitemap":169,"stem":172,"subcategory":6,"__hash__":173},"terms\u002Fterms\u002Ft\u002Ftype-inference.md","Type Inference",null,{"type":8,"value":9,"toc":149},"minimark",[10,15,24,28,31,35,138,142,145],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18,19,23],"p",{},"Type inference is the compiler being smart enough to figure out what type something is without you having to spell it out. You write ",[20,21,22],"code",{},"x = 5"," and it thinks 'oh, that's obviously a number, I got it.' Less typing, same safety.",[11,25,27],{"id":26},"real-talk","Real Talk",[16,29,30],{},"Type inference is a compiler feature that automatically deduces the type of an expression without explicit annotations. Languages like TypeScript, Rust, and Kotlin use it extensively so you get static type safety without the verbosity of Java-style annotations.",[11,32,34],{"id":33},"show-me-the-code","Show Me The Code",[36,37,42],"pre",{"className":38,"code":39,"language":40,"meta":41,"style":41},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F TypeScript infers the type automatically\nconst name = \"Alice\"; \u002F\u002F inferred: string\nconst age = 30;       \u002F\u002F inferred: number\nconst scores = [1, 2, 3]; \u002F\u002F inferred: number[]\n","typescript","",[20,43,44,53,84,103],{"__ignoreMap":41},[45,46,49],"span",{"class":47,"line":48},"line",1,[45,50,52],{"class":51},"sHwdD","\u002F\u002F TypeScript infers the type automatically\n",[45,54,56,60,64,68,71,75,78,81],{"class":47,"line":55},2,[45,57,59],{"class":58},"spNyl","const",[45,61,63],{"class":62},"sTEyZ"," name ",[45,65,67],{"class":66},"sMK4o","=",[45,69,70],{"class":66}," \"",[45,72,74],{"class":73},"sfazB","Alice",[45,76,77],{"class":66},"\"",[45,79,80],{"class":66},";",[45,82,83],{"class":51}," \u002F\u002F inferred: string\n",[45,85,87,89,92,94,98,100],{"class":47,"line":86},3,[45,88,59],{"class":58},[45,90,91],{"class":62}," age ",[45,93,67],{"class":66},[45,95,97],{"class":96},"sbssI"," 30",[45,99,80],{"class":66},[45,101,102],{"class":51},"       \u002F\u002F inferred: number\n",[45,104,106,108,111,113,116,119,122,125,127,130,133,135],{"class":47,"line":105},4,[45,107,59],{"class":58},[45,109,110],{"class":62}," scores ",[45,112,67],{"class":66},[45,114,115],{"class":62}," [",[45,117,118],{"class":96},"1",[45,120,121],{"class":66},",",[45,123,124],{"class":96}," 2",[45,126,121],{"class":66},[45,128,129],{"class":96}," 3",[45,131,132],{"class":62},"]",[45,134,80],{"class":66},[45,136,137],{"class":51}," \u002F\u002F inferred: number[]\n",[11,139,141],{"id":140},"when-youll-hear-this","When You'll Hear This",[16,143,144],{},"\"TypeScript's type inference caught a bug I didn't even annotate for.\" \u002F \"Rust's type inference is incredibly powerful.\"",[146,147,148],"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 .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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":41,"searchDepth":55,"depth":55,"links":150},[151,152,153,154],{"id":13,"depth":55,"text":14},{"id":26,"depth":55,"text":27},{"id":33,"depth":55,"text":34},{"id":140,"depth":55,"text":141},"general","Type inference is the compiler being smart enough to figure out what type something is without you having to spell it out.","intermediate","md","t",{},true,"\u002Fterms\u002Ft\u002Ftype-inference",[164,165,166,167],"Dynamic Typing","Generic","Interface","Variable",{"title":5,"description":156},{"changefreq":170,"priority":171},"weekly",0.7,"terms\u002Ft\u002Ftype-inference","aEZxD-J3U0yKqrcyrPxRFgLh_DhXJ3RGWWNCHFqfjn8",[175,178,181,184],{"title":164,"path":176,"acronym":6,"category":155,"difficulty":157,"description":177},"\u002Fterms\u002Fd\u002Fdynamic-typing","Dynamic typing is like a box that can hold anything — toys, food, or a cat — and you don't have to label what goes in it ahead of time.",{"title":165,"path":179,"acronym":6,"category":155,"difficulty":157,"description":180},"\u002Fterms\u002Fg\u002Fgeneric","A generic is like a recipe that works for any ingredient.",{"title":166,"path":182,"acronym":6,"category":155,"difficulty":157,"description":183},"\u002Fterms\u002Fi\u002Finterface","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.",{"title":167,"path":185,"acronym":6,"category":155,"difficulty":186,"description":187},"\u002Fterms\u002Fv\u002Fvariable","beginner","A variable is a named box where you store information.",1776518320567]