Skip to content

Commit 9a55ddb

Browse files
committed
refactor(example-app): align typescript config with latest defaults for new apps
1 parent 877fec5 commit 9a55ddb

File tree

9 files changed

+67
-59
lines changed

9 files changed

+67
-59
lines changed

example-app/angular.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"outputPath": "dist",
1616
"index": "src/index.html",
1717
"main": "src/main.ts",
18-
"tsConfig": "src/tsconfig.app.json",
18+
"tsConfig": "tsconfig.app.json",
1919
"polyfills": "src/polyfills.ts",
2020
"assets": [
2121
"src/assets",
@@ -74,7 +74,7 @@
7474
"main": "src/test.ts",
7575
"karmaConfig": "./karma.conf.js",
7676
"polyfills": "src/polyfills.ts",
77-
"tsConfig": "src/tsconfig.spec.json",
77+
"tsConfig": "tsconfig.spec.json",
7878
"scripts": [],
7979
"styles": [
8080
"src/styles.scss"
@@ -89,8 +89,8 @@
8989
"builder": "@angular-devkit/build-angular:tslint",
9090
"options": {
9191
"tsConfig": [
92-
"src/tsconfig.app.json",
93-
"src/tsconfig.spec.json"
92+
"tsconfig.app.json",
93+
"tsconfig.spec.json"
9494
],
9595
"exclude": []
9696
}

example-app/src/app/async-validation/async-validation.component.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
</li>
3838
</ul>
3939

40-
<ul *ngIf="(searchResults$ | async).length > 0">
41-
<li *ngFor="let r of (searchResults$ | async)">
42-
{{ r }}
43-
</li>
44-
</ul>
40+
<ng-container *ngIf="searchResults$ | async as searchResults">
41+
<ul *ngIf="searchResults.length > 0">
42+
<li *ngFor="let r of searchResults">
43+
{{ r }}
44+
</li>
45+
</ul>
46+
</ng-container>
4547
</ngf-form-example>

example-app/src/app/local-state-advanced/local-state-advanced.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ngf-form-example exampleName="Local state: Advanced"
22
githubLinkOverride="local-state-advanced"
3-
[formState]="localState">
3+
[formState]="localState.formState">
44
Advanced example that shows how you can disable emitting any form actions to the global store via the builtin
55
ActionsSubject.
66
Instead, you can listen for actions using the directive's output EventEmitter and route them to the component.

example-app/src/app/shared/form-example/form-example.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import { FormGroupState } from 'ngrx-forms';
1212
changeDetection: ChangeDetectionStrategy.OnPush,
1313
})
1414
export class FormExampleComponent {
15-
@Input() exampleName: string;
15+
@Input() exampleName = '';
1616
@Input() githubLinkOverride: string | undefined;
1717

1818
@Input() set formState(value: FormGroupState<any>) {
1919
const formStateJson = JSON.stringify(value, null, 2);
2020
this.formattedFormState = Prism.highlight(formStateJson, Prism.languages.json, 'en');
2121
}
2222

23-
formattedFormState: string;
23+
formattedFormState = '';
2424

2525
get githubLink() {
2626
return this.githubLinkOverride || this.exampleName.replace(' ', '-').toLowerCase();

example-app/src/tsconfig.app.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

example-app/src/tsconfig.spec.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

example-app/tsconfig.app.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "./tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "./out-tsc/app",
6+
"types": []
7+
},
8+
"files": [
9+
"src/main.ts",
10+
"src/polyfills.ts"
11+
],
12+
"include": [
13+
"src/**/*.d.ts"
14+
]
15+
}

example-app/tsconfig.json

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
12
{
23
"compileOnSave": false,
34
"compilerOptions": {
4-
"module": "es2020",
5+
"baseUrl": "./",
56
"outDir": "./dist/out-tsc",
6-
"baseUrl": "src",
7+
"forceConsistentCasingInFileNames": true,
8+
"strict": true,
9+
"noImplicitReturns": true,
10+
"noFallthroughCasesInSwitch": true,
711
"sourceMap": true,
812
"declaration": false,
9-
"moduleResolution": "node",
10-
"emitDecoratorMetadata": true,
13+
"downlevelIteration": true,
1114
"experimentalDecorators": true,
12-
"strict": true,
13-
"strictPropertyInitialization": false,
14-
"noUnusedParameters": true,
15-
"noUnusedLocals": true,
16-
"skipLibCheck": false,
17-
"target": "es2016",
18-
"typeRoots": ["node_modules/@types"],
19-
"lib": ["es2016", "dom"]
15+
"moduleResolution": "node",
16+
"importHelpers": true,
17+
"target": "es2015",
18+
"module": "es2020",
19+
"lib": [
20+
"es2018",
21+
"dom"
22+
]
23+
},
24+
"angularCompilerOptions": {
25+
"strictInjectionParameters": true,
26+
"strictInputAccessModifiers": true,
27+
"strictTemplates": true
2028
}
2129
}

example-app/tsconfig.spec.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "./tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "./out-tsc/spec",
6+
"types": [
7+
"jasmine"
8+
]
9+
},
10+
"files": [
11+
"src/test.ts",
12+
"src/polyfills.ts"
13+
],
14+
"include": [
15+
"src/**/*.spec.ts",
16+
"src/**/*.d.ts"
17+
]
18+
}

0 commit comments

Comments
 (0)