Hi, I’m curious what’s the attitude towards TypeScript from Ember Core team. I haven’t found any official statement.
I see that some parts of the Ember are written in TypeScript. I also see some traction towards TypeScript in Ember community.
Is the Ember Core team considering to write Ember in TypeScript and make it first class citizen? Typings at DefinitelyTyped are obsolete with every new version and keeping them up-to-date requires a lot of manual work.
What I have read is that they are moving to Typescript internally, but that they want to ensure that the API for JS and TS are the same (or as close as is possible). Unlike something like Angular, where the API is significantly different trying to write your app in JS instead of TS. I do think that having TS be a first-class citizen is a goal and that will help the typing definitions. But I wouldn’t be surprised if support for using TS continues to be via the ember-cli-typescript addon rather than integrated directly.
We like TypeScript a lot and are happy to be using it to implement an increasing amount of Ember’s internals.
For app authors who choose TypeScript, we want to keep improving the experience. This falls out naturally from both the increasing amount of TS in Ember’s implementation (which should reduce the need for separately-maintained typings) and our increasing embrace of modern JS features (like native classes), which are easier for TS to analyze.
I’m curious to learn more about this – most of our releases don’t break any public API, so I would have guessed that typings don’t need to change much. Is it because there’s some mechanical work required like bumping version numbers to match?
FWIW, I think most of the keeping-things-up-to-date feeling right now is that the community-driven effort to manage the typings has a relatively small number of people on it, and Ember’s API surface is huge, so it’s less to do with Ember itself changing as that—
we’re still finding gaps and errors in the existing type coverage
sometimes the documentation (which we largely used to figure out what the types of things should be) is simply wrong
That means that there has been an unfortunate but unavoidable (unless or until all of Ember is written in TS and ships its typings with it) amount of “churniness” as we’re improving things rapidly.
As @ef4 mentioned using Ember in JS will still be a primary experience and Typescript will not be required.
If/when core Ember packages are fully written in Typescript, the type definitions should be able to be shipped with the packages instead of as a separate install which will help with the issue of keeping typing up to date.
TLDR; the JS experience will stay the same and get better, the TS experience will only get better, the core will be more stable.
As @chriskrycho pointed out, type definition leaks result from lack of documentation that turns out to be wrong. Most of the time, you realize typings are wrong when your own code reaches that point. At this point, open an issue at typed-ember/ember-cli-typescript to note what’s wrong in the first place. Second, go dig into the ember source to find out what is the correct typing and third send a PR to DefinitelyTyped.
How does it work then for the old apps? If we keep updating typings on DefinitelyTyped with latest API, doesn’t it mean that old Ember apps will get wrong types as some of the API might be available only in the latest version?