{"id":26550,"library":"typescript-plus","title":"typescript-plus","description":"An enhanced TypeScript compiler (v3.1.5) built on top of tsc 3.1.3, adding features like accessor optimization, class reflection metadata emission, conditional compilation via defines, and automatic file reordering based on dependency analysis. Primarily maintained as part of the Egret Engine ecosystem. Releases track upstream TypeScript versions but lag behind, with current stable based on 3.1.3. Use this if you need its extra features, but be aware of possible incompatibility with standard TypeScript tooling and potential build issues due to non-standard compiler behavior. Not recommended for general-purpose projects unless you depend on Egret or its specific enhancements.","status":"active","version":"3.1.5","language":"javascript","source_language":"en","source_url":"https://github.com/domchen/typescript-plus","tags":["javascript","TypeScript","Microsoft","compiler","language","typescript"],"install":[{"cmd":"npm install typescript-plus","lang":"bash","label":"npm"},{"cmd":"yarn add typescript-plus","lang":"bash","label":"yarn"},{"cmd":"pnpm add typescript-plus","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Use npx to run the CLI without global install; the binary is 'tsc-plus', not 'tcs' or 'typescript-plus'.","wrong":"tsc-plus --reorderFiles","symbol":"tsc-plus","correct":"npx tsc-plus --reorderFiles"},{"note":"Package ships TypeScript types; use ESM import for type safety. CJS require works but lacks type inference.","wrong":"const ts = require('typescript-plus')","symbol":"compiler API","correct":"import * as ts from 'typescript-plus'"},{"note":"Symbols are re-exported from the TypeScript API; ensure you import from 'typescript-plus', not 'typescript'.","wrong":"import { createProgram } from 'typescript'","symbol":"createProgram","correct":"import { createProgram } from 'typescript-plus'"}],"quickstart":{"code":"// Create a simple tsconfig.json with extra features\n{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"module\": \"commonjs\",\n    \"emitReflection\": true,\n    \"reorderFiles\": true,\n    \"defines\": {\n      \"DEBUG\": false\n    }\n  },\n  \"files\": [\"index.ts\"]\n}\n\n// Then compile:\n// npx tsc-plus --reorderFiles\n\n// Programmatic usage:\nimport * as ts from 'typescript-plus';\nconst program = ts.createProgram(['index.ts'], {\n  target: ts.ScriptTarget.ES5,\n  module: ts.ModuleKind.CommonJS,\n  emitReflection: true,\n  reorderFiles: true,\n  defines: { DEBUG: false }\n});\nconst emitResult = program.emit();","lang":"typescript","description":"Shows tsconfig.json with extra options and both CLI and programmatic compilation using typescript-plus."},"warnings":[{"fix":"Use official TypeScript for modern code; typescript-plus is intended for Egret Engine compatibility.","message":"This package lags behind upstream TypeScript versions by several releases; using it with modern TypeScript features may cause errors.","severity":"breaking","affected_versions":">=3.1.5"},{"fix":"Set 'reorderFiles' to false if your code depends on file order, or ensure no side effects in modules.","message":"The 'reorderFiles' option can change module load order unexpectedly, potentially breaking code that relies on side effects of module declaration order.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use 'var DEBUG = true;' in source code and define in tsconfig as 'defines: { DEBUG: false }'.","message":"The 'defines' option replaces global variables at compile time but does not work with const or let; only var or global declarations can be replaced.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consider migrating to official TypeScript and isolate Egret-specific features if needed.","message":"This package is not actively maintained for new TypeScript versions; last update tracked tsc 3.1.3.","severity":"deprecated","affected_versions":">=3.1.5"},{"fix":"Audit your lockfile and consider npm audit fix; if not used in production, this may be low priority.","message":"Security vulnerability: this package has transitive dependencies on outdated versions of 'chalk' and 'supports-color' with known CVE-2023-26102 (prototype pollution).","severity":"critical","affected_versions":">=2.0.0"},{"fix":"Only use 'emitReflection' if your runtime (e.g., Egret) explicitly supports the output format.","message":"The 'emitReflection' option produces non-standard metadata that may not be consumed by standard reflect-metadata polyfill; it outputs a custom format.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npx tsc-plus' instead of 'npx tsc'.","cause":"Using the option with official tsc instead of typescript-plus binary.","error":"error TS5023: Unknown compiler option 'accessorOptimization'."},{"fix":"Run 'npm install typescript-plus' and use 'import * as ts from \"typescript-plus\"' (ESM) or 'const ts = require(\"typescript-plus\")' (CJS).","cause":"Package not installed, or wrong import path in Node.js (CJS vs ESM).","error":"Cannot find module 'typescript-plus'"},{"fix":"Change import to 'import { createProgram } from \"typescript-plus\"'.","cause":"Importing from 'typescript' instead of 'typescript-plus'.","error":"TypeError: ts.createProgram is not a function"},{"fix":"Ensure the variable is declared as 'var DEBUG = true;' at global scope, not 'const' or 'let'.","cause":"defines option expects a string key matching a variable declared with 'var' or a global.","error":"error TS6046: Name 'DEBUG' not found in 'defines'."},{"fix":"Install typescript as a peer dependency: 'npm install typescript@3.1.3'.","cause":"typescript-plus has an optional dependency on 'typescript' that may be missing.","error":"Error: Cannot find module 'typescript' from 'typescript-plus'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}