A guide for converting a simple JavaScript/React project to TypeScript. Contains both before an after code with the step-by-step process in the README below.
Error when running npx build after configuring ts, editing build pipeline:
ERROR in ./src/app.jsx
Module build failed: Error: It looks like you're using an old webpack version without hooks support. If you're using awesome-script-loader with React storybooks consider upgrading @storybook/react to at least version 4.0.0-alpha.3
at Object.ensureInstance (/home/code123/Documents/js/TypeScript-React-Conversion-Guide/TicTacToe_JS/node_modules/awesome-typescript-loader/src/instance.ts:142:9)
at compiler (/home/code123/Documents/js/TypeScript-React-Conversion-Guide/TicTacToe_JS/node_modules/awesome-typescript-loader/src/index.ts:45:19)
at Object.loader (/home/code123/Documents/js/TypeScript-React-Conversion-Guide/TicTacToe_JS/node_modules/awesome-typescript-loader/src/index.ts:14:12)
Is there any way to get typescript to show the correct line numbers in React 16? It seems like right now it is showing the error numbers from the JS and not the TSX?
Specifically ts-jest is the project having this issue.
Line 103 of README.md needs to be corrected to have dist removed, i.e. change from: filename: './dist/bundle.js'
to be: filename: './bundle.js'
This will now accurately match the intention, i.e. of having a copy-and-paste into README of TicTacToe_TS/webpack.config.js for sensible build design.
Would be cool if you opened up access permissions on this repo to allow anyone to push a branch with a proposed fix, as then I'd have done so myself ๐ .