A typescript transpiler wrapper with reflection capabilities
This project is not stable and there are no plans to support the same features as the typescript cli. Maybe when the typescript team has decided on if, how and when they will support easy transformers pluggability I will tear the transformer out of this project and provide it standalone.
- node js
- Run
npm run test
to restore, build and test all files. - Open the path "MetaDataTransformer/MetaDataTransformerUsage" in a command line terminal
- Run
npm run pack
to build a js bundle for the test.html file - Open "MetaDataTransformer/MetaDataTransformerUsage/test.html" in a browser and take a look at the console output
usage: tsca [-h] [-v] <command> ...
Typescript transpiler with reflection capabilities.
Positional arguments:
<command>
build Transpiles the given typescript files
Optional arguments:
-h, --help Show this help message and exit.
-v, --verbose Show extra logging detail
usage: tsca build [-h] [--env ENV] [--emit-decorator-metadata]
[--experimental-decorators] [--inline-source-map]
[--include INCLUDE] [--out-dir OUTDIR] [--out-file OUTFILE]
[--root-dir ROOTDIR]
[--module {None,CommonJS,AMD,UMD,System,ES2015,ESNext}]
[--module-resolution {Classic,NodeJs}]
[--target {ES3,ES5,ES2015,ES2016,ES2017,ES2018,ESNext,JSON,Latest}]
[--source-map] [--source-root SOURCEROOT]
[--map-root MAPROOT] [--types TYPES]
[--type-roots TYPEROOTS]
export interface ITypeDeclaration {
properties: {
[id: string]: IPropertyDeclaration;
};
}
export interface IPropertyDeclaration {
isOptional: boolean;
isStatic: boolean;
accessModifier: AccessModifier;
}
export declare enum AccessModifier {
Public = 0,
Protected = 1,
Private = 2
}
export interface IType<T> extends Function {
new (...args: (object | string | number | boolean)[]): T;
}
export declare const reflection: {
canCast: <T>(obj: object, type: IType<T>) => boolean;
getType: <T>(type: IType<T>) => ITypeDeclaration;
isType: <T>(type: IType<T>) => boolean;
};
import { reflection } from 'metadatatransformer';
class Test {
...
}
if(reflection.isType(Test)) {
reflection.getType(Test);
reflection.canCast({ }, Test);
}