{"id":13726331,"url":"https://github.com/rrdelaney/ReasonablyTyped","last_synced_at":"2025-05-07T21:32:06.532Z","repository":{"id":57110179,"uuid":"89317420","full_name":"rrdelaney/ReasonablyTyped","owner":"rrdelaney","description":":diamond_shape_with_a_dot_inside: Converts Flow and TypeScript definitions to Reason interfaces","archived":false,"fork":false,"pushed_at":"2018-08-02T07:37:11.000Z","size":12229,"stargazers_count":518,"open_issues_count":12,"forks_count":24,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-10-30T06:58:29.593Z","etag":null,"topics":["bucklescript","bucklescript-bindings","flowtype","reasonml","typescript"],"latest_commit_sha":null,"homepage":"https://rrdelaney.github.io/ReasonablyTyped/","language":"OCaml","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/rrdelaney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-25T04:26:55.000Z","updated_at":"2024-07-28T10:06:47.000Z","dependencies_parsed_at":"2022-08-21T08:00:16.156Z","dependency_job_id":null,"html_url":"https://github.com/rrdelaney/ReasonablyTyped","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2FReasonablyTyped","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2FReasonablyTyped/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2FReasonablyTyped/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2FReasonablyTyped/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrdelaney","download_url":"https://codeload.github.com/rrdelaney/ReasonablyTyped/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224654225,"owners_count":17347700,"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":["bucklescript","bucklescript-bindings","flowtype","reasonml","typescript"],"created_at":"2024-08-03T01:02:59.649Z","updated_at":"2024-11-14T16:33:42.105Z","avatar_url":"https://github.com/rrdelaney.png","language":"OCaml","readme":"\u003ch1 align=\"center\"\u003e\u003cimg src=\"https://github.com/rrdelaney/ReasonablyTyped/raw/master/docs/logo.png\"\u003e\u003c/h1\u003e\n\n\u003cpre align=\"center\"\u003e\n  $ npm install --global reasonably-typed\n\u003c/pre\u003e\n\n\u003ch4 align=\"center\"\u003e\n  \u003ci\u003eConverts TypeScript and Flow definitions to Reason interfaces\u003c/i\u003e\n  \u003cbr\u003e\n  \u003ci\u003e(Also maybe TypeScript definitions to Flow)\u003c/i\u003e\n\u003c/h4\u003e\n\n\u003chr\u003e\n\n\u003ch3 align=\"center\"\u003eTake your Flow or TypeScript definition\u003c/h3\u003e\n\n```js\n// class.js\ndeclare module 'classes' {\n  declare type State = {\n    id: number,\n    storeName: string,\n  }\n\n  declare export class Store {\n    constructor(initialState: State): Store;\n    state: State;\n    update(nextState: State): void;\n  }\n}\n```\n\n\u003ch3 align=\"center\"\u003eRun retyped\u003c/h3\u003e\n\n\u003cpre align=\"center\"\u003e\n$ retyped class.js\n\u003c/pre\u003e\n\n\u003ch3 align=\"center\"\u003eGet Reason\u003c/h3\u003e\n\n```reason\n/* Module classes */\n\ntype state = {. \"id\": float, \"storeName\": string };\nmodule Store = {\n  type t = {. \"state\": (state), \"update\": [@bs.meth](state =\u003e unit)};\n  [@bs.new] [@bs.module \"classes\"] external make : state =\u003e t = \"Store\";\n};\n```\n\n## Docs\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e\u003ca href=\"https://rrdelaney.github.io/ReasonablyTyped\"\u003eExamples\u003c/a\u003e\u003c/b\u003e\u003c/summary\u003e\n\u003c/details\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eTypeScript\u003c/b\u003e\u003c/summary\u003e\n\nTypeScript has a similar workflow. Compile your TypeScript file with:\n\n```\n$ retyped my-definition.d.ts\n```\n\n\u003c/details\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCommand-line Usage\u003c/b\u003e\u003c/summary\u003e\n\n```\nUsage:\n  $ retyped ...files\n\nExamples:\n  $ retyped file1.js file2.js file3.d.ts                                           [boolean]\n```\n\n\u003c/details\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUsage as a library\u003c/b\u003e\u003c/summary\u003e\nReasonablyTyped also exports a library for use! See the example below:\n\n```js\n// lib-usage.js\nimport * as ReasonablyTyped from 'reasonably-typed'\n\nconst libSrc = fs.readFileSync('lib.js').toString()\nconst bsInterface = ReasonablyTyped.compile(libSrc)\n```\n\n**`format (code: string) =\u003e string`**\n\nFormats a block of code using `refmt`\n\n**`compile (code: string, filename?: string) =\u003e string`**\n\nCompiles a libdef, formats the result, and handles errors cleanly\n\n\u003c/details\u003e\u003c/p\u003e\n\n## Development\n\nSee [DEVELOPING](DEVELOPING.md) and [CONTRIBUTING](CONTRIBUTING.md).\n\n## Status\n\n[![CircleCI](https://circleci.com/gh/rrdelaney/ReasonablyTyped.svg?style=svg)](https://circleci.com/gh/rrdelaney/ReasonablyTyped)\n","funding_links":[],"categories":["OCaml"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrdelaney%2FReasonablyTyped","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrdelaney%2FReasonablyTyped","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrdelaney%2FReasonablyTyped/lists"}