A TypeScript transformer and runtime reflection library that emits comprehensive runtime type information (RTTI) for classes, interfaces, functions, and call sites. Current stable version is 0.9.6 (release candidate quality). Requires TypeScript 4.8–5.1 and reflect-metadata. Differentiators: supports emission for a wide range of TypeScript concepts including mapped types (partial), ES modules and CommonJS, isomorphic across browser and Node.js, and compatible with existing design:* metadata. Alternates (e.g., tst-reflect) may lack breadth of type support or require heavier compiler customizations.
npm install typescript-rttiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to reflect on a class: get property type, method return type, and check union types.
Pin to ^0.9.6 and watch changelog for breaking changes.
Ensure TypeScript version matches one of the peer dependencies.
Avoid using mapped types with reflect() or verify behavior per issue tracker.
Use import syntax. If using CommonJS, use dynamic import or ensure bundler configuration.
Add import 'reflect-metadata' at the top of your entry file.
Add the typescript-rtti transformer to your tsconfig.json compilerOptions.plugins.
Pass the class itself: reflect(A) not reflect(new A()).