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.