@mkmod-ts/ts-get-exported-type
v1.0.0
Published
Uses `typescript` to get `export`ed types from a `.ts` file:
Downloads
1
Readme
@mkmod-ts/ts-get-exported-type
Uses typescript
to get export
ed types from a .ts
file:
const getExportedType = require("@mkmod-ts/ts-get-exported-type")
const code = `
export declare type Person = {
name: string;
age?: number;
}
`
console.log(
getExportedType(code, "Person")
)
Result is in the following format:
[{
name: "name of member",
type: "type of member",
optional: true|false,
text: "<name>:<type>;"
}, ...]
or null
if type was not found.