{"id":15678631,"url":"https://github.com/zxch3n/typed-string","last_synced_at":"2026-04-13T22:34:52.605Z","repository":{"id":57383433,"uuid":"346650987","full_name":"zxch3n/typed-string","owner":"zxch3n","description":"Use JSON.parse \u0026 JSON.stringify safely with TypeScript ","archived":false,"fork":false,"pushed_at":"2021-03-11T10:06:03.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T12:02:19.938Z","etag":null,"topics":["frontend","javascript","json","typescript","web"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zxch3n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-11T09:41:43.000Z","updated_at":"2021-03-11T10:06:06.000Z","dependencies_parsed_at":"2022-09-26T16:50:29.457Z","dependency_job_id":null,"html_url":"https://github.com/zxch3n/typed-string","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zxch3n/typed-string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxch3n%2Ftyped-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxch3n%2Ftyped-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxch3n%2Ftyped-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxch3n%2Ftyped-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zxch3n","download_url":"https://codeload.github.com/zxch3n/typed-string/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxch3n%2Ftyped-string/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31774177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"last_error":"SSL_read: 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":["frontend","javascript","json","typescript","web"],"created_at":"2024-10-03T16:23:29.307Z","updated_at":"2026-04-13T22:34:52.573Z","avatar_url":"https://github.com/zxch3n.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typed String\n\n\u003e Use JSON.parse \u0026 JSON.stringify safely with TypeScript 🥳\n\n## Usage\n\n**Install**\n\n```\nyarn add -D typed-string\n```\n\n**Use in TypeScript**\n\n```typescript\nimport {StringifyFrom} from 'typed-string'\n\n/**\n * Get special string type `StringifyFrom\u003cT\u003e` after JSON.stringify.\n */\n\n// const a: StringifyFrom\u003c{ a: number; }\u003e\nconst a = JSON.stringify({a: 123}) \n\n/**\n *  Infer parsed object type\n */\n\n// const b: {a: number}\nconst b = JSON.parse(a) \n\n/**\n *  It will fallback to any if no types are matched\n */\n\n// const c: any\nconst c = JSON.parse('\"normal string\"'); \n\n// const d: {v: number}\nconst d = JSON.parse(\"{v: 123}\" as StringifyFrom\u003c{v: number}\u003e); \n```\n\nIt exposes `StringifyFrom\u003cT\u003e` type. StringifyFrom\u003cT\u003e is just string type:\n\n```typescript\ntype StringifyFrom\u003cT\u003e = string \u0026 {\n    toString: () =\u003e StringifyFrom\u003cT\u003e;\n};\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxch3n%2Ftyped-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzxch3n%2Ftyped-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxch3n%2Ftyped-string/lists"}