Sorry for very late response,
elements-x$ (master) node
Welcome to Node.js v12.16.3.
Type ".help" for more information.
> const src = `export const foo = {
... 'bar' : 'Hello world'
... };`
undefined
> const ts = require('typescript')
undefined
> const node = ts.createSourceFile('x.ts', src, ts.ScriptTarget.Latest);
undefined
> node
SourceFileObject {
pos: 0,
end: 45,
flags: 0,