{"_id":"ts-algebra","_rev":"4123116","name":"ts-algebra","description":"Types on steroids 💊","dist-tags":{"beta":"1.2.0-beta.0","latest":"2.0.0"},"maintainers":[{"name":"thomasaribart","email":""}],"time":{"modified":"2026-02-24T19:26:40.000Z","created":"2022-02-19T17:47:09.639Z","2.0.0":"2024-05-04T15:59:28.376Z","1.2.2":"2023-09-05T22:32:19.851Z","1.2.1":"2023-08-29T21:51:16.868Z","1.2.0":"2023-02-22T22:59:30.441Z","1.2.0-beta.0":"2023-01-21T11:55:57.539Z","1.1.1":"2022-05-01T17:16:05.053Z","1.1.1-beta.0":"2022-05-01T17:13:09.531Z","1.1.0":"2022-05-01T16:45:14.050Z","1.1.0-beta.0":"2022-05-01T12:02:37.341Z","1.0.1":"2022-04-08T18:44:47.854Z","1.0.0":"2022-04-06T17:33:05.654Z","1.0.0-beta.3":"2022-04-06T16:59:39.177Z","1.0.0-beta.1":"2022-04-06T14:49:12.634Z","1.0.0-beta.0":"2022-02-19T17:47:09.639Z"},"users":{},"author":{"name":"Thomas Aribart"},"repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"versions":{"2.0.0":{"name":"ts-algebra","version":"2.0.0","description":"Types on steroids 💊","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","set-package-version":"ts-node scripts/setPackageVersion","test":"yarn test-type && yarn test-format && yarn test-unused-exports && yarn test-lint","test-type":"tsc --noEmit","test-format":"yarn prettier . --check","test-unused-exports":"yarn ts-unused-exports ./tsconfig.json --excludePathsFromReport='src/index.ts;'","test-lint":"yarn eslint --ext=js,ts .","format":"yarn prettier . --write","build":"ttsc -p tsconfig.build.json"},"dependencies":{},"devDependencies":{"@trivago/prettier-plugin-sort-imports":"^3.4.0","@types/node":"^20.5.7","@typescript-eslint/eslint-plugin":"^5.42.1","@typescript-eslint/parser":"^5.42.1","@zerollup/ts-transform-paths":"^1.7.18","eslint":"^8.27.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-jsdoc":"^46.4.6","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-prettier":"^4.2.1","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","ts-node":"^10.9.1","ts-toolbelt":"^9.6.0","ts-unused-exports":"^8.0.0","ttypescript":"^1.5.13","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","_id":"ts-algebra@2.0.0","gitHead":"b3dace61651be9277da04e0b1ed3353838fd6175","_nodeVersion":"18.20.2","_npmVersion":"10.5.0","dist":{"shasum":"4e3e0953878f26518fce7f6bb115064a65388b7a","size":18774,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-2.0.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_2.0.0_1714838368220_0.4146484243715389"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-05-04T15:59:28.376Z","publish_time":1714838368376,"_source_registry_name":"default","_cnpm_publish_time":1714838368376},"1.2.2":{"name":"ts-algebra","version":"1.2.2","description":"Types on steroids 💊","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","set-package-version":"ts-node scripts/setPackageVersion","test":"yarn test-type && yarn test-format && yarn test-unused-exports && yarn test-lint","test-type":"tsc --noEmit","test-format":"yarn prettier . --check","test-unused-exports":"yarn ts-unused-exports ./tsconfig.json --excludePathsFromReport='src/index.ts;'","test-lint":"yarn eslint --ext=js,ts .","format":"yarn prettier . --write","build":"ttsc -p tsconfig.build.json"},"dependencies":{},"devDependencies":{"@trivago/prettier-plugin-sort-imports":"^3.4.0","@types/node":"^20.5.7","@typescript-eslint/eslint-plugin":"^5.42.1","@typescript-eslint/parser":"^5.42.1","@zerollup/ts-transform-paths":"^1.7.18","eslint":"^8.27.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-jsdoc":"^46.4.6","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-prettier":"^4.2.1","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","ts-node":"^10.9.1","ts-toolbelt":"^9.6.0","ts-unused-exports":"^8.0.0","ttypescript":"^1.5.13","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"4d1c559a86ad651c92007e8adc98e6310917a3ec","_id":"ts-algebra@1.2.2","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"shasum":"b75d301c28cd4126cd344760a47b43e48e2872e0","size":18528,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.2.2.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.2.2_1693953139661_0.6085870909815687"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-09-05T22:32:19.851Z","publish_time":1693953139851,"_source_registry_name":"default","_cnpm_publish_time":1693953139851},"1.2.1":{"name":"ts-algebra","version":"1.2.1","description":"Types on steroids 💊","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","set-package-version":"ts-node scripts/setPackageVersion","test":"yarn test-type && yarn test-format && yarn test-unused-exports && yarn test-lint","test-type":"tsc --noEmit","test-format":"yarn prettier . --check","test-unused-exports":"yarn ts-unused-exports ./tsconfig.json --excludePathsFromReport='src/index.ts;'","test-lint":"yarn eslint --ext=js,ts .","format":"yarn prettier . --write","build":"ttsc -p tsconfig.build.json"},"dependencies":{},"devDependencies":{"@trivago/prettier-plugin-sort-imports":"^3.4.0","@types/node":"^20.5.7","@typescript-eslint/eslint-plugin":"^5.42.1","@typescript-eslint/parser":"^5.42.1","@zerollup/ts-transform-paths":"^1.7.18","eslint":"^8.27.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-jsdoc":"^46.4.6","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-prettier":"^4.2.1","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","ts-node":"^10.9.1","ts-toolbelt":"^9.6.0","ts-unused-exports":"^8.0.0","ttypescript":"^1.5.13","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"d8f4f1f8760a9016ff008a8d9113c1a5eca37766","_id":"ts-algebra@1.2.1","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"shasum":"8cefa656b0563f207da2cb01e7094e178649ba0e","size":18490,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.2.1.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.2.1_1693345876621_0.04525903550531529"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-29T21:51:16.868Z","publish_time":1693345876868,"_source_registry_name":"default","_cnpm_publish_time":1693345876868},"1.2.0":{"name":"ts-algebra","version":"1.2.0","description":"Types on steroids 💊","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit","build":"tsc -p tsconfig.build.json"},"dependencies":{},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5","ts-toolbelt":"^9.6.0"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"0189e1c1ccf6dbfe42ea6184ab0c1f9ad1f4839c","_id":"ts-algebra@1.2.0","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"shasum":"f91c481207a770f0d14d055c376cbee040afdfc9","size":15080,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.2.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.2.0_1677106770314_0.03731503036199135"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-22T22:59:30.441Z","publish_time":1677106770441,"_cnpm_publish_time":1677106770441},"1.2.0-beta.0":{"name":"ts-algebra","version":"1.2.0-beta.0","description":"Types on steroids 💊","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit","build":"tsc -p tsconfig.build.json"},"dependencies":{},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5","ts-toolbelt":"^9.6.0"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","readmeFilename":"README.md","gitHead":"c6e82abc452b92de37ed00a5357b03401aef601b","_id":"ts-algebra@1.2.0-beta.0","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"shasum":"d2e4231661d934c27e4a805a9ff2af5bb6c5e56d","size":15087,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.2.0-beta.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.2.0-beta.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.2.0-beta.0_1674302157365_0.15793105395950047"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-21T11:55:57.539Z","publish_time":1674302157539,"_cnpm_publish_time":1674302157539},"1.1.1":{"name":"ts-algebra","version":"1.1.1","description":"Types on steroids 💊","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit","build":"tsc -p tsconfig.build.json"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"e627a4748ed1f23f799f18d44c2b855ededb7479","_id":"ts-algebra@1.1.1","_nodeVersion":"16.6.2","_npmVersion":"7.20.3","dist":{"shasum":"f7593cabcfd64f9d7211fa4f16ea9719e02461bc","size":14665,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.1.1.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.1.1_1651425364895_0.24035978598927432"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-01T17:16:08.681Z","publish_time":1651425365053,"_cnpm_publish_time":1651425365053},"1.1.1-beta.0":{"name":"ts-algebra","version":"1.1.1-beta.0","description":"Types on steroids 💊","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit","build":"tsc -p tsconfig.build.json"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","readmeFilename":"README.md","gitHead":"56f0ca47e17344ba7df8c182a53fcae8180e787b","_id":"ts-algebra@1.1.1-beta.0","_nodeVersion":"16.6.2","_npmVersion":"7.20.3","dist":{"shasum":"c0b1586d76d420f9a2ac464fe2c24c0d2ba5e5fa","size":14671,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.1.1-beta.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.1.1-beta.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.1.1-beta.0_1651425189371_0.861167566082049"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-01T17:14:51.399Z","publish_time":1651425189531,"_cnpm_publish_time":1651425189531},"1.1.0":{"name":"ts-algebra","version":"1.1.0","description":"Types on steroids 💊","main":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"b0da311c27de2652f133c404fe6e251c2eefd1bc","_id":"ts-algebra@1.1.0","_nodeVersion":"16.6.2","_npmVersion":"7.20.3","dist":{"shasum":"046da335259ea06bc4f433b1acad5da25fe298d4","size":541830,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.1.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.1.0_1651423513802_0.16514716056734646"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-01T16:45:18.508Z","publish_time":1651423514050,"_cnpm_publish_time":1651423514050},"1.1.0-beta.0":{"name":"ts-algebra","version":"1.1.0-beta.0","description":"Types on steroids 💊","main":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","readmeFilename":"README.md","gitHead":"974a3e8db7db66566dac3de8b4a3dacaee350819","_id":"ts-algebra@1.1.0-beta.0","_nodeVersion":"16.6.2","_npmVersion":"7.20.3","dist":{"shasum":"b71de986870de1899cad188d1d753f0fc859b74d","size":541021,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.1.0-beta.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.1.0-beta.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.1.0-beta.0_1651406557085_0.5416294866692624"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-01T12:02:42.048Z","publish_time":1651406557341,"_cnpm_publish_time":1651406557341},"1.0.1":{"name":"ts-algebra","version":"1.0.1","description":"Types on steroids 💊","main":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"1e51e0debfbdca208c3b7ef5b2297968532fdbf9","_id":"ts-algebra@1.0.1","_nodeVersion":"14.17.1","_npmVersion":"8.6.0","dist":{"shasum":"fb86115d26b039c761431d7abee83040410fa59b","size":540068,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.0.1.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.0.1_1649443487652_0.601299589123917"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-08T18:44:52.542Z","publish_time":1649443487854,"_cnpm_publish_time":1649443487854},"1.0.0":{"name":"ts-algebra","version":"1.0.0","description":"Types on steroids 💊","main":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"a1a9089c5d7658c4dd6e950d6a7f8fbaf5fc3054","_id":"ts-algebra@1.0.0","_nodeVersion":"14.17.1","_npmVersion":"8.6.0","dist":{"shasum":"107f53618f57445146cfc94f02606fd32633f1ec","size":540066,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.0.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.0.0_1649266385415_0.1418627196034401"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-06T22:07:20.413Z","publish_time":1649266385654,"_cnpm_publish_time":1649266385654},"1.0.0-beta.3":{"name":"ts-algebra","version":"1.0.0-beta.3","description":"Types on steroids 💊","main":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","readmeFilename":"README.md","gitHead":"e8567e5fd4574dfb20ea0a61d5812a7da491149f","_id":"ts-algebra@1.0.0-beta.3","_nodeVersion":"14.17.1","_npmVersion":"8.6.0","dist":{"shasum":"8ef6b5d355892a95e7ef435d11fcc0da8503aa20","size":540071,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.0.0-beta.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.0.0-beta.3.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.0.0-beta.3_1649264378807_0.5273103487381048"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-06T22:07:20.265Z","publish_time":1649264379177,"_cnpm_publish_time":1649264379177},"1.0.0-beta.1":{"name":"ts-algebra","version":"1.0.0-beta.1","description":"Types on steroids 💊","main":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","readmeFilename":"README.md","gitHead":"3e6e1843bf241babd7bbc64f9bb7b4522c6769d5","_id":"ts-algebra@1.0.0-beta.1","_nodeVersion":"14.17.1","_npmVersion":"8.6.0","dist":{"shasum":"966cf8d1fae8807043830f1d86244c5dc832ecf4","size":540249,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.0.0-beta.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.0.0-beta.1.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.0.0-beta.1_1649256552402_0.49914840195000365"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-06T22:07:19.307Z","publish_time":1649256552634,"_cnpm_publish_time":1649256552634},"1.0.0-beta.0":{"name":"ts-algebra","version":"1.0.0-beta.0","description":"Empower your types with new operations!","main":"lib/index.d.ts","scripts":{"release":"bash scripts/release.bash","test":"tsc --noEmit"},"dependencies":{"ts-toolbelt":"^9.6.0"},"devDependencies":{"rollup":"^2.67.3","rollup-plugin-dts":"4.1.0","rollup-plugin-import-map":"^2.2.2","typescript":"^4.5.5"},"author":{"name":"Thomas Aribart"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ThomasAribart/ts-algebra.git"},"keywords":["typescript","type","ts"],"bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","gitHead":"2198b2693f130bd63b04c1d10ea5976966a2e2eb","_id":"ts-algebra@1.0.0-beta.0","_nodeVersion":"14.17.1","_npmVersion":"6.14.13","dist":{"shasum":"40a9632477b2debfe9acfeeaab536180848068d0","size":9678,"noattachment":false,"key":"/ts-algebra/-/ts-algebra-1.0.0-beta.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-algebra/download/ts-algebra-1.0.0-beta.0.tgz"},"_npmUser":{"name":"thomasaribart","email":"thomas.aribart@gmail.com"},"directories":{},"maintainers":[{"name":"thomasaribart","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-algebra_1.0.0-beta.0_1645292829437_0.18249044547755422"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-19T17:47:12.385Z","publish_time":1645292829639,"_cnpm_publish_time":1645292829639}},"readme":"<img src=\"assets/header-round-medium.png\" width=\"100%\" align=\"center\" />\n\n<p align=\"right\">\n  <i>If you use this repo, star it ✨</i>\n</p>\n\n# Types on steroids ????\n\n`ts-algebra` exposes a subset of TS types called **Meta-types**: Meta-types are types that encapsulate other types.\n\n```typescript\nimport { Meta } from \"ts-algebra\";\n\ntype MetaString = Meta.Primitive<string>;\n```\n\nThe encapsulated type can be retrieved using the `Resolve` operation.\n\n```typescript\ntype Resolved = Meta.Resolve<MetaString>;\n// => string ????\n```\n\nYou can also use the more compact `M` notation:\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Primitive<string>\n>;\n```\n\n## Okay, but... why ? ????\n\nMeta-types allow operations that **are not possible with conventional types**.\n\nFor instance, they allow new [\"intersect\"](#intersect) and [\"exclude\"](#exclude) operations, and handling objects additional properties:\n\n```typescript\ntype MyObject = {\n  str: string; // <= ❌ \"str\" is assignable to string\n  [key: string]: number;\n};\n\ntype MyObjectKeys = keyof MyObject;\n// => string <= ❌ Unable to isolate \"str\"\n```\n\nThink of meta-types as a parallel universe where all kinds of magic can happen ???? Once your computations are over, you can retrieve the results by resolving them.\n\n<img src=\"assets/schema.png\" width=\"100%\" align=\"center\" />\n\n> Meta-types were originally part of [json-schema-to-ts](https://github.com/ThomasAribart/json-schema-to-ts). Check it to see a real-life usage.\n\n## Table of content\n\n- [Installation](#%EF%B8%8F-installation)\n- [Cardinality](#-cardinality)\n- [Meta-types](#-meta-types)\n  - [Never](#never)\n  - [Any](#any)\n  - [Const](#const)\n  - [Enum](#enum)\n  - [Primitive](#primitive)\n  - [Array](#array)\n  - [Tuple](#tuple)\n  - [Object](#object)\n  - [Union](#union)\n- [Methods](#-methods)\n  - [Resolve](#resolve)\n  - [Intersect](#intersect)\n  - [Exclude](#exclude)\n- [Deserialization](#-deserialization)\n- [Type constraints](#-type-constraints)\n- [Unsafe types](#%EF%B8%8F-unsafe-types-and-methods)\n\n## ☁️ Installation\n\n```bash\n# npm\nnpm install --save-dev ts-algebra\n\n# yarn\nyarn add --dev ts-algebra\n```\n\n## ???? Cardinality\n\nA bit of theory first:\n\n- The [**cardinality**](https://en.wikipedia.org/wiki/Cardinality) of a type is the number of distinct values (potentially infinite) that can be assigned to it\n- A meta-type is said **representable** if at least one value can be assigned to its resolved type (cardinality ≥ 1)\n\nAn important notion to keep in mind using `ts-algebra`:\n\n---\n\n<p align=\"center\">\n  <a href=\"#never\"><code>M.Never</code></a> is the only Meta-Type that is non-representable\n  <br>\n  <i>(i.e. that resolves to <code>never</code>)</i>\n</p>\n\n---\n\nAny other non-representable meta-type (e.g. an object with a non-representable but required property) will be instanciated as `M.Never`.\n\nThere are drawbacks to this choice (the said property is hard to find and debug) but stronger benefits: This drastically reduces type computations, in particular in [intersections](#intersect) and [exclusions](#exclude). This is crucial for performances and stability.\n\n## ✨ Meta-types\n\n### Never\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Never\n>;\n// => never\n```\n\n### Any\n\n**Arguments:**\n\n- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)\n- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Any\n>;\n// => unknown\n```\n\n### Const\n\nUsed for types with [cardinalities](#meta-types) of 1.\n\n**Arguments:**\n\n- <code>Value <i>(type)</i></code>\n- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)\n- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Const<\"I love pizza\">\n>;\n// => \"I love pizza\"\n```\n\n### Enum\n\nUsed for types with finite [cardinalities](#meta-types).\n\n**Arguments:**\n\n- <code>Values <i>(type union)</i></code>\n- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)\n- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Food = M.Resolve<\n  M.Enum<\"pizza\" | \"tacos\" | \"fries\">\n>;\n// => \"pizza\" | \"tacos\" | \"fries\"\n```\n\n> ☝️ `M.Enum<never>` is [non-representable](#✨-meta-types)\n\n### Primitive\n\nUsed for either `string`, `number`, `boolean` or `null`.\n\n**Arguments:**\n\n- <code>Value <i>(string | number | boolean | null)</i></code>\n- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)\n- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Primitive<string>\n>;\n// => string\n```\n\n### Array\n\nUsed for lists of items of the same type.\n\n**Arguments:**\n\n- <code>Items <i>(?meta-type = M.Any)</i></code>\n- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)\n- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Array\n>;\n// => unknown[]\n\ntype Resolved = M.Resolve<\n  M.Array<M.Primitive<string>>\n>;\n// => string[]\n```\n\n> ☝️ Any meta-array is representable by `[]`\n\n### Tuple\n\nUsed for finite, ordered lists of items of different types.\n\nMeta-tuples can have **additional items**, typed as [`M.Never`](#never) by default. Thus, any meta-tuple is considered **closed** (additional items not allowed), unless a representable additional items meta-type is specified, in which case it becomes **open**.\n\n**Arguments:**\n\n- <code>RequiredItems <i>(meta-type[])</i>:</code>\n- <code>AdditionalItems <i>(?meta-type = M.Never)</i></code>: Type of additional items\n- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)\n- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Tuple<[M.Primitive<string>]>\n>;\n// => [string]\n\ntype Resolved = M.Resolve<\n  M.Tuple<\n    [M.Primitive<string>],\n    M.Primitive<string>\n  >\n>;\n// => [string, ...string[]]\n```\n\n> ☝️ A meta-tuple is [non-representable](#✨-meta-types) if one of its required items is non-representable\n\n### Object\n\nUsed for sets of key-value pairs (properties) which can be required or not.\n\nMeta-objects can have **additional properties**, typed as [`M.Never`](#never) by default. Thus, any meta-object is considered **closed** (additional properties not allowed), unless a representable additional properties meta-type is specified, in which case it becomes **open**.\n\nIn presence of named properties, open meta-objects additional properties are resolved as `unknown` to avoid conflicts. However, they are used as long as the meta-type is not resolved (especially in [intersections](#intersect) and [exclusions](#exclude)).\n\n**Arguments:**\n\n- <code>NamedProperties <i>(?{ [key:string]: meta-type } = {})</i></code>\n- <code>RequiredPropertiesKeys <i>(?string union = never)</i></code>\n- <code>AdditionalProperties <i>(?meta-type = M.Never)</i></code>: The type of additional properties\n- <code>CloseOnResolve <i>(?boolean = false)</i></code>: Ignore `AdditionalProperties` at resolution time\n- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)\n- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)\n\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Object<\n    {\n      required: M.Primitive<string>;\n      notRequired: M.Primitive<null>;\n    },\n    \"required\",\n    M.Primitive<number>\n  >\n>;\n// => {\n//  req: string,\n//  notRequired?: null,\n//  [key: string]: unknown\n// }\n\ntype ClosedOnResolve = M.Resolve<\n  M.Object<\n    {\n      required: M.Primitive<string>;\n      notRequired: M.Primitive<null>;\n    },\n    \"required\",\n    M.Primitive<number>,\n    false\n  >\n>;\n// => {\n//  req: string,\n//  notRequired?: null,\n// }\n```\n\n> ☝️ A meta-object is [non-representable](#✨-meta-types) if one of its required properties value is non-representable:\n>\n> - If it is a non-representable named property\n> - If it is an additional property, and the object is closed\n\n### Union\n\nUsed to combine meta-types in a union of meta-types.\n\n**Arguments:**\n\n- <code>Values <i>(meta-type union)</i></code>\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Food = M.Resolve<\n  M.Union<\n    | M.Primitive<number>\n    | M.Enum<\"pizza\" | \"tacos\" | \"fries\">\n    | M.Const<true>\n  >\n>;\n// => number\n// | \"pizza\" | \"tacos\" | \"fries\"\n// | true\n```\n\n> ☝️ A meta-union is [non-representable](#✨-meta-types) if it is empty, or if none of its elements is representable\n\n> ☝️ Along with [M.Never](#never), M.Union is the only meta-type that doesn't support [serialization](#-deserialization)\n\n## ???? Methods\n\n### Resolve\n\nResolves the meta-type to its encapsulated type.\n\n**Arguments:**\n\n- <code>MetaType <i>(meta-type)</i></code>\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Resolved = M.Resolve<\n  M.Primitive<string>\n>;\n// => string\n```\n\n### Intersect\n\nTakes two meta-types as arguments, and returns their intersection as a meta-type.\n\n**Arguments:**\n\n- <code>LeftMetaType <i>(meta-type)</i></code>\n- <code>RightMetaType <i>(meta-type)</i></code>\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Intersected = M.Intersect<\n  M.Primitive<string>,\n  M.Enum<\"I love pizza\"\n    | [\"tacos\"]\n    | { and: \"fries\" }\n  >\n>\n// => M.Enum<\"I love pizza\">\n```\n\nMeta-type intersections differ from conventional intersections:\n\n<!-- prettier-ignore -->\n```typescript\ntype ConventionalIntersection =\n  { str: string } & { num: number };\n// => { str: string, num: number }\n\ntype MetaIntersection = M.Intersect<\n  M.Object<\n    { str: M.Primitive<string> },\n    \"str\"\n  >,\n  M.Object<\n    { num: M.Primitive<number> },\n    \"num\"\n  >\n>;\n// => M.Never: \"num\" is required in B\n// ...but denied in A\n```\n\nIntersections are recursively propagated among tuple items and object properties, and take into account additional items and properties:\n\n<!-- prettier-ignore -->\n```typescript\ntype Intersected = M.Intersect<\n  M.Tuple<\n    [M.Primitive<number>],\n    M.Primitive<string>\n  >,\n  M.Tuple<\n    [M.Enum<\"pizza\" | 42>],\n    M.Enum<\"fries\" | true>\n  >\n>;\n// => M.Tuple<\n//  [M.Enum<42>],\n//  M.Enum<\"fries\">\n// >\n\ntype Intersected = M.Intersect<\n  M.Object<\n    { food: M.Primitive<string> },\n    \"food\",\n    M.Any\n  >,\n  M.Object<\n    { age: M.Primitive<number> },\n    \"age\",\n    M.Enum<\"pizza\" | \"fries\" | 42>\n  >\n>;\n// => M.Object<\n//  {\n//    food: M.Enum<\"pizza\" | \"fries\">,\n//    age: M.Primitive<number>\n//  },\n//  \"food\" | \"age\",\n//  M.Enum<\"pizza\" | \"fries\" | 42>\n// >\n```\n\nIntersections are distributed among unions:\n\n<!-- prettier-ignore -->\n```typescript\ntype Intersected = M.Intersect<\n  M.Primitive<string>,\n  M.Union<\n    | M.Const<\"pizza\">\n    | M.Const<42>\n  >\n>;\n// => M.Union<\n//  | M.Const<\"pizza\">\n//  | M.Never\n// >\n```\n\n### Exclude\n\nTakes two meta-types as arguments, and returns their exclusion as a meta-type.\n\n**Arguments:**\n\n- <code>SourceMetaType <i>(meta-type)</i></code>\n- <code>ExcludedMetaType <i>(meta-type)</i></code>\n\n<!-- prettier-ignore -->\n```typescript\nimport { M } from \"ts-algebra\";\n\ntype Excluded = M.Exclude<\n  M.Enum<\"I love pizza\"\n    | [\"tacos\"]\n    | { and: \"fries\" }\n  >,\n  M.Primitive<string>,\n>\n// => M.Enum<\n//  | [\"tacos\"]\n//  | { and: \"fries\" }\n// >\n```\n\nMeta-type exclusions differ from conventional exclusions:\n\n<!-- prettier-ignore -->\n```typescript\ntype ConventionalExclusion = Exclude<\n  { req: string; notReq?: string },\n  { req: string }\n>;\n// => never\n// ObjectA is assignable to ObjectB\n\ntype MetaExclusion = M.Exclude<\n  M.Object<\n    {\n      req: M.Primitive<string>;\n      notReq: M.Primitive<string>;\n    },\n    \"req\"\n  >,\n  M.Object<\n    { req: M.Primitive<string> },\n    \"req\"\n  >\n>;\n// => ObjectA\n// Exclusion is still representable\n```\n\n<!-- prettier-ignore -->\n```typescript\ntype ConventionalExclusion = Exclude<\n  { food: \"pizza\" | 42 },\n  { [k: string]: number }\n>;\n// => { food: \"pizza\" | 42 }\n\ntype MetaExclusion = M.Exclude<\n  M.Object<\n    { food: M.Enum<\"pizza\" | 42> },\n    \"food\"\n  >,\n  M.Object<\n    {},\n    never,\n    M.Primitive<number>\n  >\n>;\n// => M.Object<\n//  { food: M.Enum<\"pizza\"> },\n//  \"food\"\n// >\n```\n\nWhen exclusions can be collapsed on a single item or property, they are recursively propagated among tuple items and object properties, taking into account additional items and properties:\n\n<!-- prettier-ignore -->\n```typescript\ntype Excluded = M.Exclude<\n  M.Tuple<[M.Enum<\"pizza\" | 42>]>,\n  M.Tuple<[M.Primitive<number>]>\n>;\n// => M.Tuple<[M.Enum<\"pizza\">]>\n\ntype Excluded = M.Exclude<\n  M.Tuple<\n    [M.Enum<\"pizza\" | 42>],\n    M.Enum<\"fries\" | true>\n  >,\n  M.Tuple<\n    [M.Primitive<number>],\n    M.Primitive<string>\n  >\n>;\n// => TupleA\n// Exclusion is not collapsable on a single item\n\ntype Excluded = M.Exclude<\n  M.Object<\n    {\n      reqA: M.Enum<\"pizza\" | 42>;\n      reqB: M.Enum<\"pizza\" | 42>;\n    },\n    \"reqA\" | \"reqB\"\n  >,\n  M.Object<\n    {},\n    never,\n    M.Primitive<number>\n  >\n>;\n// => ObjectA\n// Exclusion is not collapsable on a single property\n```\n\nExclusions are distributed among unions:\n\n<!-- prettier-ignore -->\n```typescript\ntype Excluded = M.Exclude<\n  M.Union<\n    | M.Const<\"pizza\">\n    | M.Const<42>\n  >,\n  M.Primitive<number>\n>;\n// => M.Union<\n//  | M.Const<\"pizza\">\n//  | M.Never\n// >\n```\n\nExcluding a union returns the intersection of the exclusions of all elements, applied separately:\n\n<!-- prettier-ignore -->\n```typescript\ntype Excluded = M.Exclude<\n  M.Enum<42 | \"pizza\" | true>,\n  M.Union<\n    | M.Primitive<number>\n    | M.Primitive<boolean>\n  >\n>;\n// => M.Enum<\"pizza\">\n```\n\n## ???? Deserialization\n\nAll meta-types except [`M.Never`](#never) and [`M.Union`](#union) can carry an extra type for [deserialization](https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html) purposes. This extra-type will be passed along in operations and override the resolved type.\n\nFor instance, it is common to deserialize timestamps as `Date` objects. The last two arguments of [`M.Primitive`](#primitive) can be used to implement this:\n\n<!-- prettier-ignore -->\n```typescript\ntype MetaTimestamp = M.Primitive<\n  string,\n  true, // <= enables deserialization (false by default)\n  Date // <= overrides resolved type\n>;\n\ntype Resolved = M.Resolve<MetaTimestamp>;\n// => Date\n```\n\nNote that `MetaTimestamp` will still be considered as a string meta-type until it is resolved: Deserialization only take effect **at resolution time**.\n\n<!-- prettier-ignore -->\n```typescript\ntype Intersected = M.Intersect<\n  MetaTimestamp,\n  M.Object<{}, never, M.Any> // <= Date is an object...\n>;\n// => M.Never\n// ...but doesn't intersect Timestamp\n```\n\nIn representable [intersections](#intersect):\n\n- If no meta-type is serialized, the resulting intersection is not serialized.\n- If only one meta-type (left or right) is serialized, the resulting intersection inherits from its deserialization properties.\n- If both left and right meta-types are serialized, the resulting intersection inherits from both deserialization properties, through a conventional intersection (`A & B`).\n\n<!-- prettier-ignore -->\n```typescript\ntype MetaBrandedString = M.Primitive<\n  string,\n  true,\n  { brand: \"timestamp\" }\n>;\n\ntype Resolved = M.Resolve<\n  M.Intersect<\n    MetaTimestamp,\n    MetaBrandedString\n  >\n>\n// => Date & { brand: \"timestamp\" }\n```\n\nIn representable [exclusions](#exclude):\n\n- If the source meta-type is not serialized, the resulting exclusion is not serialized.\n- If the source meta-type is serialized, the resulting exclusion inherits of its deserialization properties.\n\n## ???? Type constraints\n\nTo prevent errors, meta-types inputs are validated against type constraints:\n\n<!-- prettier-ignore -->\n```typescript\ntype Invalid = M.Array<\n  string // <= ❌ Meta-type expected\n>;\n```\n\nIf you need to use them, all type constraints are also exported:\n\n| Meta-type     | Type constraint                                                        |\n| ------------- | :--------------------------------------------------------------------- |\n| `M.Any`       | `M.AnyType` = `M.Any`                                                  |\n| `M.Never`     | `M.NeverType` = `M.Never`                                              |\n| `M.Const`     | `M.ConstType` = `M.Const<any>`                                         |\n| `M.Enum`      | `M.EnumType` = `M.Enum<any>`                                           |\n| `M.Primitive` | `M.PrimitiveType` = `M.Primitive<null \\| boolean \\| number \\| string>` |\n| `M.Array`     | `M.ArrayType` = `M.Array<M.Type>`                                      |\n| `M.Tuple`     | `M.TupleType` = `M.Tuple<M.Type[], M.Type>`                            |\n| `M.Object`    | `M.ObjectType` = `M.Object<Record<string, M.Type>, string, M.Type>`    |\n| `M.Union`     | `M.UnionType` = `M.Union<M.Type>`                                      |\n| -             | `M.Type` = Union of the above                                          |\n\n## ✂️ Unsafe types and methods\n\nIn deep and self-referencing computations like in [json-schema-to-ts](https://github.com/ThomasAribart/json-schema-to-ts), type constraints can become an issue, as the compiler may not be able to confirm the input type validity ahead of usage.\n\n<!-- prettier-ignore -->\n```typescript\ntype MyArray = M.Array<\n  VeryDeepTypeComputation<\n    ...\n  > // <= ???? Type constraint can break\n>\n```\n\nFor such cases, `ts-algebra` exposes **\"unsafe\"** types and methods, that behave the same as \"safe\" ones but removing any type constraints. If you use them, beware: The integrity of the compiling is up to you ????\n\n| Safe          | Unsafe         |\n| ------------- | -------------- |\n| `M.Any`       | -              |\n| `M.Never`     | -              |\n| `M.Const`     | -              |\n| `M.Enum`      | -              |\n| `M.Primitive` | `M.$Primitive` |\n| `M.Array`     | `M.$Array`     |\n| `M.Tuple`     | `M.$Tuple`     |\n| `M.Object`    | `M.$Object`    |\n| `M.Union`     | `M.$Union`     |\n| `M.Resolve`   | `M.$Resolve`   |\n| `M.Intersect` | `M.$Intersect` |\n| `M.Exclude`   | `M.$Exclude`   |\n","_attachments":{},"homepage":"https://github.com/ThomasAribart/ts-algebra#readme","bugs":{"url":"https://github.com/ThomasAribart/ts-algebra/issues"},"license":"MIT"}