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

Dare I say - but you can use Typescript with other frameworks too.. just because it's built in here / there are more resources?


I’ve been using a fork of facebook’s create-react-app with typescript to generate new projects lately. It’s been great, zero friction. https://github.com/wmonk/create-react-app-typescript


I found especially that working with a project that requires a lot of extra bits to be installed (like the react ecosystem) makes working with JavaScript libraries from typescript especially painful, since you need to get typescript definitions for all of them, and they may not always mesh well together.


You can easily install types from @types these days: https://www.npmjs.com/~types

I believe the latest version of Visual Studio Code can automatically install the type dependencies from the IDE (e.g. a quick fix if the type definitions are missing).


As I commented above, you might want to take a look at https://github.com/wmonk/create-react-app-typescript.

It’s really helped reduce some of that 3rd party lib / buildchain JS fatigue for me.


In recent Typescript it defaults not found modules to type `any` and only complains if `--noImplicitAny` is used.

Even with `--noImplicitAny`, it's gotten pretty easy. Leave a scratch .d.ts file somewhere in your project and when you install a new library you can start with:

    declare module 'libraryname'
    declare module 'libraryname/**/*'
That gives you an explicit `any` for those libraries. Then you can go back and add types later.

The number of npm packages with types directly included is growing at an impressive rate (even Facebook often bundles them for React libraries), so there's not even the need to seek out types in so many cases these days.


There is support now (which is awesome!), but not when we were deciding on a framework back when Angular 2 was in beta.




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

Search: