{"id":17105750,"url":"https://github.com/domchen/typescript-plus","last_synced_at":"2026-03-11T13:14:44.967Z","repository":{"id":57383903,"uuid":"70484788","full_name":"domchen/typescript-plus","owner":"domchen","description":"Enhanced version of the original typescript compiler.","archived":false,"fork":false,"pushed_at":"2021-10-14T06:50:41.000Z","size":52746,"stargazers_count":83,"open_issues_count":4,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-08-21T15:58:52.915Z","etag":null,"topics":["reordering","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/domchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-10T12:17:18.000Z","updated_at":"2025-06-11T10:57:57.000Z","dependencies_parsed_at":"2022-09-14T00:52:44.434Z","dependency_job_id":null,"html_url":"https://github.com/domchen/typescript-plus","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/domchen/typescript-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domchen%2Ftypescript-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domchen%2Ftypescript-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domchen%2Ftypescript-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domchen%2Ftypescript-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/domchen","download_url":"https://codeload.github.com/domchen/typescript-plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domchen%2Ftypescript-plus/sbom","scorecard":{"id":350372,"data":{"date":"2025-08-11","repo":{"name":"github.com/domchen/typescript-plus","commit":"02cd4d94518a22ef8fae6fb45770f78a6d986d25"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":0,"reason":"binaries present in source code","details":["Warn: binary detected: tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter/android/gradle/wrapper/gradle-wrapper.jar:1","Warn: binary detected: tests/cases/user/webpack/webpack/examples/wasm-simple/add.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/examples/wasm-simple/factorial.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/examples/wasm-simple/fibonacci.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/test/cases/wasm/import-wasm-wasm/wasm.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/test/cases/wasm/import-wasm-wasm/wasm2.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/test/cases/wasm/imports-circular/wasm.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/test/cases/wasm/imports/wasm.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/test/cases/wasm/order/wasm.wasm:1","Warn: binary detected: tests/cases/user/webpack/webpack/test/cases/wasm/simple/wasm.wasm:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: tests/cases/user/puppeteer/puppeteer/.ci/node6/Dockerfile.linux:1: pin your Docker image by updating node:6.12.3 to node:6.12.3@sha256:1eae48ed9aba671db0ad248881447bcbef012a0f80a0e0877c3b84b36fcff9bd","Warn: containerImage not pinned by hash: tests/cases/user/puppeteer/puppeteer/.ci/node6/Dockerfile.windows:1","Warn: containerImage not pinned by hash: tests/cases/user/puppeteer/puppeteer/.ci/node7/Dockerfile.linux:1: pin your Docker image by updating node:7.10.1 to node:7.10.1@sha256:af5c2c6ac8bc3fa372ac031ef60c45a285eeba7bce9ee9ed66dad3a01e29ab8d","Warn: containerImage not pinned by hash: tests/cases/user/puppeteer/puppeteer/.ci/node7/Dockerfile.windows:1","Warn: npmCommand not pinned by hash: tests/cases/user/create-react-app/create-react-app/tasks/e2e-installs.sh:77","Warn: npmCommand not pinned by hash: tests/cases/user/create-react-app/create-react-app/tasks/e2e-kitchensink.sh:70","Warn: npmCommand not pinned by hash: tests/cases/user/create-react-app/create-react-app/tasks/e2e-monorepos.sh:68","Warn: npmCommand not pinned by hash: tests/cases/user/create-react-app/create-react-app/tasks/e2e-old-node.sh:52","Warn: npmCommand not pinned by hash: tests/cases/user/create-react-app/create-react-app/tasks/e2e-simple.sh:81","Info:   0 out of   4 containerImage dependencies pinned","Info:   0 out of   5 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}}]},"last_synced_at":"2025-08-18T08:10:25.423Z","repository_id":57383903,"created_at":"2025-08-18T08:10:25.423Z","updated_at":"2025-08-18T08:10:25.423Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["reordering","typescript"],"created_at":"2024-10-14T15:42:59.789Z","updated_at":"2026-03-11T13:14:44.938Z","avatar_url":"https://github.com/domchen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/typescript-plus.svg)](https://www.npmjs.com/package/typescript-plus)\n\n[中文版](http://www.idom.me/articles/849.html)\n\n# typescript-plus\n\n\n\nTypeScript is a language for application-scale JavaScript, For more information, please visit : [TypeScript](https://github.com/Microsoft/TypeScript).\n\nThe typescript-plus compiler provides extra features to the original typescript compiler, such as accessors optimization, class reflection, conditional compilation and the most useful one: automatically reordering the source files by analyzing their dependencies in code. This compiler is integrated into the [Egret Engine](https://github.com/egret-labs/egret-core) and has been heavily used by it.\n\nThis project will try to stay up to date with the new release of the original TypeScript project.\n\nCurrent TypeScript Version: 3.1.3\n\n\n## Installing\n\nFirst, make sure you have installed the latest version of [node.js](http://nodejs.org/)\n(You may need to restart your computer after this step).\n\nFor use as a command line app:\n\n```\nnpm install -g typescript-plus\n```\n\nFor programmatic use:\n\n```\nnpm install typescript-plus\n```\n\n## Usage\n\n```\ntsc-plus [input files] [options]\n```\n\nTo learn how to use the original typescript compiler, please visit the following links:\n\n*  [Quick tutorial](http://www.typescriptlang.org/Tutorial)\n*  [Programming handbook](http://www.typescriptlang.org/Handbook)\n*  [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)\n*  [Homepage](http://www.typescriptlang.org/)\n\n## Extra Options\n\n| Option               | Type    | Default| Description                                        |\n|:-------------------- |:-------:|:------:| :------------------------------------------------- |\n| accessorOptimization | boolean | false  | If an accessor contains only one call to another method, use that method to define the accessor directly.|\n| emitReflection       | boolean | false  | Emit the reflection data of the class.                 |\n| reorderFiles         | boolean | false  | Automatically reordering the source files by dependencies.|\n| defines              | Object  |        | Replace the global variables with the constants defined in the \"defines\" object. |\n\n\n\nExample tsconfig.json file:\n\n```\n{\n    \"compilerOptions\": {\n        \"module\": \"commonjs\",\n        \"noImplicitAny\": true,\n        \"removeComments\": true,\n        \"preserveConstEnums\": true,\n        \"sourceMap\": true,\n        \"accessorOptimization\": true,\n        \"emitReflection\": true,\n        \"reorderFiles\": true\n        \"defines\": {\n            \"DEBUG\": false,\n            \"RELEASE\": true\n        }\n\n    },  \n    \"files\": [\n        \"core.ts\",\n        \"sys.ts\"\n    ]  \n}\n\n```\n\n## Accessor Optimization\n\nPass `--accessorOptimization` to the command-line tool or add `\"accessorOptimization\": true` to the `compilerOptions` in tsconfig.json file to enable this feature.\n\nAs we know, we can't override the get / set accessors of super class in TypeScript. To solve the problem, we usually forward the call to the set accessor to another method:\n\nTypeScript:\n\n```\nclass Student {\n\n    public _name:string;\n\n    protected setName(value:string):void {\n        this._name = value;\n    }\n\n    public get name():string {\n        return this._name;\n    }\n\n    public set name(value:string) {\n        this.setName(value);\n    }\n}\n```\nIt does solve the problem, but also brings a performance issue, that two functions have to be called each time we call a set accessor. With the `--accessorOptimization` switch on, if the accessor contains only one call to another method, the compiler uses that method to define accessor directly.\n\nJavascript:\n\n```\nvar Student = (function () {\n    function Student() {\n    }\n    Student.prototype.setName = function (value) {\n        this._name = value;\n    };\n    Object.defineProperty(Student.prototype, \"name\", {\n        get: function () {\n            return this._name;\n        },\n        set: Student.prototype.setName,\n        enumerable: true,\n        configurable: true\n    });\n    return Student;\n}());\n```\n\nIf you define the `setName()` method after the set accessor, the final result looks like this:\n\n```\nvar Student = (function () {\n    function Student() {\n    }\n    Object.defineProperty(Student.prototype, \"name\", {\n        get: function () {\n            return this._name;\n        },\n        set: setName,\n        enumerable: true,\n        configurable: true\n    });\n    Student.prototype.setName = setName;\n    function setName(value) {\n        this._name = value;\n    };\n    return Student;\n}());\n```\nEither way, it works.\n\n## Class Reflection\n\nPass `--emitReflection` to the command-line tool or add `\"emitReflection\": true` to the `compilerOptions` in tsconfig.json file to enable this feature.\n\nTypeScript:\n\n```\nnamespace ts {\n    export interface IPerson {\n        name:string;\n    }\n    \n    export class Student implements IPerson {\n        public name:string = \"\";\n    }\n}\n```\nJavaScript:\n\n```\nvar ts;\n(function (ts) {\n    var Student = (function () {\n        function Student() {\n            this.name = \"\";\n        }\n        return Student;\n    }());\n    ts.Student = Student;\n    __reflect(Student.prototype, \"ts.Student\", [\"ts.IPerson\"]);\n})(ts || (ts = {}));\n\n```\nThe `__reflect` helper function is just like the `__extends` function, it is emitted only once in one file.\n\nThen you can use the helper funtions in [reflection.ts](tools/reflection.ts) to get the qualified class name of an instance:\n\n```\nlet student = new ts.Student();\nts.getQualifiedClassName(student);  // \"ts.Student\"\n```\nor do some type checking:\n\n```\nts.is(student, \"ts.Student\"); // true\nts.is(student, \"ts.IPersion\"); // true\n```\n\n## SourceFiles Reordering\n\nPass `--reorderFiles` to the command-line tool or add `\"reorderFiles\": true` to the `compilerOptions` in tsconfig.json file to enable this feature.\n\nNormally when you pass the `--outFile` option, the compiler will concatenate and emit output to a single file. But the order of concatenation is determined by the list of files passed to the compiler on the command line (or in the tsconfig.json file) along with triple-slash references and imports. That forces you to sort the input files in the correct order manually. It is ok with only a few source files, but it becomes a disaster when you have countless source files.\n\nWith the `reorderFiles` switch on, the compiler will automatically reorder the source files by analyzing their dependencies in code. Then you can get the correct concatenation order in the generated file without doing any extra effort. I have tested this feature in many real-world projects, it works very well. If it does not work in your project, please feel free to open an issue and send me the test case.\n\n## Conditional Compilation\n\nThe `defines` option is only allowed in tsconfig.json, and not through command-line switches.\n\nYou can use the `defines` option to declare global variables that the compiler will assume to be constants (unless defined in scope). Then all the defined global variables will be replaced with the corresponding constants. For example:\n\ntsconfig.json:\n\n```\n{\n    \"compilerOptions\": {\n        \"defines\": {\n            \"DEBUG\": false,\n            \"LANGUAGE\": \"en_US\"\n        }\n    }\n}\n\n```\nTypeScript:\n\n```\ndeclare var DEBUG:boolean;\ndeclare var LANGUAGE:string;\n\nif (DEBUG) {\n    console.log(\"DEBUG is true\");\n}\n\nconsole.log(\"The language is : \" + LANGUAGE);\n\nfunction someFunction():void {\n    let DEBUG = true;\n    if (DEBUG) {\n        console.log(\"DEBUG is true\");\n    }\n}\n\n```\nJavaScript:\n\n```\nif (false) {\n    console.log(\"DEBUG is true\");\n}\n\nconsole.log(\"The language is : \" + \"en_US\");\n\nfunction someFunction() {\n    var DEBUG = true;\n    if (DEBUG) {\n        console.log(\"DEBUG is true\");\n    }\n}\n```\nAs you can see, the second `if(DEBUG)` in `someFunction` is not replaced because it is defined in scope.\n\nNote that the compiler does not drop the unreachable code because it is can be easily done by other tools like [UglifyJS](http://lisperator.net/uglifyjs/) or [Google Closure Compiler](https://developers.google.com/closure/compiler/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomchen%2Ftypescript-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomchen%2Ftypescript-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomchen%2Ftypescript-plus/lists"}