我正在尝试将 TypeScript 与 React Native 结合使用。
\n\n这是我的tsconfig.json:
{\n "compilerOptions": {\n "target": "es2015",\n "module": "es2015",\n "jsx": "react",\n "outDir": "build",\n "rootDir": "src",\n "allowSyntheticDefaultImports": true,\n "noImplicitAny": true,\n "experimentalDecorators": true,\n "preserveConstEnums": true,\n "allowJs": true,\n "sourceMap": true\n },\n "filesGlob": [\n "typings/index.d.ts",\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n "exclude": [\n "index.android.js",\n "index.ios.js",\n "build",\n "node_modules"\n ],\n "compileOnSave": false\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我希望将 src 目录中的所有 .ts(x) 文件编译到构建目录。
\n\n预期的:
\n\nMyAwesomeReactNativeApp/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src/\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.tsx\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 build/\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.js\nRun Code Online (Sandbox Code Playgroud)\n\n得到:
\n\nMyAwesomeReactNativeApp/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src/\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.tsx\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 build/\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src/\n \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 …Run Code Online (Sandbox Code Playgroud)