简体   繁体   中英

Is it possible to use React together with typescript without transpiling

Is it possible to use React together wit TypeScript in a simple way?

I want to write my components in TypeScript to have type-safety. The few tutorials I've found so far do always need to have babel-loader, ts-loader and webpack running to make it work. In my tsconfig I can set "jsx" to either ("preserve","react" or "react-native") but I don't see how to go on from there or which one I should use.

At the end I would like to have a jsx-file which I can reference from my cshtml <script src="@Url.Content("~/Scripts/TypeScript/MyComponent.jsx")" .

If you want to use the full features of ES6, then the answer is NO. It'll be high time since most of the users upgrade their system so that all ES6/Typescript code runs properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM