Extract a variable from TypeScript
05:53 10 Mar 2026

I want to parse a TypeScript script to extract a variable and convert it to a Python dictionary. I have already manually done it.

I tried this but it obviously would not work because I need first to get that variable:

r = requests.get('https://github.com/ag-grid/ag-grid/blob/latest/community-modules/locale/src/pt-BR.ts')
j = json.loads(r.text)
r.close()
print (j)

Any ideas?

python typescript parsing