I want to start adding types to my javascript but I don't want to restructure everything for the typescript way
Follow

@Moon ts is the way, but very often the default config is too strict to switch into from an existing js project. Change the settings to, for example, allow for implicit any, and re-enable them when you refactor the code.

@Amikke I have a lot of my code in es modules, is that enough of a barrier between code to convert a module at a time, for instance?

@Moon you can set up barriers like “until now this has been any, from this point onwards I am declaring that I know it to be X” and vice versa at pretty much any point of the code, but modules are an especially good start, as with TS you often also declare and import types, which fit naturally into the other imports of the module.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.