Repository: ember-cli/ember-cli
Pull request #10506 (2024-09-27 09:28:49)

[ENHANCEMENT] Use the official types in the blueprints
This updates the TS blueprints to use the official types instead of the outdated DT types.

Supersedes #10461 and #10270


Patch:
diff --git a/blueprints/addon/files/tsconfig.json b/blueprints/addon/files/tsconfig.json
index b46423069..7b83c0d8b 100644
--- a/blueprints/addon/files/tsconfig.json
+++ b/blueprints/addon/files/tsconfig.json
@@ -14,5 +14,8 @@
       "<%= addonName %>/test-support/*": ["addon-test-support/*"],
       "*": ["types/*"]
     }
-  }
+  },
+  "types": [
+    "ember-source/types"
+  ]
 }
diff --git a/blueprints/addon/index.js b/blueprints/addon/index.js
index 58819e8b9..b82bcc8b3 100644
--- a/blueprints/addon/index.js
+++ b/blueprints/addon/index.js
@@ -69,12 +69,12 @@ module.exports = {
     delete contents.devDependencies['ember-cli-htmlbars'];
 
     // 95% of addons don't need ember-data or ember-fetch, make them opt-in instead
-    delete contents.devDependencies['ember-data'];
-    delete contents.devDependencies['@types/ember-data'];
-    delete contents.devDependencies['@types/ember-data__adapter'];
-    delete contents.devDependencies['@types/ember-data__model'];
-    delete contents.devDependencies['@types/ember-data__serializer'];
-    delete contents.devDependencies['@types/ember-data__store'];
+    let deps = Object.keys(contents.devDependencies);
+    for (let depName of deps) {
+      if (depName.includes('ember-data') || depName.includes('warp-drive')) {
+        delete contents.devDependencies[depName];
+      }
+    }
     delete contents.devDependencies['ember-fetch'];
 
     // `@ember/string` is a peer dependency of `ember-data`.
diff --git a/blueprints/app/files/package.json b/blueprints/app/files/package.json
index 661f2ac3b..30bef4a6a 100644
--- a/blueprints/app/files/package.json
+++ b/blueprints/app/files/package.json
@@ -26,10 +26,20 @@
     "test:ember": "ember test"
   },
   "devDependencies": {
-    "@babel/core": "^7.25.2",
-    "<% if (!typescript) { %>@babel/eslint-parser": "^7.25.1",
-    "@babel/plugin-proposal-decorators": "^7.24.7",
-    "<% } %>@ember/optional-features": "^2.1.0",
+    "@babel/core": "^7.25.2<% if (!typescript) { %>",
+    "@babel/eslint-parser": "^7.25.1",
+    "@babel/plugin-proposal-decorators": "^7.24.7<% } %><% if (typescript) { %>",
+    "@ember-data/adapter": "~5.4.0-beta.11",
+    "@ember-data/graph": "~5.4.0-beta.11",
+    "@ember-data/json-api": "~5.4.0-beta.11",
+    "@ember-data/legacy-compat": "~5.4.0-beta.11",
+    "@ember-data/model": "~5.4.0-beta.11",
+    "@ember-data/request": "~5.4.0-beta.11",
+    "@ember-data/request-utils": "~5.4.0-beta.11",
+    "@ember-data/serializer": "~5.4.0-beta.11",
+    "@ember-data/store": "~5.4.0-beta.11",
+    "@ember-data/tracking": "~5.4.0-beta.11<% } %>",
+    "@ember/optional-features": "^2.1.0",
     "@ember/string": "^4.0.0",
     "@ember/test-helpers": "^3.3.1<% if (embroider) { %>",
     "@embroider/compat": "^3.6.0",
@@ -40,36 +50,11 @@
     "@glint/environment-ember-loose": "^1.4.0",
     "@glint/template": "^1.4.0",
     "@tsconfig/ember": "^3.0.8",
-    "@types/ember": "^4.0.11",
-    "@types/ember-data": "^4.4.16",
-    "@types/ember-data__adapter": "^4.0.6",
-    "@types/ember-data__model": "^4.0.5",
-    "@types/ember-data__serializer": "^4.0.6",
-    "@types/ember-data__store": "^4.0.7",
-    "@types/ember__application": "^4.0.11",
-    "@types/ember__array": "^4.0.10",
-    "@types/ember__component": "^4.0.22",
-    "@types/ember__controller": "^4.0.12",
-    "@types/ember__debug": "^4.0.8",
-    "@types/ember__destroyable": "^4.0.5",
-    "@types/ember__engine": "^4.0.11",
-    "@types/ember__error": "^4.0.6",
-    "@types/ember__helper": "^4.0.8",
-    "@types/ember__modifier": "^4.0.9",
-    "@types/ember__object": "^4.0.12",
-    "@types/ember__owner": "^4.0.9",
-    "@types/ember__polyfills": "^4.0.6",
-    "@types/ember__routing": "^4.0.22",
-    "@types/ember__runloop": "^4.0.10",
-    "@types/ember__service": "^4.0.9",
-    "@types/ember__string": "^3.16.3",
-    "@types/ember__template": "^4.0.7",
-    "@types/ember__test": "^4.0.6",
-    "@types/ember__utils": "^4.0.7",
     "@types/qunit": "^2.19.10",
     "@types/rsvp": "^4.0.9",
     "@typescript-eslint/eslint-plugin": "^7.18.0",
-    "@typescript-eslint/parser": "^7.18.0<% } %>",
+    "@typescript-eslint/parser": "^7.18.0",
+    "@warp-drive/core-types": "~0.0.0-alpha.94<% } %>",
     "broccoli-asset-rev": "^3.0.0",
     "concurrently": "^8.2.2",
     "ember-auto-import": "^2.7.4",
diff --git a/blueprints/app/files/tsconfig.json b/blueprints/app/files/tsconfig.json
index f53dc6e61..a8d2a98c6 100644
--- a/blueprints/app/files/tsconfig.json
+++ b/blueprints/app/files/tsconfig.json
@@ -9,6 +9,21 @@
       "<%= name %>/tests/*": ["tests/*"],
       "<%= name %>/*": ["app/*"],
       "*": ["types/*"]
-    }
+    },
+    "types": [
+      "ember-source/types",
+      "ember-data/unstable-preview-types",
+      "@ember-data/store/unstable-preview-types",
+      "@ember-data/adapter/unstable-preview-types",
+      "@ember-data/graph/unstable-preview-types",
+      "@ember-data/json-api/unstable-preview-types",
+      "@ember-data/legacy-compat/unstable-preview-types",
+      "@ember-data/request/unstable-preview-types",
+      "@ember-data/request-utils/unstable-preview-types",
+      "@ember-data/model/unstable-preview-types",
+      "@ember-data/serializer//unstable-preview-types",
+      "@ember-data/tracking/unstable-preview-types",
+      "@warp-drive/core-types/unstable-preview-types"
+    ]
   }
 }


Test patch:
diff --git a/tests/fixtures/addon/typescript/package.json b/tests/fixtures/addon/typescript/package.json
index 11561bee5..68fed27eb 100644
--- a/tests/fixtures/addon/typescript/package.json
+++ b/tests/fixtures/addon/typescript/package.json
@@ -59,27 +59,6 @@
     "@glint/environment-ember-loose": "^1.4.0",
     "@glint/template": "^1.4.0",
     "@tsconfig/ember": "^3.0.8",
-    "@types/ember": "^4.0.11",
-    "@types/ember__application": "^4.0.11",
-    "@types/ember__array": "^4.0.10",
-    "@types/ember__component": "^4.0.22",
-    "@types/ember__controller": "^4.0.12",
-    "@types/ember__debug": "^4.0.8",
-    "@types/ember__destroyable": "^4.0.5",
-    "@types/ember__engine": "^4.0.11",
-    "@types/ember__error": "^4.0.6",
-    "@types/ember__helper": "^4.0.8",
-    "@types/ember__modifier": "^4.0.9",
-    "@types/ember__object": "^4.0.12",
-    "@types/ember__owner": "^4.0.9",
-    "@types/ember__polyfills": "^4.0.6",
-    "@types/ember__routing": "^4.0.22",
-    "@types/ember__runloop": "^4.0.10",
-    "@types/ember__service": "^4.0.9",
-    "@types/ember__string": "^3.16.3",
-    "@types/ember__template": "^4.0.7",
-    "@types/ember__test": "^4.0.6",
-    "@types/ember__utils": "^4.0.7",
     "@types/qunit": "^2.19.10",
     "@types/rsvp": "^4.0.9",
     "@typescript-eslint/eslint-plugin": "^7.18.0",
diff --git a/tests/fixtures/addon/typescript/tsconfig.json b/tests/fixtures/addon/typescript/tsconfig.json
index a292f6acc..b4455bf29 100644
--- a/tests/fixtures/addon/typescript/tsconfig.json
+++ b/tests/fixtures/addon/typescript/tsconfig.json
@@ -14,5 +14,8 @@
       "foo/test-support/*": ["addon-test-support/*"],
       "*": ["types/*"]
     }
-  }
+  },
+  "types": [
+    "ember-source/types"
+  ]
 }
diff --git a/tests/fixtures/app/typescript-embroider/package.json b/tests/fixtures/app/typescript-embroider/package.json
index 0106a0a4b..b77e8c00d 100644
--- a/tests/fixtures/app/typescript-embroider/package.json
+++ b/tests/fixtures/app/typescript-embroider/package.json
@@ -27,6 +27,16 @@
   },
   "devDependencies": {
     "@babel/core": "^7.25.2",
+    "@ember-data/adapter": "~5.4.0-beta.11",
+    "@ember-data/graph": "~5.4.0-beta.11",
+    "@ember-data/json-api": "~5.4.0-beta.11",
+    "@ember-data/legacy-compat": "~5.4.0-beta.11",
+    "@ember-data/model": "~5.4.0-beta.11",
+    "@ember-data/request": "~5.4.0-beta.11",
+    "@ember-data/request-utils": "~5.4.0-beta.11",
+    "@ember-data/serializer": "~5.4.0-beta.11",
+    "@ember-data/store": "~5.4.0-beta.11",
+    "@ember-data/tracking": "~5.4.0-beta.11",
     "@ember/optional-features": "^2.1.0",
     "@ember/string": "^4.0.0",
     "@ember/test-helpers": "^3.3.1",
@@ -38,36 +48,11 @@
     "@glint/environment-ember-loose": "^1.4.0",
     "@glint/template": "^1.4.0",
     "@tsconfig/ember": "^3.0.8",
-    "@types/ember": "^4.0.11",
-    "@types/ember-data": "^4.4.16",
-    "@types/ember-data__adapter": "^4.0.6",
-    "@types/ember-data__model": "^4.0.5",
-    "@types/ember-data__serializer": "^4.0.6",
-    "@types/ember-data__store": "^4.0.7",
-    "@types/ember__application": "^4.0.11",
-    "@types/ember__array": "^4.0.10",
-    "@types/ember__component": "^4.0.22",
-    "@types/ember__controller": "^4.0.12",
-    "@types/ember__debug": "^4.0.8",
-    "@types/ember__destroyable": "^4.0.5",
-    "@types/ember__engine": "^4.0.11",
-    "@types/ember__error": "^4.0.6",
-    "@types/ember__helper": "^4.0.8",
-    "@types/ember__modifier": "^4.0.9",
-    "@types/ember__object": "^4.0.12",
-    "@types/ember__owner": "^4.0.9",
-    "@types/ember__polyfills": "^4.0.6",
-    "@types/ember__routing": "^4.0.22",
-    "@types/ember__runloop": "^4.0.10",
-    "@types/ember__service": "^4.0.9",
-    "@types/ember__string": "^3.16.3",
-    "@types/ember__template": "^4.0.7",
-    "@types/ember__test": "^4.0.6",
-    "@types/ember__utils": "^4.0.7",
     "@types/qunit": "^2.19.10",
     "@types/rsvp": "^4.0.9",
     "@typescript-eslint/eslint-plugin": "^7.18.0",
     "@typescript-eslint/parser": "^7.18.0",
+    "@warp-drive/core-types": "~0.0.0-alpha.94",
     "broccoli-asset-rev": "^3.0.0",
     "concurrently": "^8.2.2",
     "ember-auto-import": "^2.7.4",
diff --git a/tests/fixtures/app/typescript-embroider/tsconfig.json b/tests/fixtures/app/typescript-embroider/tsconfig.json
index 1bafd423d..998df4349 100644
--- a/tests/fixtures/app/typescript-embroider/tsconfig.json
+++ b/tests/fixtures/app/typescript-embroider/tsconfig.json
@@ -9,6 +9,21 @@
       "foo/tests/*": ["tests/*"],
       "foo/*": ["app/*"],
       "*": ["types/*"]
-    }
+    },
+    "types": [
+      "ember-source/types",
+      "ember-data/unstable-preview-types",
+      "@ember-data/store/unstable-preview-types",
+      "@ember-data/adapter/unstable-preview-types",
+      "@ember-data/graph/unstable-preview-types",
+      "@ember-data/json-api/unstable-preview-types",
+      "@ember-data/legacy-compat/unstable-preview-types",
+      "@ember-data/request/unstable-preview-types",
+      "@ember-data/request-utils/unstable-preview-types",
+      "@ember-data/model/unstable-preview-types",
+      "@ember-data/serializer//unstable-preview-types",
+      "@ember-data/tracking/unstable-preview-types",
+      "@warp-drive/core-types/unstable-preview-types"
+    ]
   }
 }
diff --git a/tests/fixtures/app/typescript/package.json b/tests/fixtures/app/typescript/package.json
index e7cfd949d..3ce9bc373 100644
--- a/tests/fixtures/app/typescript/package.json
+++ b/tests/fixtures/app/typescript/package.json
@@ -27,6 +27,16 @@
   },
   "devDependencies": {
     "@babel/core": "^7.25.2",
+    "@ember-data/adapter": "~5.4.0-beta.11",
+    "@ember-data/graph": "~5.4.0-beta.11",
+    "@ember-data/json-api": "~5.4.0-beta.11",
+    "@ember-data/legacy-compat": "~5.4.0-beta.11",
+    "@ember-data/model": "~5.4.0-beta.11",
+    "@ember-data/request": "~5.4.0-beta.11",
+    "@ember-data/request-utils": "~5.4.0-beta.11",
+    "@ember-data/serializer": "~5.4.0-beta.11",
+    "@ember-data/store": "~5.4.0-beta.11",
+    "@ember-data/tracking": "~5.4.0-beta.11",
     "@ember/optional-features": "^2.1.0",
     "@ember/string": "^4.0.0",
     "@ember/test-helpers": "^3.3.1",
@@ -35,36 +45,11 @@
     "@glint/environment-ember-loose": "^1.4.0",
     "@glint/template": "^1.4.0",
     "@tsconfig/ember": "^3.0.8",
-    "@types/ember": "^4.0.11",
-    "@types/ember-data": "^4.4.16",
-    "@types/ember-data__adapter": "^4.0.6",
-    "@types/ember-data__model": "^4.0.5",
-    "@types/ember-data__serializer": "^4.0.6",
-    "@types/ember-data__store": "^4.0.7",
-    "@types/ember__application": "^4.0.11",
-    "@types/ember__array": "^4.0.10",
-    "@types/ember__component": "^4.0.22",
-    "@types/ember__controller": "^4.0.12",
-    "@types/ember__debug": "^4.0.8",
-    "@types/ember__destroyable": "^4.0.5",
-    "@types/ember__engine": "^4.0.11",
-    "@types/ember__error": "^4.0.6",
-    "@types/ember__helper": "^4.0.8",
-    "@types/ember__modifier": "^4.0.9",
-    "@types/ember__object": "^4.0.12",
-    "@types/ember__owner": "^4.0.9",
-    "@types/ember__polyfills": "^4.0.6",
-    "@types/ember__routing": "^4.0.22",
-    "@types/ember__runloop": "^4.0.10",
-    "@types/ember__service": "^4.0.9",
-    "@types/ember__string": "^3.16.3",
-    "@types/ember__template": "^4.0.7",
-    "@types/ember__test": "^4.0.6",
-    "@types/ember__utils": "^4.0.7",
     "@types/qunit": "^2.19.10",
     "@types/rsvp": "^4.0.9",
     "@typescript-eslint/eslint-plugin": "^7.18.0",
     "@typescript-eslint/parser": "^7.18.0",
+    "@warp-drive/core-types": "~0.0.0-alpha.94",
     "broccoli-asset-rev": "^3.0.0",
     "concurrently": "^8.2.2",
     "ember-auto-import": "^2.7.4",
diff --git a/tests/fixtures/app/typescript/tsconfig.json b/tests/fixtures/app/typescript/tsconfig.json
index 1bafd423d..998df4349 100644
--- a/tests/fixtures/app/typescript/tsconfig.json
+++ b/tests/fixtures/app/typescript/tsconfig.json
@@ -9,6 +9,21 @@
       "foo/tests/*": ["tests/*"],
       "foo/*": ["app/*"],
       "*": ["types/*"]
-    }
+    },
+    "types": [
+      "ember-source/types",
+      "ember-data/unstable-preview-types",
+      "@ember-data/store/unstable-preview-types",
+      "@ember-data/adapter/unstable-preview-types",
+      "@ember-data/graph/unstable-preview-types",
+      "@ember-data/json-api/unstable-preview-types",
+      "@ember-data/legacy-compat/unstable-preview-types",
+      "@ember-data/request/unstable-preview-types",
+      "@ember-data/request-utils/unstable-preview-types",
+      "@ember-data/model/unstable-preview-types",
+      "@ember-data/serializer//unstable-preview-types",
+      "@ember-data/tracking/unstable-preview-types",
+      "@warp-drive/core-types/unstable-preview-types"
+    ]
   }
 }