diff --git a/README.md b/README.md index 07be24135..49da79d84 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,150 @@ +# MAINTENANCE MODE + +ember-cli-typescript will no longer be updated unless necessary - ec-ts is no longer needed and all available features are configurable in userland. + +See the official TypeScript docs on the ember guides website here: https://guides.emberjs.com/release/typescript/ +This section of the docs has details for getting started with TypeScript, beyond what is laid out here. + +With every release, we output the `--typescript` output of new ember apps to this StackBlitz: https://stackblitz.com/github/ember-cli/editor-output/tree/stackblitz-app-output-typescript + +## How to use TypeScript without `ember-cli-typescript`? + +Apps and v1 addons need to configure Babel to compile TypeScript files via the `ember-cli-babel` config, as described in the [ember-cli-babel](https://github.com/emberjs/ember-cli-babel#enabling-typescript-transpilation). + +Additionally, you will need the `tsconfig.json` generated by the Ember TypeScript blueprint (see below for details), and then can run [`glint`](https://typed-ember.gitbook.io/glint) or `tsc` directly on the CLI. (Again, see the official docs for details!) + +### Apps + +```js +'ember-cli-babel': { + enableTypeScriptTransform: true, +}, +``` + +### v1 addons + +Configure this in the addon's `index.js` in the root of the project: + +```js +module.exports = { + name: require('package').name, + options: { + 'ember-cli-babel': { + enableTypeScriptTransform: true + } + } +} +``` + +### v2 addons + +The [V2 Addon Blueprint](https://github.com/embroider-build/addon-blueprint) does not use nor need ember-cli-typescript, nor any of its features. + +## What tsconfig.json should be used? + +The official blueprints for apps and v1 addons (as of 2023-12-06) specifies: + +
for apps + +```jsonc +{ + "extends": "@tsconfig/ember/tsconfig.json", + "compilerOptions": { + // The combination of `baseUrl` with `paths` allows Ember's classic package + // layout, which is not resolvable with the Node resolution algorithm, to + // work with TypeScript. + "baseUrl": ".", + "paths": { + "<%= name %>/tests/*": ["tests/*"], + "<%= name %>/*": ["app/*"], + "*": ["types/*"] + } + } +} +``` + + + +
+ +
For v1 addons + +```jsonc +{ + "extends": "@tsconfig/ember/tsconfig.json", + "compilerOptions": { + // The combination of `baseUrl` with `paths` allows Ember's classic package + // layout, which is not resolvable with the Node resolution algorithm, to + // work with TypeScript. + "baseUrl": ".", + "paths": { + "dummy/tests/*": ["tests/*"], + "dummy/*": ["tests/dummy/app/*", "app/*"], + "<%= addonName %>": ["addon"], + "<%= addonName %>/*": ["addon/*"], + "<%= addonName %>/test-support": ["addon-test-support"], + "<%= addonName %>/test-support/*": ["addon-test-support/*"], + "*": ["types/*"] + } + } +} +``` + +
+ +## What `@types/*` packages do I install? + +
if you're using ember-data + +``` +"@types/ember": "^4.0.8", +"@types/ember-data": "^4.4.13", +"@types/ember-data__adapter": "^4.0.4", +"@types/ember-data__model": "^4.0.3", +"@types/ember-data__serializer": "^4.0.4", +"@types/ember-data__store": "^4.0.5", +"@types/ember__application": "^4.0.9", +"@types/ember__array": "^4.0.7", +"@types/ember__component": "^4.0.19", +"@types/ember__controller": "^4.0.9", +"@types/ember__debug": "^4.0.6", +"@types/ember__destroyable": "^4.0.3", +"@types/ember__engine": "^4.0.8", +"@types/ember__error": "^4.0.4", +"@types/ember__helper": "^4.0.4", +"@types/ember__modifier": "^4.0.7", +"@types/ember__object": "^4.0.9", +"@types/ember__owner": "^4.0.7", +"@types/ember__polyfills": "^4.0.4", +"@types/ember__routing": "^4.0.17", +"@types/ember__runloop": "^4.0.7", +"@types/ember__service": "^4.0.6", +"@types/ember__string": "^3.16.3", +"@types/ember__template": "^4.0.4", +"@types/ember__test": "^4.0.4", +"@types/ember__utils": "^4.0.5", +"@types/qunit": "^2.19.7", +"@types/rsvp": "^4.0.6", +``` + +
+ +
if you're not using ember-data + +You can use ember's built in types, so you only need the following: + +``` +"@types/qunit": "^2.19.7", +"@types/rsvp": "^4.0.6", +``` + +Note that ember-data will eventually ship their own types, and allow _everyone_ to remove all the DT types. + +
+ + +----------------------------- +

ember-cli-typescript

Use TypeScript in your Ember 2.x and 3.x apps!