[{"data":1,"prerenderedAt":478},["ShallowReactive",2],{"navigation_docs":3,"diagnostic-content-TS0016":48},[4,8,12,16,20,24,28,32,36,40,44],{"title":5,"path":6,"stem":7},"CLI","\u002Fcli","1.cli",{"title":9,"path":10,"stem":11},"Nuxt","\u002Fnuxt","2.nuxt",{"title":13,"path":14,"stem":15},"Vue","\u002Fvue","3.vue",{"title":17,"path":18,"stem":19},"Vite","\u002Fvite","4.vite",{"title":21,"path":22,"stem":23},"Nitro","\u002Fnitro","5.nitro",{"title":25,"path":26,"stem":27},"TypeScript","\u002Ftypescript","6.typescript",{"title":29,"path":30,"stem":31},"shadcn","\u002Fshadcn","7.shadcn",{"title":33,"path":34,"stem":35},"Package","\u002Fpackage","8.package",{"title":37,"path":38,"stem":39},"Extending Doctor","\u002Fextending","9.extending",{"title":41,"path":42,"stem":43},"MCP","\u002Fmcp","9.mcp",{"title":45,"path":46,"stem":47},"Pinia","\u002Fpinia","9.pinia",{"id":49,"title":50,"body":51,"category":57,"code":467,"description":468,"docsUrl":58,"extension":469,"fix":470,"framework":471,"meta":472,"navigation":318,"pack":60,"path":473,"ruleId":61,"rulePath":62,"seo":474,"severity":63,"source":64,"sourceUrl":65,"stem":475,"why":476,"__hash__":477},"diagnostics\u002Fdiagnostics\u002FTS0016.md","TS0016: Do not use instanceof for JavaScript built-ins from another realm",{"type":52,"value":53,"toc":457},"minimark",[54,66,71,88,92,113,117,122,125,231,234,388,392,395,425,429,441,445,453],[55,56],"rule-metadata",{"category":57,"docsUrl":58,"fix":59,"pack":60,"ruleId":61,"rulePath":62,"severity":63,"source":64,"sourceUrl":65},"boundaries","https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FOperators\u002Finstanceof#instanceof_and_multiple_realms","structural-review","vite-doctor\u002Ftypescript","typescript\u002Fboundaries\u002Fno-cross-realm-builtin-instanceof","\u002Ftypescript\u002Frules\u002Fboundaries\u002Fno-cross-realm-builtin-instanceof","warn","src\u002Frule-packs\u002Ftypescript\u002Frules\u002Fno-cross-realm-builtin-instanceof.ts","https:\u002F\u002Fgithub.com\u002Fonmax\u002Fvite-doctor\u002Fblob\u002Fmain\u002Fsrc\u002Frule-packs\u002Ftypescript\u002Frules\u002Fno-cross-realm-builtin-instanceof.ts",[67,68,70],"h2",{"id":69},"why-it-happens","Why it happens",[72,73,74,75,79,80,83,84,87],"p",{},"Error, Date, Map, Set, RegExp, Promise, Array, Function and Object have one constructor per realm. A value created in a node:vm context, an iframe, or a Vitest vmThreads or vmForks pool fails instanceof against this realm's class, so the check takes the wrong branch. Values from the Vite module runner, a duplicated package, a worker or ",[76,77,78],"code",{},"structuredClone()"," are built with this realm's built-ins, so most of these checks never see a foreign value, and the rule reports them at low confidence. It only reports values that crossed a boundary in this file: parameters typed unknown or any, results of calling a parameter, and module namespaces from ",[76,81,82],{},"import()"," or ",[76,85,86],{},"ssrLoadModule()",". A parameter of a function that the file neither exports nor passes around is skipped when every call passes a value proven local, such as a literal or an object constructed with an unshadowed built-in. Catching an error does not establish its origin.",[67,89,91],{"id":90},"fix","Fix",[72,93,94,95,98,99,102,103,106,107,83,109,112],{},"Use the realm-safe check: Array.",[76,96,97],{},"isArray(value)"," for arrays, typeof value === 'function' for functions, Error.",[76,100,101],{},"isError(value)"," or an Object.prototype.toString.",[76,104,105],{},"call(value)"," brand check in a guard helper such as ",[76,108,101],{},[76,110,111],{},"isDate(value)"," for the rest.",[67,114,116],{"id":115},"example","Example",[118,119,121],"h3",{"id":120},"brand-check-errors-from-a-sandbox","Brand-check errors from a sandbox",[72,123,124],{},"Before",[126,127,132],"pre",{"className":128,"code":129,"language":130,"meta":131,"style":131},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export function toSandboxError(error: unknown): Error {\n  if (error instanceof Error) return error\n  return new Error(String(error))\n}\n","ts","",[76,133,134,175,202,225],{"__ignoreMap":131},[135,136,139,143,147,151,155,159,162,166,169,172],"span",{"class":137,"line":138},"line",1,[135,140,142],{"class":141},"s7zQu","export",[135,144,146],{"class":145},"spNyl"," function",[135,148,150],{"class":149},"s2Zo4"," toSandboxError",[135,152,154],{"class":153},"sMK4o","(",[135,156,158],{"class":157},"sHdIc","error",[135,160,161],{"class":153},":",[135,163,165],{"class":164},"sBMFI"," unknown",[135,167,168],{"class":153},"):",[135,170,171],{"class":164}," Error",[135,173,174],{"class":153}," {\n",[135,176,178,181,185,188,191,193,196,199],{"class":137,"line":177},2,[135,179,180],{"class":141},"  if",[135,182,184],{"class":183},"swJcz"," (",[135,186,158],{"class":187},"sTEyZ",[135,189,190],{"class":153}," instanceof",[135,192,171],{"class":164},[135,194,195],{"class":183},") ",[135,197,198],{"class":141},"return",[135,200,201],{"class":187}," error\n",[135,203,205,208,211,213,215,218,220,222],{"class":137,"line":204},3,[135,206,207],{"class":141},"  return",[135,209,210],{"class":153}," new",[135,212,171],{"class":149},[135,214,154],{"class":183},[135,216,217],{"class":149},"String",[135,219,154],{"class":183},[135,221,158],{"class":187},[135,223,224],{"class":183},"))\n",[135,226,228],{"class":137,"line":227},4,[135,229,230],{"class":153},"}\n",[72,232,233],{},"After",[126,235,237],{"className":128,"code":236,"language":130,"meta":131,"style":131},"function isError(value: unknown): value is Error {\n  return Object.prototype.toString.call(value) === '[object Error]'\n}\n\nexport function toSandboxError(error: unknown): Error {\n  if (isError(error)) return error\n  return new Error(String(error))\n}\n",[76,238,239,268,310,314,320,343,364,383],{"__ignoreMap":131},[135,240,241,244,247,249,252,254,256,258,261,264,266],{"class":137,"line":138},[135,242,243],{"class":145},"function",[135,245,246],{"class":149}," isError",[135,248,154],{"class":153},[135,250,251],{"class":157},"value",[135,253,161],{"class":153},[135,255,165],{"class":164},[135,257,168],{"class":153},[135,259,260],{"class":157}," value",[135,262,263],{"class":153}," is",[135,265,171],{"class":164},[135,267,174],{"class":153},[135,269,270,272,275,278,281,283,286,288,291,293,295,297,300,303,307],{"class":137,"line":177},[135,271,207],{"class":141},[135,273,274],{"class":164}," Object",[135,276,277],{"class":153},".",[135,279,280],{"class":187},"prototype",[135,282,277],{"class":153},[135,284,285],{"class":187},"toString",[135,287,277],{"class":153},[135,289,290],{"class":149},"call",[135,292,154],{"class":183},[135,294,251],{"class":187},[135,296,195],{"class":183},[135,298,299],{"class":153},"===",[135,301,302],{"class":153}," '",[135,304,306],{"class":305},"sfazB","[object Error]",[135,308,309],{"class":153},"'\n",[135,311,312],{"class":137,"line":204},[135,313,230],{"class":153},[135,315,316],{"class":137,"line":227},[135,317,319],{"emptyLinePlaceholder":318},true,"\n",[135,321,323,325,327,329,331,333,335,337,339,341],{"class":137,"line":322},5,[135,324,142],{"class":141},[135,326,146],{"class":145},[135,328,150],{"class":149},[135,330,154],{"class":153},[135,332,158],{"class":157},[135,334,161],{"class":153},[135,336,165],{"class":164},[135,338,168],{"class":153},[135,340,171],{"class":164},[135,342,174],{"class":153},[135,344,346,348,350,353,355,357,360,362],{"class":137,"line":345},6,[135,347,180],{"class":141},[135,349,184],{"class":183},[135,351,352],{"class":149},"isError",[135,354,154],{"class":183},[135,356,158],{"class":187},[135,358,359],{"class":183},")) ",[135,361,198],{"class":141},[135,363,201],{"class":187},[135,365,367,369,371,373,375,377,379,381],{"class":137,"line":366},7,[135,368,207],{"class":141},[135,370,210],{"class":153},[135,372,171],{"class":149},[135,374,154],{"class":183},[135,376,217],{"class":149},[135,378,154],{"class":183},[135,380,158],{"class":187},[135,382,224],{"class":183},[135,384,386],{"class":137,"line":385},8,[135,387,230],{"class":153},[67,389,391],{"id":390},"verify-the-fix","Verify the fix",[72,393,394],{},"Run only this rule after editing so the report stays focused on the diagnostic you are closing:",[126,396,400],{"className":397,"code":398,"language":399,"meta":131,"style":131},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm vite-doctor . --extends auto,typescript\u002Fstrict --rules typescript\u002Fboundaries\u002Fno-cross-realm-builtin-instanceof\n","bash",[76,401,402],{"__ignoreMap":131},[135,403,404,407,410,413,416,419,422],{"class":137,"line":138},[135,405,406],{"class":164},"pnpm",[135,408,409],{"class":305}," vite-doctor",[135,411,412],{"class":305}," .",[135,414,415],{"class":305}," --extends",[135,417,418],{"class":305}," auto,typescript\u002Fstrict",[135,420,421],{"class":305}," --rules",[135,423,424],{"class":305}," typescript\u002Fboundaries\u002Fno-cross-realm-builtin-instanceof\n",[67,426,428],{"id":427},"useful-links","Useful links",[430,431,432],"ul",{},[433,434,435],"li",{},[436,437,440],"a",{"href":58,"rel":438},[439],"nofollow","Upstream docs",[67,442,444],{"id":443},"related-rule","Related rule",[430,446,447],{},[433,448,449],{},[436,450,451],{"href":62},[76,452,61],{},[454,455,456],"style",{},"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 pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}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);}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}",{"title":131,"searchDepth":177,"depth":177,"links":458},[459,460,461,464,465,466],{"id":69,"depth":177,"text":70},{"id":90,"depth":177,"text":91},{"id":115,"depth":177,"text":116,"children":462},[463],{"id":120,"depth":204,"text":121},{"id":390,"depth":177,"text":391},{"id":427,"depth":177,"text":428},{"id":443,"depth":177,"text":444},"TS0016","Report instanceof checks against JavaScript built-ins, such as Error, Date, Map, RegExp, Promise, Array and Object, on values that may come from another JavaScript realm.","md","Use the realm-safe check: Array.isArray(value) for arrays, typeof value === 'function' for functions, Error.isError(value) or an Object.prototype.toString.call(value) brand check in a guard helper such as isError(value) or isDate(value) for the rest.","typescript",{},"\u002Fdiagnostics\u002Fts0016",{"title":50,"description":468},"diagnostics\u002FTS0016","Error, Date, Map, Set, RegExp, Promise, Array, Function and Object have one constructor per realm. A value created in a node:vm context, an iframe, or a Vitest vmThreads or vmForks pool fails instanceof against this realm's class, so the check takes the wrong branch. Values from the Vite module runner, a duplicated package, a worker or structuredClone() are built with this realm's built-ins, so most of these checks never see a foreign value, and the rule reports them at low confidence. It only reports values that crossed a boundary in this file: parameters typed unknown or any, results of calling a parameter, and module namespaces from import() or ssrLoadModule(). A parameter of a function that the file neither exports nor passes around is skipped when every call passes a value proven local, such as a literal or an object constructed with an unshadowed built-in. Catching an error does not establish its origin.","vGbnN-zLzmKjj66QY5v3qf1GL5uJ1OQ-5VmoBww6X2U",1795268815856]