{"id":15314247,"url":"https://github.com/barelyhuman/typeable","last_synced_at":"2025-04-15T02:12:44.235Z","repository":{"id":65384247,"uuid":"591368706","full_name":"barelyhuman/typeable","owner":"barelyhuman","description":"a on-the-fly type generator for objects in node","archived":false,"fork":false,"pushed_at":"2023-02-05T18:47:14.000Z","size":68,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T02:12:33.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/barelyhuman.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}},"created_at":"2023-01-20T15:33:39.000Z","updated_at":"2023-12-29T02:09:38.000Z","dependencies_parsed_at":"2023-02-19T01:15:35.073Z","dependency_job_id":null,"html_url":"https://github.com/barelyhuman/typeable","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ftypeable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ftypeable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ftypeable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ftypeable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barelyhuman","download_url":"https://codeload.github.com/barelyhuman/typeable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991558,"owners_count":21194894,"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":[],"created_at":"2024-10-01T08:44:51.112Z","updated_at":"2025-04-15T02:12:44.221Z","avatar_url":"https://github.com/barelyhuman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# typeable\n\n\u003e a on-the-fly type generator for objects in node\n\n\u003e **Warning**: This will not really work in a browser, it expects a filesystem\n\n## Installation\n\nInstall `@barelyhuman/typeable` with npm\n\n```bash\n  npm install @barelyhuman/typeable\n```\n\n## What and Why\n\nIt's a generator for object interfaces. I have a project that I'm working on\nwhich has a ton of shared objects being defined during development, this makes\nit hard to keep track of what all was defined on the object.\n\nTypescript has cross file inference but still doesn't help with dynamically\ndefined properties so this helps generate a declarations file that stores all\nthe properties added to the object. There's definite knick knacks that can be\nfixed.\n\n\u003e **Note**: This is a subset requirement for one of my packages and **might\n\u003e not** be something you need for your day to day development. The generator's\n\u003e goal is to be able to generate types at runtime while in development.\n\n\u003e **Note**: If the `NODE_ENV` is set to `production`, the type generator will\n\u003e not run.\n\n## Usage\n\n```js\nconst { createTypeable } = require('@barelyhuman/typeable')\n\n/**\n * @type {import(\"./typeable\").App}\n */\n\nconst app = createTypeable(\n  {}, // an empty object or reference to an object to be read\n  {\n    outfile: 'typeable.d.ts', // output path for the generated declaration file\n    rootInterfaceName: 'App', // the interface name to be generated for the above object.\n  }\n)\n\n// add in properties, functions, methods, etc to the new typeable object.\napp.property = {}\napp.property.method = function () {}\n```\n\n```ts\n// typeable.d.ts\nexport interface App {\n  property: property\n}\n\ninterface property {\n  // generated generic functions right now\n  method: (...args: any[]) =\u003e any\n}\n```\n\n## Caveats\n\n- Cannot handle `kebab-case` or `spaced keys` and will ignore them altogether\n- Cannot infer the type of arguments from a function\n\n## License\n\n[MIT](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarelyhuman%2Ftypeable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarelyhuman%2Ftypeable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarelyhuman%2Ftypeable/lists"}