{"id":20459430,"url":"https://github.com/mkgaru/moddable-types","last_synced_at":"2026-04-19T00:04:42.734Z","repository":{"id":82371786,"uuid":"467565049","full_name":"MKGaru/moddable-types","owner":"MKGaru","description":"[WIP] Moddable definitely typed EcmaTC53","archived":false,"fork":false,"pushed_at":"2022-04-01T05:41:19.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T00:23:42.984Z","etag":null,"topics":["esp32","iot","moddable","typescript"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MKGaru.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}},"created_at":"2022-03-08T15:18:22.000Z","updated_at":"2022-03-13T07:36:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"33a7b383-a6e3-44a6-81ec-d8dd618388e0","html_url":"https://github.com/MKGaru/moddable-types","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKGaru%2Fmoddable-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKGaru%2Fmoddable-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKGaru%2Fmoddable-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKGaru%2Fmoddable-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MKGaru","download_url":"https://codeload.github.com/MKGaru/moddable-types/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242014715,"owners_count":20057879,"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":["esp32","iot","moddable","typescript"],"created_at":"2024-11-15T12:16:04.692Z","updated_at":"2026-04-19T00:04:42.694Z","avatar_url":"https://github.com/MKGaru.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"moddable-types\n===============================\n[\u003cimg src=\"https://raw.githubusercontent.com/Moddable-OpenSource/moddable/public/documentation/assets/moddable/moddable.png\" align=\"right\"\u003e](https://github.com/Moddable-OpenSource/moddable)\n\n[WIP] Moddable definitely typed Ecma TC53\n\n[Coution] I have no plans to maintain this project.  \nThis is temporary project while waiting for the type definition merges that Mr. Chris Midgley and other contributes are currently working on.\n\nUsage\n-------------------------------\n\n```bash\ncd $MODDABLE/../\ngit clone https://github.com/MKGaru/moddable-types.git\ncd YOUR_MODDABLE_PROJECT\nmcconfig -d -p esp32/nodemcu # \u003c-- your build platform\nln -s $MODDABLE/build/tmp/esp32/nodemcu/debug/YOUR_MODDABLE_PROJECT/modules/tsconfig.json tsconfig.json\n```\n\nExample\n--------------------------------\nio/digital/blink example\n\n```bash\ncp -r $MODDABLE/examples/io/digital/blink AWESOME_PROJECT\ncd AWESOME_PROJECT\nmv main.js main.ts\n```\n\nedit manifest.json, add \"include\"\n\n```\n\"$(MODDABLE)/examples/manifest_typings.json\",\n\"$(MODDABLE)/../moddable-types/manifest.json\"\n```\n\n```bash\nmcconfig -d -p esp32/nodemcu # \u003c-- your build platform\nln -s $MODDABLE/build/tmp/esp32/nodemcu/debug/AWESOME_PROJECT/modules/tsconfig.json tsconfig.json\ncode . # \u003c-- open VisualStudio Code\n\nmcconfig -d -m -p esp32/nodemcu\n# or if you use xs-dev\n# xs-dev run --device=esp32/nodemcu\n```\n\n[Optional] External modules (like dtex/j5e)\n-----------------------------------\ninstall (see https://dtex.github.io/j5e/tutorial-A-GETSTARTED.html)\n```bash\npushd $MODDABLE/../\ngit clone https://github.com/dtex/j5e\n\n# or if you use xs-dev (coming soon?)\n# xs-dev get dtex/j5e\n\ncd j5e\nexport j5e=$PWD\npopd\n```\nedit manifest.json, add \"include\"\n\n```\n\"$(j5e)/manifest.json\"\n```\n\nand generate d.ts\n```bash\ntsc $j5e/lib/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir $j5e/typings\n```\n\u003cdetails\u003e\n  \u003csummary\u003e📓 Special notes for the j5e library\u003c/summary\u003e\n  Many of the classes in the j5e library are asynchronous constructors, so you need a type definition patch.\n  \n  ```bash\n  cd j5e/../\n  touch replace.js\n  ```\n  edit replace.js\n  ```javascript\n  module.exports = {\n    files: 'j5e/typings/**/index.d.ts',\n    from: /^export default (.+);$/m,\n    to: (match, name) =\u003e name == 'asyncClass' ? match : `export default asyncClass\ninterface AsyncClass\u003cT extends { new (...args: any[]): void }\u003e {\nnew (...args: ConstructorParameters\u003cT\u003e): Promise\u003cInstanceType\u003cT\u003e\u003e\n}\ndeclare const asyncClass: AsyncClass\u003ctypeof ${name}\u003e\n`\n  }\n  ```\n  \n  ```bash\n  npx replace-in-file --configFile=replace.js\n  rm replace.js\n  ```\n  --------------------------------------------------\n\u003c/details\u003e\n\nand, add \"typescript/tsconfig\"\n\n```json\n\"typescript\": {\n  \"tsconfig\": {\n    \"compilerOptions\": {\n      \"paths\": {\n        \"j5e/*\": [\n          \"$(j5e)/typings/*/index\"\n        ]\n      }\n    }\n  }\n}\n```\nlike this. (complete manifest.json)\n\n```json\n{\n  \"include\": [\n    \"$(MODDABLE)/modules/io/manifest.json\",\n    \"$(MODDABLE)/examples/manifest_typings.json\",\n    \"$(MODDABLE)/../moddable-types/manifest.json\",\n    \"$(j5e)/manifest.json\"\n  ],\n  \"modules\": {\n    \"*\": \"./main\"\n  },\n  \"typescript\": {\n    \"tsconfig\": {\n      \"compilerOptions\": {\n        \"paths\": {\n          \"j5e/*\": [\n            \"$(j5e)/typings/*/index\"\n          ]\n        }\n      }\n    }\n  }\n}\n```\nand execute command for (re)generating tsconfig.json\n\n```bash\nmcconfig -d -p esp32/nodemcu\n```\n\nexample code (for esp32/nodemcu like device)\n```typescript\nimport LED from 'j5e/led'\n\nexport default async function () {\n  const led = await new LED(device.pin.led)\n\n  System.setInterval(() =\u003e {\n    if (led.isOn)\n      led.off()\n    else\n      led.on()\n  }, 300);\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkgaru%2Fmoddable-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkgaru%2Fmoddable-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkgaru%2Fmoddable-types/lists"}