Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Adoption Plan: get it started 🎉 #5

Closed
wants to merge 79 commits into from

Conversation

chriskrycho
Copy link
Owner

@chriskrycho chriskrycho commented Jan 18, 2022

Rendered draft – now open for comments and input from the TypeScript strike team for polishing before opening against Ember!

Looking for feedback especially on:

  • the decision to have Ember Data type registries handled in a separate RFC
  • the unresolved questions
  • whether there are drawbacks I missed

@muziejus
Copy link

Like I said in Discord, my imagination regarding the documentation is:

  • In the Orientation page there's a mention for something like "use -ts if you want to use TypeScript instead of JavaScript." Similar hints would be scattered in the documentation, like in the configuration section, etc.
  • Throughout, code snippets have TS versions and JS versions that are togglable. Similarly, one can set JS or TS for the site as a whole
  • There's a special section on TypeScript under "Application Development," which would describe the types ember uses, how to test for types, how to migrate, etc., though I imagine this section would be shortish?

These three switches, it seems, would make TS seem pretty first-class in the documentation. It's always there, but it's not in your face. I think the a11y model might be good to follow. Make it accessible by default (though TS isn't default), and reward people who want to do a deeper dive. In this case, make TS an option in the detailed tutorial and then just move on.

Ideally the code snippets would all be written in TS and then the JS version would be compiled from it, like with the proposed blueprints. This means not having to maintain two versions of each code snippet.

@chriskrycho
Copy link
Owner Author

@muziejus I believe all of that is covered in the RFC. :)

@muziejus
Copy link

Super. Can't wait to contribute to the documentation.

Copy link

@dfreeman dfreeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so so much for all your hard work on this!

text/0000-ts-adoption-plan.md Outdated Show resolved Hide resolved
text/0000-ts-adoption-plan.md Show resolved Hide resolved
text/0000-ts-adoption-plan.md Outdated Show resolved Hide resolved
text/0000-ts-adoption-plan.md Outdated Show resolved Hide resolved
text/0000-ts-adoption-plan.md Show resolved Hide resolved

This does introduce two new small considerations:

- New APIs will now need to specify import paths for type-only imports. For example, today there is no public import for `Transition` or `RouteInfo`, because they are not intended for end users to construct. However, types for them *should* be publicly exported because end users need to be able to name those types them in their own code. If we were to write [RFC #0095: Router Service](https://emberjs.github.io/rfcs/0095-router-service.html) today, we would specify imports for both.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

text/0000-ts-adoption-plan.md Outdated Show resolved Hide resolved
text/0000-ts-adoption-plan.md Outdated Show resolved Hide resolved
Co-authored-by: Dan Freeman <dfreeman@salsify.com>
- Courtesy of @wagenet's work (and in line with the recommended
  migration path for Ember Classic types *in this RFC*!) the bit about
  `Controller` ambient types became defunct, and we should in fact be
  able to rely on Ember’s own types as the full source of truth.
- Fix an incomplete sentence/paragraph caught by @dfreeman (on the
  SemVer option of *not* using `strict: true` but using specific
  flags).
@chriskrycho
Copy link
Owner Author

Opened as emberjs#800!

@chriskrycho chriskrycho deleted the ts-adoption branch February 24, 2022 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants