Typescript compiler extensions
npm install ewk-tsTypeScript compiler extensions
- Getting the fields of an interface
- Getting the name of the interface
yarn add ewk-ts to install the package
extensionTransformerBuilder to the before category of your custom transformersBy calling __fieldsOf we get a string[] with the names of all fields.
``typescript`
interface User {
id: number;
email: string;
}
__fieldsOf
transforms into
`typescript`
["id", "email"]
and than it gets transformed by the TypeScript compiler to JavaScript.
By calling __nameOf you get the name of the interface
`typescript
interface SuperUser {
id: number;
email: string;
}
__nameOf
`
will be transformed into
`type``
"SuperUser"
Ruslan Cisa
MIT