Closed petrbela closed 5 years ago
Same.. im trying to resolve this now. Any luck @petrbela ?
I didn't have much time to dive into this so, for now, I'm running the TypeScript compiler separately "start": "tsc --watch | expo start",
and have App.js
point to the TypeScript build folder:
import App from './.build/App'
export default App
It messes up with source maps and it's not the ideal long-term solution but should be pretty easy to set up.
Got mine working.. heres the repo.
https://github.com/Ambitian/expo-rnw-ts-starter
Seems like it supports TS out the box just need to modify the babel config. Hope this helps
@vstlouis The repo you linked is not visible/existing?
Sorry.. try again
Ha, looks like it has been fixed in expo-cli 2.15 :)
When I was trying with expo-cli 2.14, I was getting this error:
ERROR in /frontend/expo-rnw-ts-starter/node_modules/expo/AppEntry.js
Module not found: Error: [CaseSensitivePathsPlugin] `/frontend/expo-rnw-ts-starter/App.json` does not match the corresponding path on disk `app.json`.
@ /frontend/expo-rnw-ts-starter/node_modules/expo/AppEntry.js 2:0-28 8:22-25
@ multi /Users/petrbela/.nvm/versions/node/v8.15.0/lib/node_modules/expo-cli/node_modules/react-dev-utils/webpackHotDevClient.js /frontend/expo-rnw-ts-starter/node_modules/expo/AppEntry.js
Btw you no longer need to run tsc
separately. Just expo start
, the @babel/typescript
takes care of TS compilation.
Sweet, thanks!
Actually, it seems @babel/typescript
isn't necessary either.
Which means that TypeScript is now supported out of the box. Just make sure you're running the latest expo-cli
, or the latest @expo/webpack-config
if you're extending webpack config.
Mind throwing up a sample? Im running into a ton off errors without it?
Just take the example at https://github.com/expo/web-examples/tree/master/expo-managed-workflow and rename App.js
to App.tsx
.
Is there any special setup for TypeScript? When I use a
.ts
file, webpack fails withModule not found: Error: Can't resolve ...
.