{"id":28962745,"url":"https://github.com/deno-prototyping/rusty-types","last_synced_at":"2026-05-08T14:46:22.804Z","repository":{"id":300373798,"uuid":"1005981992","full_name":"deno-prototyping/rusty-types","owner":"deno-prototyping","description":"Easily create Rust-flavored datatypes in TypeScript","archived":false,"fork":false,"pushed_at":"2025-06-21T09:42:09.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-21T10:35:45.975Z","etag":null,"topics":["deno","enum","prototyping","rust","standard-schema","struct","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deno-prototyping.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-21T08:13:14.000Z","updated_at":"2025-06-21T09:42:12.000Z","dependencies_parsed_at":"2025-06-21T10:47:11.276Z","dependency_job_id":null,"html_url":"https://github.com/deno-prototyping/rusty-types","commit_stats":null,"previous_names":["deno-prototyping/rusty-types"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deno-prototyping/rusty-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deno-prototyping%2Frusty-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deno-prototyping%2Frusty-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deno-prototyping%2Frusty-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deno-prototyping%2Frusty-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deno-prototyping","download_url":"https://codeload.github.com/deno-prototyping/rusty-types/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deno-prototyping%2Frusty-types/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261595784,"owners_count":23182249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["deno","enum","prototyping","rust","standard-schema","struct","typescript"],"created_at":"2025-06-24T03:11:57.542Z","updated_at":"2026-05-08T14:46:17.767Z","avatar_url":"https://github.com/deno-prototyping.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Rusty Types\n\n\u003e [!NOTE]\n\u003e This project is still a work in progress.\n\nThis package help you create Rust flavored datatypes in TypeScript.\n\n## Usage\n\n\u003e [!NOTE]\n\u003e Currently rusty-types is not published to JSR.\n\u003e You can import it with JSDelivr.\n\nTwo foundamental exports from `rusty-types` is `Struct` and `Enum`.\n\n`rusty-types` use [`standard-schema`](https://github.com/standard-schema/standard-schema) in its interface,\nso you can use [Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [Arktype](https://arktype.io/)\nor any other validator to your best fits.\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eCase\u003c/th\u003e\n\u003cth\u003eRust\u003c/th\u003e\n\u003cth\u003erusty-types\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\n\u003ctr\u003e\n\u003ctd\u003eNamed struct\u003c/td\u003e\n\u003ctd\u003e\n\n```rust\nstruct Person {\n  name: String,\n  age: usize,\n}\n\nlet person = Person {\n  name: \"Alice\".into(),\n  age: 20\n};\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```typescript\nconst Person = Struct({\n  name: z.string(),\n  age: z.number(),\n});\n\nconst alice = new Person({\n  name: \"Alice\",\n  age: 20\n});\nconst bob = Person({\n  name: \"Bob\",\n  age: 22\n});\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003eTuple struct\u003c/td\u003e\n\u003ctd\u003e\n\n```rust\nstruct Vec3(f32, f32, f32);\n\nlet vec = Vec3(1., 2., 3.);\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```typescript\nconst Vec3 = Struct([\n  z.number(),\n  z.number(),\n  z.number(),\n]);\n\nconst vec_1 = new Vec3(1, 2, 3);\nconst vec_2 = Vec3(4, 5, 6);\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003eEnum\u003c/td\u003e\n\u003ctd\u003e\n\n```rust\nenum Event {\n  Key { code: usize },\n  Mouse {\n    state: usize,\n    button: usize,\n  },\n  Paste(String),\n}\n\nlet event_1 = Event::Key {\n  code: 123\n};\nlet event_2 = Event::Mouse {\n  button: 123,\n  state: 0,\n};\nlet event_3 = Event::Paste(\n  \"some text\".into()\n);\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```typescript\nconst Event = Enum({\n  Key: { code: z.number() },\n  Mouse: {\n    state: z.number(),\n    button: z.number()\n  },\n  Paste: [z.string()] as const,\n});\n\nconst event_1 = Event.Key({\n  code: 123\n});\nconst event_2 = new Event.Mouse({\n  button: 123,\n  state: 0\n});\nconst event_3 = new Event.Paste(\n  \"some text\"\n);\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n## Roadmap\n\n- [ ] custom transform\n- [ ] methods\n- [ ] extends\n- [ ] auto JS-lize(e.g. `get_name()` -\u003e `get name()`)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeno-prototyping%2Frusty-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeno-prototyping%2Frusty-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeno-prototyping%2Frusty-types/lists"}