diff --git a/changelog_unreleased/angular/16862.md b/changelog_unreleased/angular/16862.md new file mode 100644 index 000000000..928d00403 --- /dev/null +++ b/changelog_unreleased/angular/16862.md @@ -0,0 +1,21 @@ +#### Support Angular 19 (#16862 by @fisker) + +Angular 19 added [support for `typeof` keyword in template expressions](https://github.com/angular/angular/pull/58183). + + +```html + +
{{ typeof + x === + 'object' ? 'Y' : 'N'}}
+ + +
+ {{ typeof + x === + 'object' ? 'Y' : 'N'}} +
+ +// Prettier main +
{{ typeof x === "object" ? "Y" : "N" }}
+``` diff --git a/package.json b/package.json index fcacf5e29..83d2d8fc5 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@typescript-eslint/visitor-keys": "8.15.0", "acorn": "8.14.0", "acorn-jsx": "5.3.2", - "angular-estree-parser": "10.1.0", + "angular-estree-parser": "10.2.0", "angular-html-parser": "7.0.1", "camelcase": "8.0.0", "chalk": "5.3.0", diff --git a/tests/format/angular/typeof-expression/__snapshots__/format.test.js.snap b/tests/format/angular/typeof-expression/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..82acc255b --- /dev/null +++ b/tests/format/angular/typeof-expression/__snapshots__/format.test.js.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typeof-expression.html format 1`] = ` +====================================options===================================== +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ {{ typeof + x}} + {{ typeof + x === + 'object'}} + {{ + !(typeof + x === + 'object') + }} +
+ +=====================================output===================================== +
+ {{ typeof x }} + {{ typeof x === "object" }} + {{ !(typeof x === "object") }} +
+ +================================================================================ +`; diff --git a/tests/format/angular/typeof-expression/format.test.js b/tests/format/angular/typeof-expression/format.test.js new file mode 100644 index 000000000..8cbc48b1a --- /dev/null +++ b/tests/format/angular/typeof-expression/format.test.js @@ -0,0 +1 @@ +runFormatTest(import.meta, ["angular"]); diff --git a/tests/format/angular/typeof-expression/typeof-expression.html b/tests/format/angular/typeof-expression/typeof-expression.html new file mode 100644 index 000000000..04d980261 --- /dev/null +++ b/tests/format/angular/typeof-expression/typeof-expression.html @@ -0,0 +1,36 @@ +
+ {{ typeof + x}} + {{ typeof + x === + 'object'}} + {{ + !(typeof + x === + 'object') + }} +
diff --git a/yarn.lock b/yarn.lock index 67a610c6a..faae31b6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2173,12 +2173,12 @@ __metadata: languageName: node linkType: hard -"angular-estree-parser@npm:10.1.0": - version: 10.1.0 - resolution: "angular-estree-parser@npm:10.1.0" +"angular-estree-parser@npm:10.2.0": + version: 10.2.0 + resolution: "angular-estree-parser@npm:10.2.0" peerDependencies: "@angular/compiler": ^17.3.9 || ^18.0.0 || ^19.0.0 - checksum: 10/48b3e6396985b59461d80f5d2a90dc46bf233f04bf7869e5d3b55de4a76ccc82ee040345e0616e91ef09637d307031cb57cc257f5da84ec63b9e54103d734d2c + checksum: 10/1e5a273c99e21e06c177c40cb9a394313296f78d092254b1b46adaa77e244ac7f4241ec67c3e345799e2ab08cab5d78017b73743f57429a4e6d6f6c60ba0a490 languageName: node linkType: hard @@ -7264,7 +7264,7 @@ __metadata: "@typescript-eslint/visitor-keys": "npm:8.15.0" acorn: "npm:8.14.0" acorn-jsx: "npm:5.3.2" - angular-estree-parser: "npm:10.1.0" + angular-estree-parser: "npm:10.2.0" angular-html-parser: "npm:7.0.1" benchmark: "npm:2.1.4" browserslist: "npm:4.24.0"