4.0.0 • Published 2 months ago
ts-ast-to-literal v4.0.0
ts-ast-to-literal
Transform a TypeScript AST node into a real JS object.
Special thanks to ast-to-literal for the initial idea 👏.
Install
# npm
$ npm install ts-ast-to-literal
# Yarn
$ yarn add ts-ast-to-literal
Usage
const ts = require('typescript')
const ast = ts.createSourceFile(
'x.ts',
`export default { foo: 'bar', num: 8 }`,
ts.ScriptTarget.Latest
)
console.log(self(ast.statements[0].expression))
// { foo: 'bar', num: 8 }
Contribute
Are you missing something or want to contribute? Feel free to file an issue or a pull request! ⚙️
Support
Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here:
Thanks a lot for your support! ❤️
License
4.0.0
2 months ago
3.0.12
1 year ago
3.0.4
1 year ago
3.0.13
12 months ago
3.0.3
1 year ago
3.0.10
1 year ago
3.0.2
1 year ago
3.0.11
1 year ago
3.0.1
1 year ago
3.0.8
1 year ago
3.0.7
1 year ago
3.0.6
1 year ago
3.0.5
1 year ago
3.0.9
1 year ago
3.0.0
1 year ago
2.0.0
2 years ago
1.0.6
2 years ago
1.0.2
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.1
3 years ago
1.0.0
3 years ago