1.0.0 • Published 3 years ago
@mkmod-ts/ts-get-exported-type v1.0.0
@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.
1.0.0
3 years ago