Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Converting string of typescript to code but keep getting _os.platform is undefined

$
0
0

I am trying to compile string to code using typescript in react-native but keep getting the below error in typescript

TypeError: _os.platform is not a function. (In '_os.platform()', '_os.platform' is undefined)

Here is the test code I made

import * as ts from "typescript";const sourceFile = ts.createSourceFile("file.ts", // filePath"function myFunction() {}", // fileText  ts.ScriptTarget.Latest, // scriptTarget  true // setParentNodes -- sets the `parent` property);

Any Idea how to fix this? or any alternative to using typescript compile.

I have tested reinstalling the typescript with no luck.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>