Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For typescript to be very useful to indispensable the tooling needs to improve.

If there was a checkbox on VSC that said “use typescript” for a project and I had to do nothing else for it to work then sure, I’d use it.

For a single dev working on a fairly simple React + Redux app it’ll slow you down like no tomorrow.



What you're asking for mostly exists. You don't even need a checkbox.

TypeScript support has been included with create-react-app since v2.1.0, with all the features enabled. VS Code ships with syntax highlighting and command completion for TS.

If you want to try it use;

    npx create-react-app tsx-test
    yarn add typescript @types/react
    mv ./src/App.js ./src/App.tsx
    yarn start
(WARNING: npx runs stuff from the internet on your machine)

That will make a 'typescript' React app run on your machine. Obviously App.tsx isn't actually doing any TypeScript stuff, but if you add some it will work.


Even simpler, see https://create-react-app.dev/docs/adding-typescript

    npx create-react-app my-app --typescript


Note that they said "React + Redux". And that combo indeed takes a lot more time to get set up and understand the first time.

I used this lib to get it to work: https://www.npmjs.com/package/typesafe-actions I wouldn't even know how to get it to work with just the regular react & redux types.


typesafe-actions looks useful but you don't strictly need it. You can use redux with TS just by adding @types/react-redux. https://redux.js.org/recipes/usage-with-typescript#usage-wit...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: