abstract syntax tree - Adding an import statement to Typescript source using the Compiler API -


i'm looking way insert import statement using typescript compiler api. here's i'd do

before:

class simple extends component<{}, {}> {   render() {     return (       <div>         <style jsx>{`           div {             background: green;           }         `}</style>       </div>     )   } } 

after:

import { component } 'react' // inserted  class simple extends component<{}, {}> {   render() {     return (       <div>         <style jsx>{`           div {             background: green;           }         `}</style>       </div>     )   } } 

i'm using: typescript 2.4.1.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -