You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(@schematics/angular): generate interceptors with a dash type separator
To align with the updated style guide, Angular v20 will generate interceptors
with file extension `interceptor` type prefixed with a `-` separator instead of
a `.` by default. Projects will automatically use this naming convention.
Projects can however opt-out by setting the `typeSeparator` option to `.`
for the interceptor schematic. This can be done as a default in the `angular.json`
or directly on the commandline via `--type-separator=.` when executing `ng generate`.
As an example, `example.interceptor.ts` will now be named `example-interceptor.ts`.
The TypeScript declaration will continue to contain `Interceptor` such as with `ExampleInterceptor`.
Copy file name to clipboardExpand all lines: packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.spec.ts.template
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
import { TestBed } from '@angular/core/testing';
2
2
3
-
import { <%= classify(name) %>Interceptor } from './<%= dasherize(name) %>.interceptor';
Copy file name to clipboardExpand all lines: packages/schematics/angular/interceptor/functional-files/__name@dasherize____typeSeparator__interceptor.spec.ts.template
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
import { TestBed } from '@angular/core/testing';
2
2
import { HttpInterceptorFn } from '@angular/common/http';
3
3
4
-
import { <%= camelize(name) %>Interceptor } from './<%= dasherize(name) %>.interceptor';
Copy file name to clipboardExpand all lines: packages/schematics/angular/interceptor/schema.json
+6
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,12 @@
45
45
"type": "boolean",
46
46
"description": "Creates the interceptor as a function `HttpInterceptorFn` instead of a class. Functional interceptors can be simpler for basic scenarios.",
47
47
"default": true
48
+
},
49
+
"typeSeparator": {
50
+
"type": "string",
51
+
"default": "-",
52
+
"enum": ["-", "."],
53
+
"description": "The separator character to use before the type within the generated file's name. For example, if you set the option to `.`, the file will be named `example.interceptor.ts`."
0 commit comments