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 -

javascript - How to bind ViewModel Store to View? -

javascript - Solution fails to pass one test with large inputs? -