phetsims / bending-light

"Bending Light" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/bending-light
GNU General Public License v3.0
8 stars 8 forks source link

Port to TypeScript #401

Closed samreid closed 2 years ago

samreid commented 2 years ago

To help move TypeScript forward and to get the benefits of TypeScript in this repo, we should port it to TypeScript.

samreid commented 2 years ago

Summarizing work so far. It took nearly 3 hours to port all of bending light (8900 lines) to TypeScript. WebStorm tooling provided good support with tooling like "infer types from JSDoc" and "promote to property". The port is not complete due to the following:

I discovered numerous problems in this port so far, like:

samreid commented 2 years ago

In the commits, I added type declaration for strings, better enum support and addressed several TODOs. Total time so far: about 9.5 hours. What's left:

Many of the existing problems are due to inadequacies in common code. I can add better types for options, and look through the any and ts-ignore again, but many things may need to wait until we have common code support.

samreid commented 2 years ago

This port is is good shape and I don't plan other work at the moment. Closing.