{"id":16765262,"url":"https://github.com/devlato/compiled-coffee","last_synced_at":"2026-03-18T22:04:33.875Z","repository":{"id":19642807,"uuid":"22895122","full_name":"devlato/compiled-coffee","owner":"devlato","description":"CompiledCoffee combines CoffeeScript with TypeScript's type system via the definition files.","archived":false,"fork":false,"pushed_at":"2014-06-24T11:27:21.000Z","size":607,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T23:42:52.704Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"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/devlato.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":"2014-08-12T22:53:54.000Z","updated_at":"2023-03-23T22:26:19.000Z","dependencies_parsed_at":"2022-08-24T14:03:56.410Z","dependency_job_id":null,"html_url":"https://github.com/devlato/compiled-coffee","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/devlato%2Fcompiled-coffee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlato%2Fcompiled-coffee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlato%2Fcompiled-coffee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlato%2Fcompiled-coffee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlato","download_url":"https://codeload.github.com/devlato/compiled-coffee/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243864626,"owners_count":20360355,"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-13T05:28:53.758Z","updated_at":"2026-01-02T08:44:13.133Z","avatar_url":"https://github.com/devlato.png","language":null,"readme":"# CompiledCoffee\n\nDo you like the type safety of TypeScript and the concise syntax of \nCoffeeScript? In that case CompiledCoffee is for you! It combines CoffeeScript \nwith TypeScript's type system via the definition files. You create a *.coffee \nfile and a *.d.ts file with the same name, in which you (optionally) type \nstuff. Rest is handled automatically.\n\n[See it in action](http://www.youtube.com/watch?v=aj4V8TVbjP0) in a \u003c5min \nscreencast.\n\n# Features\n\n- merges CoffeeScript classes with types from d.ts files\n- outputs a TypeScript compilation results\n- all types in d.ts files are optional and function's inner vars' types are\n inferred\n- optionally outputs a [browserify](https://github.com/substack/node-browserify) \n CommonJS module\n- watches for changes (both the source and the d.ts files)\n- compilation is optional, source is backward-compatible with regular \n CoffeeScript\n- supports yield with type safety for both params and return/callback values \n (some d.ts changes needed)\n\n# Installation\n\n```\nnpm install compiled-coffee\n```\n\n# Usage\n\n```\n  Usage: ccoffee -i \u003csrc\u003e -o \u003cbuild\u003e\n\n  Options:\n\n    -h, --help                     output usage information\n    -V, --version                  output the version number\n    -i, --source-dir \u003cdir\u003e         Input directory for the source files (required)\n    -o, --build-dir \u003cdir\u003e          Output directory for the built files (required)\n    -p, --pack \u003cFILE:MODULE_NAME\u003e  Creates a CJS browserify package\n    -w, --watch                    Watch for the source files changes\n    -y, --yield                    Support the yield (generators) syntax (currently doesn't work with --pack)\n```\n\n# Status\n\nRight now you can write typed classes and untyped (but compiled) mocha tests\nwithout any headache. Compiler auto re-compiles the code after a file change.\n\nRequires node --harmony (\u003e=0.11) for the yield support.\n\nIn the definition file you can type following:\n\n- class attributes\n- class methods\n- interfaces\n\nNot yet here:\n\n- default params' types\n- autoset constructor params\n- enums\n- top level functions\n- top level variables\n\n# Limitations\n\nThere are some limitations you need to take into account. Some of them will \ndisappear in the future:\n\n- vars are declared inline (not on the beginning of a function)\n  This is tricky for eg loop assignments. Also `a = b = null` wont work.\n- only CommonJS d.ts files are supported (which means string module names)\n- right now, all the top level elements are exported in TS and duplicated \n  module.exports is needed if one plans to compile it with as a regular\n  CoffeeScript\n- *d.ts files need an indentation of 1 tab or 2 spaces*\n- referenced d.ts files have a base dir from BUILD_DIR\n- class properties are initialized in the constructor, not in the prototype\n- only simple requires are supported eg `foo = require('foo')` \n  not `require('foo').bar` or `{foo} = require('foo')`\n- underscore dependency for ranges (needs a manual require)\n- no down ranges like [9..0]\n- double source map (CS -\u003e TS -\u003e JS) and lack of a shift on \u003e1 line d.ts \n signatures\n- no casting (\\`\\` syntax won't work, which is sad)\n\n# Issues\n\n- Following will cause a stack overflow\n```\na = -\u003e\n  b = -\u003e 1\n```\n- yield in IF statements doesn't work\n- error when doing `a = b = null`\n\n# Roadmap\n\n- Full support for exports\n- Merge currently unsupported d.ts definition types\n  Including definition references\n- Update to CoffeeScript 1.7\n- Merge yield support from [coffy-script](https://github.com/loveencounterflow/coffy-script)\n- Source maps support\n- Compiler speed improvements\n- Merging d.ts with plain JS files\n- Use Closure Compiler as a proper linker\n\n# The flow\n\n- write pure coffeescript\n- write d.ts file for each coffee file\n- transpile coffee to ts\n- change commonjs require and exports to ts versions\n - TODO selective exports\n- merge resulting ts source with d.ts files\n - TODO support more language parts\n - TODO extend existing source map (via https://github.com/mozilla/source-map)\n- compile ts with typescript\n- TODO using a sourcemap and ts service, provide autocompletion information\n - solution similar to tern.js completion for coffee\n- watch for changes and refresh the build result\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlato%2Fcompiled-coffee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlato%2Fcompiled-coffee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlato%2Fcompiled-coffee/lists"}