{"id":13561321,"url":"https://github.com/dillonkearns/elm-ts-json","last_synced_at":"2026-01-12T00:00:08.751Z","repository":{"id":43743748,"uuid":"312894069","full_name":"dillonkearns/elm-ts-json","owner":"dillonkearns","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-02T13:00:38.000Z","size":625,"stargazers_count":43,"open_issues_count":5,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T15:23:32.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dillonkearns.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-11-14T20:12:32.000Z","updated_at":"2025-05-02T23:32:21.000Z","dependencies_parsed_at":"2024-01-05T22:00:42.057Z","dependency_job_id":"13d578ed-2b24-45c7-820c-32c5c09ed5d9","html_url":"https://github.com/dillonkearns/elm-ts-json","commit_stats":{"total_commits":442,"total_committers":5,"mean_commits":88.4,"dds":"0.10633484162895923","last_synced_commit":"b3da00cbf27ddcbbd47d23d56a90f6df49ed70a8"},"previous_names":["dillonkearns/elm-ts-interop"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/dillonkearns/elm-ts-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillonkearns%2Felm-ts-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillonkearns%2Felm-ts-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillonkearns%2Felm-ts-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillonkearns%2Felm-ts-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dillonkearns","download_url":"https://codeload.github.com/dillonkearns/elm-ts-json/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillonkearns%2Felm-ts-json/sbom","scorecard":{"id":343028,"data":{"date":"2025-08-11","repo":{"name":"github.com/dillonkearns/elm-ts-json","commit":"b3da00cbf27ddcbbd47d23d56a90f6df49ed70a8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Code-Review","score":1,"reason":"Found 2/15 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/dillonkearns/elm-ts-json/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/dillonkearns/elm-ts-json/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/dillonkearns/elm-ts-json/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/dillonkearns/elm-ts-json/main.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/dillonkearns/elm-ts-json/main.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/dillonkearns/elm-ts-json/main.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/dillonkearns/elm-ts-json/main.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"41 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-593f-38f6-jp5m","Warn: Project is vulnerable to: GHSA-x2rg-q646-7m2v","Warn: Project is vulnerable to: GHSA-jgmv-j7ww-jx2x","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-v39p-96qg-c8rf","Warn: Project is vulnerable to: GHSA-8v63-cqqc-6r2c","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T06:22:36.437Z","repository_id":43743748,"created_at":"2025-08-18T06:22:36.437Z","updated_at":"2025-08-18T06:22:36.437Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28328622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T22:11:01.104Z","status":"ssl_error","status_checked_at":"2026-01-11T22:10:58.990Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:00:54.853Z","updated_at":"2026-01-12T00:00:08.730Z","avatar_url":"https://github.com/dillonkearns.png","language":"Elm","funding_links":[],"categories":["Elm","Code generators"],"sub_categories":["Individual Podcast episodes"],"readme":"# `elm-ts-json` [![Build Status](https://github.com/dillonkearns/elm-ts-json/workflows/CI/badge.svg)](https://github.com/dillonkearns/elm-ts-json/actions?query=branch%3Amain)\n\nBuild up Encoders/Decoders with well-defined TypeScript types! The API in this package is the foundation of the [`elm-ts-interop`](https://github.com/dillonkearns/elm-ts-interop) CLI tool, but can be used for other purposes as well.\n\n## Core concepts\n\n### Figure out the types for your ports (to and from Elm)\n\nHow does `elm-ts-interop` figure out the types of your ports? There's no magic involved at all. You define a special type of Encoder/Decoder using the `TsJson.Encoder` and `TsJson.Decoder` modules.\n\nThese `Decoder`s and `Encoder`s that you write are the source of truth. It doesn't rely on implicitly generated Decoders or Encoders\n(Evan generally recommends against implicitly defined serialization because of limitations to that approach that he describes in his [vision for data interchange](https://gist.github.com/evancz/1c5f2cf34939336ecb79b97bb89d9da6#gistcomment-2606737)). Instead, you define code with an API that is very similar to `elm/json`. But this API knows the type information of the Encoder or Decoder you've built.\n\nFor example, if you use `TsDecode.string`, it knows that will expect to receive a `string` from TypeScript. `TsDecode.list TsDecode.string`\nwill expect to receive `string[]` from TypeScript. You can even build up more expressive TypeScript types like Unions:\n\n```elm\nimport TsJson.Decode as TsDecode\nimport TsJson.Type\n\nTsDecode.oneOf\n    [ TsDecode.string\n    , TsDecode.int |\u003e TsDecode.map String.fromInt\n    ]\n    |\u003e TsDecode.tsType\n    |\u003e TsJson.Type.toTypeScript\n    --\u003e \"string | number\"\n```\n\nSo we've written a Decoder very similar to how we would with `elm/json`, but this `Decoder` has one key difference.\nWe can turn the `Decoder` itself into a TypeScript type (`string | number`). And without even passing a value through the `Decoder`\n From this simple idea, you can build very sophisticated typed interop, even sending/receiving Elm Custom Types,\nand sending/receiving TypeScript discriminated unions.\n\n## Example\n\n```elm\nimport Json.Encode as JE\nimport TsJson.Encode as Encode exposing (Encoder)\nimport TsJson.Decode as Decode exposing (Decoder)\n\ntype User\n    = Regular { name : String }\n    | Guest\n\nuserEncoder : Encoder User\nuserEncoder =\n    Encode.union\n        (\\vRegular vGuest value -\u003e\n            case value of\n                Regular data -\u003e\n                    vRegular data\n                Guest -\u003e\n                    vGuest\n        )\n        |\u003e Encode.variant\n            (Encode.object\n                [ Encode.required \"kind\" identity (Encode.literal \u003c| JE.string \"regular\")\n                , Encode.required \"name\" .name Encode.string\n                ]\n            )\n        |\u003e Encode.variantLiteral (JE.object [ ( \"kind\", JE.string \"guest\" ) ])\n        |\u003e Encode.buildUnion\n\n\nuserDecoder : Decoder User\nuserDecoder =\n    Decode.oneOf\n        [ Decode.succeed (\\() name -\u003e Regular { name = name })\n            |\u003e Decode.andMap (Decode.field \"kind\" (Decode.literal () (JE.string \"regular\")))\n            |\u003e Decode.andMap (Decode.field \"name\" Decode.string)\n        , Decode.literal Guest (JE.object [ ( \"kind\", JE.string \"guest\" ) ])\n        ]\n\ntype alias Name =\n    { first : String, last : String }\n\n\nnameEncoder : Encoder Name\nnameEncoder =\n    Encode.object\n        [ Encode.required \"first\" .first Encode.string\n        , Encode.required \"last\" .last Encode.string\n        ]\n\n\nnameDecoder : Decoder Name\nnameDecoder =\n    Decode.succeed Name\n        |\u003e Decode.andMap (Decode.field \"first\" Decode.string)\n        |\u003e Decode.andMap (Decode.field \"last\" Decode.string)\n\nGuest\n    |\u003e Encode.runExample userEncoder\n--\u003e { output = \"\"\"{\"kind\":\"guest\"}\"\"\"\n--\u003e , tsType = \"\"\"{\"kind\":\"guest\"} | { kind : \"regular\"; name : string }\"\"\"\n--\u003e }\n\nuserDecoder |\u003e Decode.runExample \"\"\"{\"kind\":\"guest\"}\"\"\"\n--\u003e { decoded = Ok Guest\n--\u003e , tsType = \"\"\"{ kind : \"regular\"; name : string } | {\"kind\":\"guest\"}\"\"\"\n--\u003e }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillonkearns%2Felm-ts-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdillonkearns%2Felm-ts-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillonkearns%2Felm-ts-json/lists"}