[{"data":1,"prerenderedAt":1357},["ShallowReactive",2],{"navigation_docs":3,"-runtypes-tooling-source-conversion":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":265,"body":401,"description":1351,"extension":1352,"links":1353,"meta":1354,"navigation":463,"path":266,"seo":1355,"stem":267,"__hash__":1356},"docs\u002F02.runtypes\u002F04.tooling\u002F02.source-conversion.md",{"type":402,"value":403},"minimark",[404,409,413,488,491,571,578,723,727,730,780,783,942,953,957,960,993,997,1004,1022,1026,1037,1102,1105,1109,1112,1135,1139,1142,1245,1252,1259,1279,1283,1289,1311,1315,1321,1347],[405,406,408],"h2",{"id":407},"converting-files-between-types-and-builders","Converting Files Between Types and Builders",[410,411,412],"p",{},"The convert command rewrites your files in place, from plain TypeScript types to type builders or back.",[414,415,420],"pre",{"className":416,"code":417,"language":418,"meta":419,"style":419},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","# one file, or several\nnpx mion convert --to builders src\u002Fmodels.ts src\u002Fapi.ts\n\n# or a whole folder (every .ts and .tsx inside it)\nnpx mion convert --to type src\u002Fmodels\u002F\n","bash","",[421,422,423,432,458,465,471],"code",{"__ignoreMap":419},[424,425,428],"span",{"class":426,"line":427},"line",1,[424,429,431],{"class":430},"sHwdD","# one file, or several\n",[424,433,435,439,443,446,449,452,455],{"class":426,"line":434},2,[424,436,438],{"class":437},"sBMFI","npx",[424,440,442],{"class":441},"sfazB"," mion",[424,444,445],{"class":441}," convert",[424,447,448],{"class":441}," --to",[424,450,451],{"class":441}," builders",[424,453,454],{"class":441}," src\u002Fmodels.ts",[424,456,457],{"class":441}," src\u002Fapi.ts\n",[424,459,461],{"class":426,"line":460},3,[424,462,464],{"emptyLinePlaceholder":463},true,"\n",[424,466,468],{"class":426,"line":467},4,[424,469,470],{"class":430},"# or a whole folder (every .ts and .tsx inside it)\n",[424,472,474,476,478,480,482,485],{"class":426,"line":473},5,[424,475,438],{"class":437},[424,477,442],{"class":441},[424,479,445],{"class":441},[424,481,448],{"class":441},[424,483,484],{"class":441}," type",[424,486,487],{"class":441}," src\u002Fmodels\u002F\n",[410,489,490],{},"Declarations already in the target form are left exactly as they are, so running it twice is safe.",[414,492,496],{"className":493,"code":494,"language":495,"meta":419,"style":419},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F before\nexport type User = {\n  id: number;\n  name?: string;\n  tags: string[];\n};\n","ts",[421,497,498,503,522,537,550,565],{"__ignoreMap":419},[424,499,500],{"class":426,"line":427},[424,501,502],{"class":430},"\u002F\u002F before\n",[424,504,505,509,512,515,519],{"class":426,"line":434},[424,506,508],{"class":507},"s7zQu","export",[424,510,484],{"class":511},"spNyl",[424,513,514],{"class":437}," User",[424,516,518],{"class":517},"sMK4o"," =",[424,520,521],{"class":517}," {\n",[424,523,524,528,531,534],{"class":426,"line":460},[424,525,527],{"class":526},"swJcz","  id",[424,529,530],{"class":517},":",[424,532,533],{"class":437}," number",[424,535,536],{"class":517},";\n",[424,538,539,542,545,548],{"class":426,"line":467},[424,540,541],{"class":526},"  name",[424,543,544],{"class":517},"?:",[424,546,547],{"class":437}," string",[424,549,536],{"class":517},[424,551,552,555,557,559,563],{"class":426,"line":473},[424,553,554],{"class":526},"  tags",[424,556,530],{"class":517},[424,558,547],{"class":437},[424,560,562],{"class":561},"sTEyZ","[]",[424,564,536],{"class":517},[424,566,568],{"class":426,"line":567},6,[424,569,570],{"class":517},"};\n",[410,572,573,574,577],{},"After ",[421,575,576],{},"--to builders"," the type name stays as an alias, so every import still works.",[414,579,581],{"className":493,"code":580,"language":495,"meta":419,"style":419},"\u002F\u002F after mion convert --to builders\nexport const userRT = RT.object({\n  id: TF.number(),\n  name: RT.optional(TF.string()),\n  tags: RT.array(TF.string()),\n});\nexport type UserAsBuilders = InferType\u003Ctypeof userRT>; \u002F\u002F the real command keeps the name User\n",[421,582,583,588,617,637,663,686,696],{"__ignoreMap":419},[424,584,585],{"class":426,"line":427},[424,586,587],{"class":430},"\u002F\u002F after mion convert --to builders\n",[424,589,590,592,595,598,601,604,607,611,614],{"class":426,"line":434},[424,591,508],{"class":507},[424,593,594],{"class":511}," const",[424,596,597],{"class":561}," userRT ",[424,599,600],{"class":517},"=",[424,602,603],{"class":561}," RT",[424,605,606],{"class":517},".",[424,608,610],{"class":609},"s2Zo4","object",[424,612,613],{"class":561},"(",[424,615,616],{"class":517},"{\n",[424,618,619,621,623,626,628,631,634],{"class":426,"line":460},[424,620,527],{"class":526},[424,622,530],{"class":517},[424,624,625],{"class":561}," TF",[424,627,606],{"class":517},[424,629,630],{"class":609},"number",[424,632,633],{"class":561},"()",[424,635,636],{"class":517},",\n",[424,638,639,641,643,645,647,650,653,655,658,661],{"class":426,"line":467},[424,640,541],{"class":526},[424,642,530],{"class":517},[424,644,603],{"class":561},[424,646,606],{"class":517},[424,648,649],{"class":609},"optional",[424,651,652],{"class":561},"(TF",[424,654,606],{"class":517},[424,656,657],{"class":609},"string",[424,659,660],{"class":561},"())",[424,662,636],{"class":517},[424,664,665,667,669,671,673,676,678,680,682,684],{"class":426,"line":473},[424,666,554],{"class":526},[424,668,530],{"class":517},[424,670,603],{"class":561},[424,672,606],{"class":517},[424,674,675],{"class":609},"array",[424,677,652],{"class":561},[424,679,606],{"class":517},[424,681,657],{"class":609},[424,683,660],{"class":561},[424,685,636],{"class":517},[424,687,688,691,694],{"class":426,"line":567},[424,689,690],{"class":517},"}",[424,692,693],{"class":561},")",[424,695,536],{"class":517},[424,697,699,701,703,706,708,711,714,717,720],{"class":426,"line":698},7,[424,700,508],{"class":507},[424,702,484],{"class":511},[424,704,705],{"class":437}," UserAsBuilders",[424,707,518],{"class":517},[424,709,710],{"class":437}," InferType",[424,712,713],{"class":517},"\u003Ctypeof",[424,715,716],{"class":561}," userRT",[424,718,719],{"class":517},">;",[424,721,722],{"class":430}," \u002F\u002F the real command keeps the name User\n",[405,724,726],{"id":725},"converting-types-written-inside-a-call","Converting Types Written Inside a Call",[410,728,729],{},"A type written straight into a factory call has no declaration, so the converter rewrites the call.",[414,731,733],{"className":493,"code":732,"language":495,"meta":419,"style":419},"\u002F\u002F before\nexport const isOrder = createValidateFn\u003C{id: string; total: number}>();\n",[421,734,735,739],{"__ignoreMap":419},[424,736,737],{"class":426,"line":427},[424,738,502],{"class":430},[424,740,741,743,745,748,750,753,756,759,761,763,766,769,771,773,776,778],{"class":426,"line":434},[424,742,508],{"class":507},[424,744,594],{"class":511},[424,746,747],{"class":561}," isOrder ",[424,749,600],{"class":517},[424,751,752],{"class":609}," createValidateFn",[424,754,755],{"class":517},"\u003C{",[424,757,758],{"class":526},"id",[424,760,530],{"class":517},[424,762,547],{"class":437},[424,764,765],{"class":517},";",[424,767,768],{"class":526}," total",[424,770,530],{"class":517},[424,772,533],{"class":437},[424,774,775],{"class":517},"}>",[424,777,633],{"class":561},[424,779,536],{"class":517},[410,781,782],{},"The builder form passes the type to the same factory as a value.",[414,784,786],{"className":493,"code":785,"language":495,"meta":419,"style":419},"\u002F\u002F after: the same shape, so the same validator\nexport const isOrderBuilt = createValidateFn(\n  RT.object({id: TF.string(), total: TF.number()})\n);\ngetRunTypeId\u003C{id: string; total: number}>() ===\n  getRunTypeId(RT.object({id: TF.string(), total: TF.number()})); \u002F\u002F true\n",[421,787,788,793,809,855,861,890],{"__ignoreMap":419},[424,789,790],{"class":426,"line":427},[424,791,792],{"class":430},"\u002F\u002F after: the same shape, so the same validator\n",[424,794,795,797,799,802,804,806],{"class":426,"line":434},[424,796,508],{"class":507},[424,798,594],{"class":511},[424,800,801],{"class":561}," isOrderBuilt ",[424,803,600],{"class":517},[424,805,752],{"class":609},[424,807,808],{"class":561},"(\n",[424,810,811,814,816,818,820,823,825,827,829,831,833,835,838,840,842,844,846,848,850,852],{"class":426,"line":460},[424,812,813],{"class":561},"  RT",[424,815,606],{"class":517},[424,817,610],{"class":609},[424,819,613],{"class":561},[424,821,822],{"class":517},"{",[424,824,758],{"class":526},[424,826,530],{"class":517},[424,828,625],{"class":561},[424,830,606],{"class":517},[424,832,657],{"class":609},[424,834,633],{"class":561},[424,836,837],{"class":517},",",[424,839,768],{"class":526},[424,841,530],{"class":517},[424,843,625],{"class":561},[424,845,606],{"class":517},[424,847,630],{"class":609},[424,849,633],{"class":561},[424,851,690],{"class":517},[424,853,854],{"class":561},")\n",[424,856,857,859],{"class":426,"line":467},[424,858,693],{"class":561},[424,860,536],{"class":517},[424,862,863,866,868,870,872,874,876,878,880,882,884,887],{"class":426,"line":473},[424,864,865],{"class":609},"getRunTypeId",[424,867,755],{"class":517},[424,869,758],{"class":526},[424,871,530],{"class":517},[424,873,547],{"class":437},[424,875,765],{"class":517},[424,877,768],{"class":526},[424,879,530],{"class":517},[424,881,533],{"class":437},[424,883,775],{"class":517},[424,885,886],{"class":561},"() ",[424,888,889],{"class":517},"===\n",[424,891,892,895,898,900,902,904,906,908,910,912,914,916,918,920,922,924,926,928,930,932,934,937,939],{"class":426,"line":567},[424,893,894],{"class":609},"  getRunTypeId",[424,896,897],{"class":561},"(RT",[424,899,606],{"class":517},[424,901,610],{"class":609},[424,903,613],{"class":561},[424,905,822],{"class":517},[424,907,758],{"class":526},[424,909,530],{"class":517},[424,911,625],{"class":561},[424,913,606],{"class":517},[424,915,657],{"class":609},[424,917,633],{"class":561},[424,919,837],{"class":517},[424,921,768],{"class":526},[424,923,530],{"class":517},[424,925,625],{"class":561},[424,927,606],{"class":517},[424,929,630],{"class":609},[424,931,633],{"class":561},[424,933,690],{"class":517},[424,935,936],{"class":561},"))",[424,938,765],{"class":517},[424,940,941],{"class":430}," \u002F\u002F true\n",[410,943,944,945,948,949,952],{},"A call that names its type (",[421,946,947],{},"createValidateFn\u003COrder>()",") is left alone, because its declaration converts on its own. So is a call that reflects a runtime value (",[421,950,951],{},"createValidateFn(order)","): it has no written type to move.",[405,954,956],{"id":955},"preserving-type-identity","Preserving Type Identity",[410,958,959],{},"Conversion changes the spelling, never the type's identity. You get the same validator, codecs and mock data.",[414,961,963],{"className":493,"code":962,"language":495,"meta":419,"style":419},"getRunTypeId\u003CUser>() === getRunTypeId(userRT); \u002F\u002F true\n",[421,964,965],{"__ignoreMap":419},[424,966,967,969,972,975,978,980,983,986,989,991],{"class":426,"line":427},[424,968,865],{"class":609},[424,970,971],{"class":517},"\u003C",[424,973,974],{"class":437},"User",[424,976,977],{"class":517},">",[424,979,886],{"class":561},[424,981,982],{"class":517},"===",[424,984,985],{"class":609}," getRunTypeId",[424,987,988],{"class":561},"(userRT)",[424,990,765],{"class":517},[424,992,941],{"class":430},[405,994,996],{"id":995},"shapes-that-convert","Shapes That Convert",[410,998,999,1000,1003],{},"Everything RunTypes reflects: primitives and literals, string and number formats, arrays and tuples (readonly included), objects (optional, readonly and quoted keys included), records (readonly included), unions, enums, classes, Date, Map, Set, Promise, RegExp, Temporal types, functions, template literals, branded types, and recursive types. Most shapes the builder form has no word for convert through the ",[421,1001,1002],{},"getRunType\u003CT>()"," escape, like functions, template literals and bigint literals.",[410,1005,1006,1007,1010,1011,1014,1015,1018,1019,606],{},"In builder form, labeled tuples and named function parameters use ",[421,1008,1009],{},"RT.slot",", a readonly array or tuple is wrapped in ",[421,1012,1013],{},"RT.readonly",", an index signature beside named properties becomes an intersection, and recursive shapes come out as ",[421,1016,1017],{},"RT.circular"," with ",[421,1020,1021],{},"RT.self()",[405,1023,1025],{"id":1024},"recursive-types","Recursive Types",[410,1027,1028,1029,1032,1033,1036],{},"Some recursive types cannot write their loop as builders: one that also needs the ",[421,1030,1031],{},"getRunType"," escape (usually for a method member), and one that loops back through its own tuple slot, like ",[421,1034,1035],{},"type Pair = [number, Pair]",". The converter keeps the type, readonly included, and adds a const beside it.",[414,1038,1040],{"className":493,"code":1039,"language":495,"meta":419,"style":419},"export type TreeNode = {label(): string; kids: TreeNode[]};\nexport const treeNodeRT = getRunType\u003CTreeNode>();\n",[421,1041,1042,1077],{"__ignoreMap":419},[424,1043,1044,1046,1048,1051,1053,1056,1059,1062,1064,1066,1069,1071,1073,1075],{"class":426,"line":427},[424,1045,508],{"class":507},[424,1047,484],{"class":511},[424,1049,1050],{"class":437}," TreeNode",[424,1052,518],{"class":517},[424,1054,1055],{"class":517}," {",[424,1057,1058],{"class":526},"label",[424,1060,1061],{"class":517},"():",[424,1063,547],{"class":437},[424,1065,765],{"class":517},[424,1067,1068],{"class":526}," kids",[424,1070,530],{"class":517},[424,1072,1050],{"class":437},[424,1074,562],{"class":561},[424,1076,570],{"class":517},[424,1078,1079,1081,1083,1086,1088,1091,1093,1096,1098,1100],{"class":426,"line":434},[424,1080,508],{"class":507},[424,1082,594],{"class":511},[424,1084,1085],{"class":561}," treeNodeRT ",[424,1087,600],{"class":517},[424,1089,1090],{"class":609}," getRunType",[424,1092,971],{"class":517},[424,1094,1095],{"class":437},"TreeNode",[424,1097,977],{"class":517},[424,1099,633],{"class":561},[424,1101,536],{"class":517},[410,1103,1104],{},"That pair is the builder form. Running the conversion again leaves it alone, and converting back to the type form removes the const.",[405,1106,1108],{"id":1107},"references-between-files","References Between Files",[410,1110,1111],{},"A type that names another converted type keeps the name in every form. Convert the files together and the imports are updated for you.",[414,1113,1115],{"className":416,"code":1114,"language":418,"meta":419,"style":419},"npx mion convert --to builders src\u002Fuser.ts src\u002Forder.ts\n",[421,1116,1117],{"__ignoreMap":419},[424,1118,1119,1121,1123,1125,1127,1129,1132],{"class":426,"line":427},[424,1120,438],{"class":437},[424,1122,442],{"class":441},[424,1124,445],{"class":441},[424,1126,448],{"class":441},[424,1128,451],{"class":441},[424,1130,1131],{"class":441}," src\u002Fuser.ts",[424,1133,1134],{"class":441}," src\u002Forder.ts\n",[405,1136,1138],{"id":1137},"shapes-that-do-not-convert","Shapes That Do Not Convert",[410,1140,1141],{},"These shapes do not convert, not even through the escape. The converter reports each one, leaves that declaration as written, converts the rest of the file, and exits with a non-zero code.",[1143,1144,1145,1158],"table",{},[1146,1147,1148],"thead",{},[1149,1150,1151,1155],"tr",{},[1152,1153,1154],"th",{},"Shape",[1152,1156,1157],{},"Why",[1159,1160,1161,1170,1178,1189,1200,1211,1219,1227],"tbody",{},[1149,1162,1163,1167],{},[1164,1165,1166],"td",{},"A cycle that never passes through a named type",[1164,1168,1169],{},"The self reference has nothing to point at. Give the inner type a name and it converts.",[1149,1171,1172,1175],{},[1164,1173,1174],{},"A symbol-keyed property",[1164,1176,1177],{},"The escape can only carry a type it can write down, and a symbol name is not one.",[1149,1179,1180,1186],{},[1164,1181,1182,1183,693],{},"A unique symbol literal type (",[421,1184,1185],{},"typeof sym",[1164,1187,1188],{},"No builder can spell a symbol value.",[1149,1190,1191,1197],{},[1164,1192,1193,1194],{},"A property tagged ",[421,1195,1196],{},"@nonEnumerable",[1164,1198,1199],{},"The tag shapes the wire format but has no builder spelling, so dropping it would change the type's identity.",[1149,1201,1202,1208],{},[1164,1203,1204,1205],{},"A recursive type reaching a call site through a mapped type such as ",[421,1206,1207],{},"DataOnly\u003CT>",[1164,1209,1210],{},"The mapping hands the call an unnamed copy of the loop, so there is no name to close it on. Pass the named type itself instead.",[1149,1212,1213,1216],{},[1164,1214,1215],{},"A recursive tuple reaching a call site through a mapped type",[1164,1217,1218],{},"Same cause, and a tuple slot cannot close the loop. Put the recursion behind an object, array, Map, Set or function slot.",[1149,1220,1221,1224],{},[1164,1222,1223],{},"A reference to a type whose file is not in the same run",[1164,1225,1226],{},"Add that file to the same command.",[1149,1228,1229,1235],{},[1164,1230,1231,1232],{},"A Temporal type that resolves to ",[421,1233,1234],{},"any",[1164,1236,1237,1238,1241,1242,1244],{},"The Temporal declarations are missing from your project. Add the ",[421,1239,1240],{},"ESNext.Temporal"," lib or a polyfill's types. Converting would make the ",[421,1243,1234],{}," permanent.",[410,1246,1247,1248,1251],{},"A generic type (",[421,1249,1250],{},"type Box\u003CT> = ...",") is not an error: a type parameter has no runtime shape. The declaration is reported and left as written, and every use with real types converts normally.",[410,1253,1254,1255,1258],{},"With ",[421,1256,1257],{},"--to type",", a builder const your code still uses elsewhere is also reported and left as written.",[1260,1261,1262,1263,1266,1267,1270,1271,1274,1275,1278],"tip",{},"An unresolved import from ",[421,1264,1265],{},"@mionjs\u002Frun-types"," or a ",[421,1268,1269],{},"@mionjs\u002Fdrizzle-orm"," package is an error (convert-unresolved-import) that names the package. The declarations that use it stay as written and the run exits with a non-zero code. Install or build the package, or check ",[421,1272,1273],{},"paths"," and ",[421,1276,1277],{},"customConditions"," in your tsconfig.",[405,1280,1282],{"id":1281},"dry-runs","Dry Runs",[410,1284,1285,1288],{},[421,1286,1287],{},"--check"," reports what would change without writing, and exits with code 1 if anything would change.",[414,1290,1292],{"className":416,"code":1291,"language":418,"meta":419,"style":419},"npx mion convert --to type --check src\u002Fmodels\u002F\n",[421,1293,1294],{"__ignoreMap":419},[424,1295,1296,1298,1300,1302,1304,1306,1309],{"class":426,"line":427},[424,1297,438],{"class":437},[424,1299,442],{"class":441},[424,1301,445],{"class":441},[424,1303,448],{"class":441},[424,1305,484],{"class":441},[424,1307,1308],{"class":441}," --check",[424,1310,487],{"class":441},[405,1312,1314],{"id":1313},"output-folders","Output Folders",[410,1316,1317,1320],{},[421,1318,1319],{},"--out-dir"," writes the converted files into a copy of the folder and leaves your sources untouched.",[414,1322,1324],{"className":416,"code":1323,"language":418,"meta":419,"style":419},"npx mion convert --to builders src\u002Fmodels\u002F --out-dir converted\u002F\n",[421,1325,1326],{"__ignoreMap":419},[424,1327,1328,1330,1332,1334,1336,1338,1341,1344],{"class":426,"line":427},[424,1329,438],{"class":437},[424,1331,442],{"class":441},[424,1333,445],{"class":441},[424,1335,448],{"class":441},[424,1337,451],{"class":441},[424,1339,1340],{"class":441}," src\u002Fmodels\u002F",[424,1342,1343],{"class":441}," --out-dir",[424,1345,1346],{"class":441}," converted\u002F\n",[1348,1349,1350],"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 .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 .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 .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 .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}","Rewrite files between plain types and type builders with one command.","md",null,{"toc":24},{"title":265,"description":1351},"sFXTr9iaJQkTnQtF6eYlYC2j5Lt5rQHQMwzxna3C6zQ",1793324365641]