{"id":49549,"library":"ts-migration","title":"ts-migration","description":"A TypeScript library for defining typesafe bidirectional migrations between object shapes. Current stable version is 1.0.1, released on npm with infrequent updates. It allows compile-time validation of migration schemas using TypeScript types. Key differentiators: fully typed migrations (forward and reverse), supports both 1-1 and unidirectional transformations, and uses a fluent API with CompileMigration. Alternative libraries like transmutable or object-mapper lack bidirectional typing or compile-time safety.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/u8sand/TypescriptMigration","tags":["javascript","typescript"],"install":[{"cmd":"npm install ts-migration","lang":"bash","label":"npm"},{"cmd":"yarn add ts-migration","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-migration","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for type safety at compile time; the library relies heavily on TypeScript's type system","package":"typescript","optional":true}],"imports":[{"note":"Default export only; named import does not exist.","wrong":"import { CompileMigration } from 'ts-migration'","symbol":"CompileMigration","correct":"import CompileMigration from 'ts-migration'"},{"note":"Type exports available for Migration type (inferred from CompileMigration return).","wrong":"","symbol":"compiled type","correct":"import type { Migration } from 'ts-migration'"}],"quickstart":{"code":"import CompileMigration from 'ts-migration'\n\nconst myObj = { a: 1, b: 'hello' }\nconst otherObj = { x: 1, y: 'hello' }\n\nconst migration = CompileMigration(\n  myObj, otherObj,\n  ({ left, right }) => ({\n    [left.a]: right.x,\n    [left.b]: right.y,\n    [right.x]: left.a,\n    [right.y]: left.b,\n  })\n)\n\nconst resultForward = migration.forward(myObj)\nconst resultReverse = migration.reverse(otherObj)","lang":"typescript","description":"Create a bidirectional migration between two object shapes using CompileMigration."},"warnings":[{"fix":"Ensure every property from both object types is present in the migration mapping.","message":"Migration objects must have all keys from both shapes defined; missing keys cause runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use plain object literals or clone objects before passing.","message":"The CompileMigration function expects mutable objects; passing frozen objects may cause unexpected behavior.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'-1':49 '1':48 '1.0.1':19 'allow':27 'altern':60 'api':57 'bidirect':10,69 'compil':29,73 'compile-tim':28,72 'compilemigr':59 'current':15 'defin':8 'differenti':39 'fluent':56 'forward':43 'fulli':40 'infrequ':24 'javascript':76 'key':38 'lack':68 'librari':6,61 'like':62 'mapper':67 'migrat':3,11,33,42 'npm':22 'object':13,66 'object-mapp':65 'releas':20 'revers':45 'safeti':75 'schema':34 'shape':14 'stabl':16 'support':46 'time':30,74 'transform':52 'transmut':63 'ts':2 'ts-migrat':1 'type':37,41,70 'typesaf':9 'typescript':5,36,77 'unidirect':51 'updat':25 'use':35,54 'valid':31 'version':17","created_at":"2026-06-07T17:02:20.339764+00:00","updated_at":"2026-06-07T17:02:20.339764+00:00","problems":[{"fix":"Ensure unidirectional functions accept the correct parameter type (left for right-to-left, right for left-to-right).","cause":"Unidirectional mapping function expects the correct type but receives a different argument order or type.","error":"TypeError: Cannot read properties of undefined (reading 'split')"},{"fix":"Install: npm install ts-migration. Import: import CompileMigration from 'ts-migration'","cause":"Package not installed or import path incorrect.","error":"Module not found: Can't resolve 'ts-migration'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/u8sand/TypescriptMigration#readme","github":"https://github.com/u8sand/TypescriptMigration","docs":null,"changelog":null,"pypi":null,"npm":"ts-migration","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}