[{"data":1,"prerenderedAt":1029},["ShallowReactive",2],{"navigation_docs":3,"-rpc-devtools-api-types":399},[4,162,346],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":24},"RPC","icon-park-outline:lightning","\u002Frpc","01.rpc",[10,25,63,77,102,136],{"title":11,"icon":12,"redirect":7,"path":13,"stem":14,"children":15,"page":24},"Introduction","icon-park-outline:home","\u002Frpc\u002Fintroduction","01.rpc\u002F01.introduction",[16,20],{"title":17,"path":18,"stem":19},"Quick Start","\u002Frpc\u002Fintroduction\u002Fquick-start","01.rpc\u002F01.introduction\u002F02.quick-start",{"title":21,"path":22,"stem":23},"Manual Install","\u002Frpc\u002Fintroduction\u002Fmanual-install","01.rpc\u002F01.introduction\u002F03.manual-install",false,{"title":26,"icon":27,"path":28,"stem":29,"children":30,"page":24},"Server","icon-park-outline:server","\u002Frpc\u002Fserver","01.rpc\u002F02.server",[31,35,39,43,47,51,55,59],{"title":32,"path":33,"stem":34},"Routes","\u002Frpc\u002Fserver\u002Froutes","01.rpc\u002F02.server\u002F01.routes",{"title":36,"path":37,"stem":38},"Middleware","\u002Frpc\u002Fserver\u002Fmiddleware","01.rpc\u002F02.server\u002F02.middleware",{"title":40,"path":41,"stem":42},"Call Context","\u002Frpc\u002Fserver\u002Fcall-context","01.rpc\u002F02.server\u002F03.call-context",{"title":44,"path":45,"stem":46},"Headers","\u002Frpc\u002Fserver\u002Fheaders","01.rpc\u002F02.server\u002F04.headers",{"title":48,"path":49,"stem":50},"Error Handling","\u002Frpc\u002Fserver\u002Ferror-handling","01.rpc\u002F02.server\u002F05.error-handling",{"title":52,"path":53,"stem":54},"Validation","\u002Frpc\u002Fserver\u002Fvalidation","01.rpc\u002F02.server\u002F06.validation",{"title":56,"path":57,"stem":58},"JSON Round Trip","\u002Frpc\u002Fserver\u002Fjson-round-trip","01.rpc\u002F02.server\u002F07.json-round-trip",{"title":60,"path":61,"stem":62},"Drizzle Tables","\u002Frpc\u002Fserver\u002Fdrizzle-tables","01.rpc\u002F02.server\u002F08.drizzle-tables",{"title":64,"icon":65,"path":66,"stem":67,"children":68,"page":24},"Middlewares","icon-park-outline:link-one","\u002Frpc\u002Fmiddlewares","01.rpc\u002F03.middlewares",[69,73],{"title":70,"path":71,"stem":72},"fetchMetadata","\u002Frpc\u002Fmiddlewares\u002Ffetch-metadata","01.rpc\u002F03.middlewares\u002F01.fetch-metadata",{"title":74,"path":75,"stem":76},"syncRoutes","\u002Frpc\u002Fmiddlewares\u002Fsync-routes","01.rpc\u002F03.middlewares\u002F02.sync-routes",{"title":78,"icon":79,"path":80,"stem":81,"children":82,"page":24},"Client","icon-park-outline:computer","\u002Frpc\u002Fclient","01.rpc\u002F04.client",[83,87,91,94,98],{"title":84,"path":85,"stem":86},"Client Overview","\u002Frpc\u002Fclient\u002Fclient-overview","01.rpc\u002F04.client\u002F00.client-overview",{"title":88,"path":89,"stem":90},"Client Middleware","\u002Frpc\u002Fclient\u002Fclient-middleware","01.rpc\u002F04.client\u002F01.client-middleware",{"title":48,"path":92,"stem":93},"\u002Frpc\u002Fclient\u002Ferror-handling","01.rpc\u002F04.client\u002F02.error-handling",{"title":95,"path":96,"stem":97},"Batch Requests","\u002Frpc\u002Fclient\u002Fbatch","01.rpc\u002F04.client\u002F03.batch",{"title":99,"path":100,"stem":101},"Cancellation & Timeouts","\u002Frpc\u002Fclient\u002Fcancellation-timeouts","01.rpc\u002F04.client\u002F04.cancellation-timeouts",{"title":103,"redirect":104,"icon":105,"path":106,"stem":107,"children":108,"page":24},"Platforms","\u002Frpc\u002Fplatforms\u002Fnode-js","icon-park-outline:play","\u002Frpc\u002Fplatforms","01.rpc\u002F06.platforms",[109,112,116,120,124,128,132],{"title":110,"path":104,"stem":111},"Node.js","01.rpc\u002F06.platforms\u002F01.node-js",{"title":113,"path":114,"stem":115},"Bun","\u002Frpc\u002Fplatforms\u002Fbun","01.rpc\u002F06.platforms\u002F02.bun",{"title":117,"path":118,"stem":119},"AWS Lambda","\u002Frpc\u002Fplatforms\u002Faws-lambda","01.rpc\u002F06.platforms\u002F03.aws-lambda",{"title":121,"path":122,"stem":123},"Google Cloud Functions","\u002Frpc\u002Fplatforms\u002Fgoogle-cloud-functions","01.rpc\u002F06.platforms\u002F04.google-cloud-functions",{"title":125,"path":126,"stem":127},"Cloudflare Workers","\u002Frpc\u002Fplatforms\u002Fcloudflare","01.rpc\u002F06.platforms\u002F05.cloudflare",{"title":129,"path":130,"stem":131},"Vercel","\u002Frpc\u002Fplatforms\u002Fvercel","01.rpc\u002F06.platforms\u002F06.vercel",{"title":133,"path":134,"stem":135},"uWebSockets.js","\u002Frpc\u002Fplatforms\u002Fuwebsockets","01.rpc\u002F06.platforms\u002F07.uwebsockets",{"title":137,"icon":138,"path":139,"stem":140,"children":141,"page":24},"Devtools","icon-park-outline:tool","\u002Frpc\u002Fdevtools","01.rpc\u002F07.devtools",[142,146,150,154,158],{"title":143,"path":144,"stem":145},"Linter","\u002Frpc\u002Fdevtools\u002Flinter","01.rpc\u002F07.devtools\u002F01.linter",{"title":147,"path":148,"stem":149},"Vite","\u002Frpc\u002Fdevtools\u002Fvite","01.rpc\u002F07.devtools\u002F02.vite",{"title":151,"path":152,"stem":153},"Next.js","\u002Frpc\u002Fdevtools\u002Fnextjs","01.rpc\u002F07.devtools\u002F03.nextjs",{"title":155,"path":156,"stem":157},"CLI","\u002Frpc\u002Fdevtools\u002Fcli","01.rpc\u002F07.devtools\u002F04.cli",{"title":159,"path":160,"stem":161},"API Types","\u002Frpc\u002Fdevtools\u002Fapi-types","01.rpc\u002F07.devtools\u002F05.api-types",{"title":163,"icon":164,"path":165,"stem":166,"children":167,"page":24},"RunTypes","i-lucide-braces","\u002Fruntypes","02.runtypes",[168,184,224,254,268,290,332],{"title":11,"icon":169,"redirect":165,"path":170,"stem":171,"children":172,"page":24},"i-lucide-rocket","\u002Fruntypes\u002Fintroduction","02.runtypes\u002F01.introduction",[173,177,180],{"title":174,"path":175,"stem":176},"Built on typescript-go","\u002Fruntypes\u002Fintroduction\u002Fbuilt-on-typescript-go","02.runtypes\u002F01.introduction\u002F02.built-on-typescript-go",{"title":17,"path":178,"stem":179},"\u002Fruntypes\u002Fintroduction\u002Fquick-start","02.runtypes\u002F01.introduction\u002F03.quick-start",{"title":181,"path":182,"stem":183},"Configuration","\u002Fruntypes\u002Fintroduction\u002Fconfiguration","02.runtypes\u002F01.introduction\u002F04.configuration",{"title":185,"icon":186,"redirect":187,"path":188,"stem":189,"children":190,"page":24},"Guide","i-lucide-book-open","\u002Fruntypes\u002Fguide\u002Ftype-builders","\u002Fruntypes\u002Fguide","02.runtypes\u002F02.guide",[191,194,198,201,204,208,212,216,220],{"title":192,"path":187,"stem":193},"Types vs Type Builders","02.runtypes\u002F02.guide\u002F01.type-builders",{"title":195,"path":196,"stem":197},"Reflection","\u002Fruntypes\u002Fguide\u002Freflection","02.runtypes\u002F02.guide\u002F02.reflection",{"title":52,"path":199,"stem":200},"\u002Fruntypes\u002Fguide\u002Fvalidation","02.runtypes\u002F02.guide\u002F03.validation",{"title":56,"path":202,"stem":203},"\u002Fruntypes\u002Fguide\u002Fjson-round-trip","02.runtypes\u002F02.guide\u002F04.json-round-trip",{"title":205,"path":206,"stem":207},"Data Mocking","\u002Fruntypes\u002Fguide\u002Fmocking","02.runtypes\u002F02.guide\u002F07.mocking",{"title":209,"path":210,"stem":211},"JSON Schemas","\u002Fruntypes\u002Fguide\u002Fjson-schemas","02.runtypes\u002F02.guide\u002F08.json-schemas",{"title":213,"path":214,"stem":215},"Pure Functions","\u002Fruntypes\u002Fguide\u002Fpure-functions","02.runtypes\u002F02.guide\u002F09.pure-functions",{"title":217,"path":218,"stem":219},"Compiler Markers","\u002Fruntypes\u002Fguide\u002Fcompiler-markers","02.runtypes\u002F02.guide\u002F10.compiler-markers",{"title":221,"path":222,"stem":223},"All Compiled Functions","\u002Fruntypes\u002Fguide\u002Fall-compiled-functions","02.runtypes\u002F02.guide\u002F11.all-compiled-functions",{"title":225,"icon":226,"redirect":227,"path":228,"stem":229,"children":230,"page":24},"Type Formats","i-lucide-shapes","\u002Fruntypes\u002Ftype-formats\u002Foverview","\u002Fruntypes\u002Ftype-formats","02.runtypes\u002F03.type-formats",[231,234,238,242,246,250],{"title":232,"path":227,"stem":233},"Overview","02.runtypes\u002F03.type-formats\u002F01.overview",{"title":235,"path":236,"stem":237},"String Formats","\u002Fruntypes\u002Ftype-formats\u002Fstring","02.runtypes\u002F03.type-formats\u002F02.string",{"title":239,"path":240,"stem":241},"Number Formats","\u002Fruntypes\u002Ftype-formats\u002Fnumber","02.runtypes\u002F03.type-formats\u002F03.number",{"title":243,"path":244,"stem":245},"BigInt Formats","\u002Fruntypes\u002Ftype-formats\u002Fbigint","02.runtypes\u002F03.type-formats\u002F04.bigint",{"title":247,"path":248,"stem":249},"Date and Time Formats","\u002Fruntypes\u002Ftype-formats\u002Fdate-time","02.runtypes\u002F03.type-formats\u002F05.date-time",{"title":251,"path":252,"stem":253},"Collection Formats","\u002Fruntypes\u002Ftype-formats\u002Fcollections","02.runtypes\u002F03.type-formats\u002F06.collections",{"title":255,"icon":256,"redirect":257,"path":258,"stem":259,"children":260,"page":24},"Tooling","i-lucide-wrench","\u002Fruntypes\u002Ftooling\u002Flinting","\u002Fruntypes\u002Ftooling","02.runtypes\u002F04.tooling",[261,264],{"title":262,"path":257,"stem":263},"Linting","02.runtypes\u002F04.tooling\u002F01.linting",{"title":265,"path":266,"stem":267},"Source Conversion","\u002Fruntypes\u002Ftooling\u002Fsource-conversion","02.runtypes\u002F04.tooling\u002F02.source-conversion",{"title":269,"icon":270,"redirect":271,"path":272,"stem":273,"children":274,"page":24},"AI Integration","i-lucide-sparkles","\u002Fruntypes\u002Fai-integration\u002Fworkflow-and-commands","\u002Fruntypes\u002Fai-integration","02.runtypes\u002F05.ai-integration",[275,278,282,286],{"title":276,"path":271,"stem":277},"AI Workflow","02.runtypes\u002F05.ai-integration\u002F01.workflow-and-commands",{"title":279,"path":280,"stem":281},"FriendlyText","\u002Fruntypes\u002Fai-integration\u002Ffriendly-text","02.runtypes\u002F05.ai-integration\u002F02.friendly-text",{"title":283,"path":284,"stem":285},"MockData","\u002Fruntypes\u002Fai-integration\u002Fmock-data","02.runtypes\u002F05.ai-integration\u002F03.mock-data",{"title":287,"path":288,"stem":289},"Translations (i18n)","\u002Fruntypes\u002Fai-integration\u002Fi18n","02.runtypes\u002F05.ai-integration\u002F04.i18n",{"title":291,"icon":292,"redirect":293,"path":294,"stem":295,"children":296,"page":24},"Drizzle ORM","i-lineicons-drizzle","\u002Fruntypes\u002Fdrizzle-orm\u002Fdrizzle-overview","\u002Fruntypes\u002Fdrizzle-orm","02.runtypes\u002F06.drizzle-orm",[297,300,304,308,312,316,320,324,328],{"title":298,"path":293,"stem":299},"Drizzle Overview","02.runtypes\u002F06.drizzle-orm\u002F00.drizzle-overview",{"title":301,"path":302,"stem":303},"Column Formats","\u002Fruntypes\u002Fdrizzle-orm\u002Fcolumn-formats","02.runtypes\u002F06.drizzle-orm\u002F01.column-formats",{"title":305,"path":306,"stem":307},"Views","\u002Fruntypes\u002Fdrizzle-orm\u002Fviews","02.runtypes\u002F06.drizzle-orm\u002F02.views",{"title":309,"path":310,"stem":311},"Indexes and Constraints","\u002Fruntypes\u002Fdrizzle-orm\u002Fconstraints","02.runtypes\u002F06.drizzle-orm\u002F03.constraints",{"title":313,"path":314,"stem":315},"Row Level Security","\u002Fruntypes\u002Fdrizzle-orm\u002Frow-level-security","02.runtypes\u002F06.drizzle-orm\u002F04.row-level-security",{"title":317,"path":318,"stem":319},"Relations","\u002Fruntypes\u002Fdrizzle-orm\u002Frelations","02.runtypes\u002F06.drizzle-orm\u002F05.relations",{"title":321,"path":322,"stem":323},"The Schema File","\u002Fruntypes\u002Fdrizzle-orm\u002Fschema-file","02.runtypes\u002F06.drizzle-orm\u002F06.schema-file",{"title":325,"path":326,"stem":327},"Migrate an Existing Schema","\u002Fruntypes\u002Fdrizzle-orm\u002Fmigrate-an-existing-schema","02.runtypes\u002F06.drizzle-orm\u002F07.migrate-an-existing-schema",{"title":329,"path":330,"stem":331},"Cloudflare D1 and Durable Objects","\u002Fruntypes\u002Fdrizzle-orm\u002Fcloudflare-storage","02.runtypes\u002F06.drizzle-orm\u002F08.cloudflare-storage",{"title":333,"icon":334,"redirect":335,"path":336,"stem":337,"children":338,"page":24},"Diagnostics","i-lucide-triangle-alert","\u002Fruntypes\u002Fdiagnostics\u002Ferror-levels","\u002Fruntypes\u002Fdiagnostics","02.runtypes\u002F08.diagnostics",[339,342],{"title":340,"path":335,"stem":341},"Error Levels","02.runtypes\u002F08.diagnostics\u002F01.error-levels",{"title":343,"path":344,"stem":345},"All Diagnostics","\u002Fruntypes\u002Fdiagnostics\u002Fall-diagnostics","02.runtypes\u002F08.diagnostics\u002F02.all-diagnostics",{"title":347,"icon":348,"path":349,"stem":350,"children":351,"page":24},"Benchmarks","i-lucide-gauge","\u002Fbenchmarks","03.benchmarks",[352,372],{"title":5,"icon":6,"redirect":353,"path":354,"stem":355,"children":356,"page":24},"\u002Fbenchmarks\u002Frpc\u002Fhello-world","\u002Fbenchmarks\u002Frpc","03.benchmarks\u002F02.rpc",[357,360,364,368],{"title":358,"path":353,"stem":359},"Hello World","03.benchmarks\u002F02.rpc\u002F01.hello-world",{"title":361,"path":362,"stem":363},"Light Validation","\u002Fbenchmarks\u002Frpc\u002Flight-validation","03.benchmarks\u002F02.rpc\u002F02.light-validation",{"title":365,"path":366,"stem":367},"Heavy Validation","\u002Fbenchmarks\u002Frpc\u002Fheavy-validation","03.benchmarks\u002F02.rpc\u002F03.heavy-validation",{"title":369,"path":370,"stem":371},"Payload Sizes","\u002Fbenchmarks\u002Frpc\u002Fpayload-sizes","03.benchmarks\u002F02.rpc\u002F04.payload-sizes",{"title":163,"icon":164,"redirect":373,"path":374,"stem":375,"children":376,"page":24},"\u002Fbenchmarks\u002Fruntypes\u002Fis-valid","\u002Fbenchmarks\u002Fruntypes","03.benchmarks\u002F03.runtypes",[377,380,384,388,392,395],{"title":378,"path":373,"stem":379},"Is Valid","03.benchmarks\u002F03.runtypes\u002F01.is-valid",{"title":381,"path":382,"stem":383},"Is Valid Formats","\u002Fbenchmarks\u002Fruntypes\u002Fis-valid-formats","03.benchmarks\u002F03.runtypes\u002F02.is-valid-formats",{"title":385,"path":386,"stem":387},"Get Errors","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors","03.benchmarks\u002F03.runtypes\u002F03.get-errors",{"title":389,"path":390,"stem":391},"Get Errors Formats","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors-formats","03.benchmarks\u002F03.runtypes\u002F04.get-errors-formats",{"title":56,"path":393,"stem":394},"\u002Fbenchmarks\u002Fruntypes\u002Fjson-round-trip","03.benchmarks\u002F03.runtypes\u002F05.json-round-trip",{"title":396,"path":397,"stem":398},"Type Checking","\u002Fbenchmarks\u002Fruntypes\u002Ftype-checking","03.benchmarks\u002F03.runtypes\u002F07.type-checking",{"id":400,"title":159,"body":401,"description":1023,"extension":1024,"links":1025,"meta":1026,"navigation":795,"path":160,"seo":1027,"stem":161,"__hash__":1028},"docs\u002F01.rpc\u002F07.devtools\u002F05.api-types.md",{"type":402,"value":403},"minimark",[404,412,417,432,485,580,595,599,613,712,722,726,737,847,851,858,862,883,928,946,950,957,1019],[405,406,407,411],"p",{},[408,409,410],"code",{},"mion api-types"," builds a package that holds only your API's types. A client installs it instead of your whole server, and builds against the same ids.",[413,414,416],"h2",{"id":415},"publishing-a-types-only-package","Publishing a Types-Only Package",[405,418,419,420,423,424,427,428,431],{},"Run it from your server project. Its name is your server's plus ",[408,421,422],{},"-types",", and its version is your server's. Change them with ",[408,425,426],{},"--name"," and ",[408,429,430],{},"--version",".",[433,434,439],"pre",{"className":435,"code":436,"language":437,"meta":438,"style":438},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","mion api-types --tsconfig tsconfig.json --out api-types\ncd api-types && npm publish\n","bash","",[408,440,441,466],{"__ignoreMap":438},[442,443,446,450,454,457,460,463],"span",{"class":444,"line":445},"line",1,[442,447,449],{"class":448},"sBMFI","mion",[442,451,453],{"class":452},"sfazB"," api-types",[442,455,456],{"class":452}," --tsconfig",[442,458,459],{"class":452}," tsconfig.json",[442,461,462],{"class":452}," --out",[442,464,465],{"class":452}," api-types\n",[442,467,469,473,475,479,482],{"class":444,"line":468},2,[442,470,472],{"class":471},"s2Zo4","cd",[442,474,453],{"class":452},[442,476,478],{"class":477},"sMK4o"," &&",[442,480,481],{"class":448}," npm",[442,483,484],{"class":452}," publish\n",[486,487,488,501],"table",{},[489,490,491],"thead",{},[492,493,494,498],"tr",{},[495,496,497],"th",{},"In the package",[495,499,500],{},"What it is for",[502,503,504,516,526,536,546,560,570],"tbody",{},[492,505,506,513],{},[507,508,509,512],"td",{},[408,510,511],{},".d.ts"," files",[507,514,515],{},"The exported API and every type it reaches. Private and raw middlewares, server-only code, unused global declarations, and their imports are left out.",[492,517,518,523],{},[507,519,520],{},[408,521,522],{},"_outside\u002F",[507,524,525],{},"The types your API uses from other libraries, one file per library.",[492,527,528,533],{},[507,529,530],{},[408,531,532],{},"mion-pure-fns\u002F",[507,534,535],{},"Pure functions and overrides your clients can use, so they compute the same ids.",[492,537,538,543],{},[507,539,540],{},[408,541,542],{},".mion\u002Fvendor\u002F",[507,544,545],{},"Pure functions from other libraries that your clients need.",[492,547,548,553],{},[507,549,550],{},[408,551,552],{},".mion\u002Fapi\u002Fmanifest.json",[507,554,555,556,559],{},"Lets ",[408,557,558],{},"mion api-check"," compare a client build with this server build.",[492,561,562,567],{},[507,563,564],{},[408,565,566],{},"mion-api.json",[507,568,569],{},"The marker a client checks.",[492,571,572,577],{},[507,573,574],{},[408,575,576],{},"package.json",[507,578,579],{},"No JavaScript entry. Peer dependencies on the mion packages and on your tsconfig libraries.",[581,582,583,584,586,587,590,591,594],"note",{},"A client refuses a package with types and no JavaScript entry unless ",[408,585,410],{}," built it (",[408,588,589],{},"rpc-client-types-not-built-by-mion","). Build the client with the same mion version as the package (",[408,592,593],{},"rpc-client-types-other-mion-version",").",[413,596,598],{"id":597},"dependencies-the-client-installs","Dependencies the Client Installs",[405,600,601,602,427,605,608,609,612],{},"A client installs the types package, the mion packages, and the libraries your tsconfig ",[408,603,604],{},"types",[408,606,607],{},"lib"," load, such as ",[408,610,611],{},"@types\u002Fnode",". Nothing else: a type your API takes from any other library ships inside the package. The package entry loads the same tsconfig libraries, so the client gets your server's ids whatever its own tsconfig lists.",[433,614,619],{"className":615,"code":616,"filename":617,"language":618,"meta":438,"style":438},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export type Address = {city: string; street: string};\nexport declare enum Role { Admin = 'admin', User = 'user' }\n","_outside\u002Fgeo-lib.d.ts","ts",[408,620,621,663],{"__ignoreMap":438},[442,622,623,627,631,634,637,640,644,647,650,653,656,658,660],{"class":444,"line":445},[442,624,626],{"class":625},"s7zQu","export",[442,628,630],{"class":629},"spNyl"," type",[442,632,633],{"class":448}," Address",[442,635,636],{"class":477}," =",[442,638,639],{"class":477}," {",[442,641,643],{"class":642},"swJcz","city",[442,645,646],{"class":477},":",[442,648,649],{"class":448}," string",[442,651,652],{"class":477},";",[442,654,655],{"class":642}," street",[442,657,646],{"class":477},[442,659,649],{"class":448},[442,661,662],{"class":477},"};\n",[442,664,665,667,670,673,676,678,682,685,688,691,694,697,700,702,704,707,709],{"class":444,"line":468},[442,666,626],{"class":625},[442,668,669],{"class":629}," declare",[442,671,672],{"class":629}," enum",[442,674,675],{"class":448}," Role",[442,677,639],{"class":477},[442,679,681],{"class":680},"sTEyZ"," Admin ",[442,683,684],{"class":477},"=",[442,686,687],{"class":477}," '",[442,689,690],{"class":452},"admin",[442,692,693],{"class":477},"'",[442,695,696],{"class":477},",",[442,698,699],{"class":680}," User ",[442,701,684],{"class":477},[442,703,687],{"class":477},[442,705,706],{"class":452},"user",[442,708,693],{"class":477},[442,710,711],{"class":477}," }\n",[581,713,714,715,718,719,721],{},"A library type used with one of your type parameters (",[408,716,717],{},"Page\u003CT>"," in your own generic type) cannot be copied. It stays an import, its library stays a peer dependency, and ",[408,720,410],{}," prints a warning naming it.",[413,723,725],{"id":724},"classes-and-enums-from-other-libraries","Classes and Enums From Other Libraries",[405,727,728,729,732,733,736],{},"A class or enum from another library is copied as a type only, with its name and members, so its ids do not change. A method's type parameters are not copied: ",[408,730,731],{},"map\u003CT>(fn: (v: number) => T): T[]"," shows as ",[408,734,735],{},"map(fn: (v: number) => unknown): unknown[]",". To get class instances back from the API, install that library in your client and register its class as usual:",[433,738,740],{"className":615,"code":739,"language":618,"meta":438,"style":438},"import {registerClassSerializer} from '@mionjs\u002Frun-types\u002Fruntime';\nimport {Money} from 'money-lib';\n\nregisterClassSerializer(Money, {deserialize: (data) => new Money(data.amount)});\n",[408,741,742,768,790,797],{"__ignoreMap":438},[442,743,744,747,749,752,755,758,760,763,765],{"class":444,"line":445},[442,745,746],{"class":625},"import",[442,748,639],{"class":477},[442,750,751],{"class":680},"registerClassSerializer",[442,753,754],{"class":477},"}",[442,756,757],{"class":625}," from",[442,759,687],{"class":477},[442,761,762],{"class":452},"@mionjs\u002Frun-types\u002Fruntime",[442,764,693],{"class":477},[442,766,767],{"class":477},";\n",[442,769,770,772,774,777,779,781,783,786,788],{"class":444,"line":468},[442,771,746],{"class":625},[442,773,639],{"class":477},[442,775,776],{"class":680},"Money",[442,778,754],{"class":477},[442,780,757],{"class":625},[442,782,687],{"class":477},[442,784,785],{"class":452},"money-lib",[442,787,693],{"class":477},[442,789,767],{"class":477},[442,791,793],{"class":444,"line":792},3,[442,794,796],{"emptyLinePlaceholder":795},true,"\n",[442,798,800,802,805,807,809,812,814,817,821,824,827,830,833,836,838,841,843,845],{"class":444,"line":799},4,[442,801,751],{"class":471},[442,803,804],{"class":680},"(Money",[442,806,696],{"class":477},[442,808,639],{"class":477},[442,810,811],{"class":471},"deserialize",[442,813,646],{"class":477},[442,815,816],{"class":477}," (",[442,818,820],{"class":819},"sHdIc","data",[442,822,823],{"class":477},")",[442,825,826],{"class":629}," =>",[442,828,829],{"class":477}," new",[442,831,832],{"class":471}," Money",[442,834,835],{"class":680},"(data",[442,837,431],{"class":477},[442,839,840],{"class":680},"amount)",[442,842,754],{"class":477},[442,844,823],{"class":680},[442,846,767],{"class":477},[413,848,850],{"id":849},"installing-a-copied-library-in-the-client","Installing a Copied Library in the Client",[405,852,853,854,857],{},"If your client installs a library the package copied, its types and the copies are separate declarations. Plain objects mix fine, but a class with private fields, a ",[408,855,856],{},"unique symbol"," or an enum from one does not fit the other: TypeScript reports \"is not assignable\". Ids and runtime are not affected.",[413,859,861],{"id":860},"building-a-client-from-published-api-types","Building a Client From Published API Types",[405,863,864,865,427,868,871,872,874,875,878,879,882],{},"Build your API package with ",[408,866,867],{},"mion compile",[408,869,870],{},"declaration: true",", and its ",[408,873,511],{}," carries the server's build version. A client calling ",[408,876,877],{},"initClient\u003Ctypeof api>()"," on that type checks its ids against the version at build time, and fails with ",[408,880,881],{},"rpc-client-server-version-mismatch"," if they differ (another tsconfig or library version).",[433,884,886],{"className":615,"code":885,"language":618,"meta":438,"style":438},"export declare const api: PublicApi\u003C{...}> & ApiBuildVersion\u003C\"k3Jd92xQaP1z\">;\n",[408,887,888],{"__ignoreMap":438},[442,889,890,892,894,897,900,902,905,908,911,914,917,920,923,925],{"class":444,"line":445},[442,891,626],{"class":625},[442,893,669],{"class":629},[442,895,896],{"class":629}," const",[442,898,899],{"class":680}," api",[442,901,646],{"class":477},[442,903,904],{"class":448}," PublicApi",[442,906,907],{"class":477},"\u003C{...}>",[442,909,910],{"class":477}," &",[442,912,913],{"class":448}," ApiBuildVersion",[442,915,916],{"class":477},"\u003C",[442,918,919],{"class":477},"\"",[442,921,922],{"class":452},"k3Jd92xQaP1z",[442,924,919],{"class":477},[442,926,927],{"class":477},">;\n",[581,929,930,931,934,935,938,939,942,943,431],{},"Types written by plain ",[408,932,933],{},"tsc"," carry no version, so the client builds with the warning ",[408,936,937],{},"rpc-client-no-server-version"," and a mismatch only shows at runtime. They also lose the type of every ",[408,940,941],{},"private"," class field, so a route type holding such a class fails the client build with ",[408,944,945],{},"marker-untyped-private-member",[413,947,949],{"id":948},"types-only-package-compared-with-openapi","Types-Only Package Compared With OpenAPI",[405,951,952,953,956],{},"A types-only package does for TypeScript clients what an OpenAPI spec does for other stacks. A client that fetches its routes from the server (",[408,954,955],{},"client: {routes: 'fetch'}",") needs no package.",[486,958,959,971],{},[489,960,961],{},[492,962,963,965,968],{},[495,964],{},[495,966,967],{},"Types-only package",[495,969,970],{},"OpenAPI spec",[502,972,973,984,994,1008],{},[492,974,975,978,981],{},[507,976,977],{},"Who can read it",[507,979,980],{},"TypeScript clients built with mion",[507,982,983],{},"Any language or tool",[492,985,986,988,991],{},[507,987,52],{},[507,989,990],{},"The client compiles the server's validators from the same types",[507,992,993],{},"Each tool builds its own from the schema, so they can differ",[492,995,996,999,1005],{},[507,997,998],{},"Drift check",[507,1000,1001,1002,1004],{},"The build fails on a mismatch (",[408,1003,881],{},"); the version is also checked at runtime",[507,1006,1007],{},"None built in",[492,1009,1010,1013,1016],{},[507,1011,1012],{},"Version",[507,1014,1015],{},"A hash of the route ids, set by the build",[507,1017,1018],{},"Written by hand",[1020,1021,1022],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .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 .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 .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 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}","Publish your API's types as a package your clients install instead of the server.","md",null,{"toc":24},{"title":159,"description":1023},"__Mp0wa7GghNxnEjRVftQeZrXgoRlh01YTR6uzI0IvE",1793324371547]