Skip to content

Commit b6a80b6

Browse files
Merge pull request #516 from angular/master
Create a new pull request by comparing changes across two branches.
2 parents 7705079 + a2e069f commit b6a80b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2062
-409
lines changed

aio/content/guide/angular-compiler-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For example:
3131

3232
```json
3333
{
34-
"extends": "../tsconfig.base.json",
34+
"extends": "../tsconfig.json",
3535
"compilerOptions": {
3636
"experimentalDecorators": true,
3737
...

aio/content/guide/file-structure.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ The top level of the workspace contains workspace-wide configuration files, conf
4040
| `package-lock.json` | Provides version information for all packages installed into `node_modules` by the npm client. See [npm documentation](https://docs.npmjs.com/files/package-lock.json) for details. If you use the yarn client, this file will be [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) instead. |
4141
| `src/` | Source files for the root-level application project. |
4242
| `node_modules/` | Provides [npm packages](guide/npm-packages) to the entire workspace. Workspace-wide `node_modules` dependencies are visible to all projects. |
43-
| `tsconfig.json` | The `tsconfig.json` file is a ["Solution Style"](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#support-for-solution-style-tsconfigjson-files) TypeScript configuration file. Code editors and TypeScript’s language server use this file to improve development experience. Compilers do not use this file. |
44-
| `tsconfig.base.json` | The base [TypeScript](https://www.typescriptlang.org/) configuration for projects in the workspace. All other configuration files inherit from this base file. For more information, see the [Configuration inheritance with extends](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends) section of the TypeScript documentation.|
43+
| `tsconfig.json` | The base [TypeScript](https://www.typescriptlang.org/) configuration for projects in the workspace. All other configuration files inherit from this base file. For more information, see the [Configuration inheritance with extends](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends) section of the TypeScript documentation.|
4544
| `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for projects in the workspace. |
4645

4746

@@ -103,7 +102,7 @@ Angular components, templates, and styles go here.
103102
The application-specific configuration files for the root application reside at the workspace root level.
104103
For a multi-project workspace, project-specific configuration files are in the project root, under `projects/project-name/`.
105104

106-
Project-specific [TypeScript](https://www.typescriptlang.org/) configuration files inherit from the workspace-wide `tsconfig.base.json`, and project-specific [TSLint](https://palantir.github.io/tslint/) configuration files inherit from the workspace-wide `tslint.json`.
105+
Project-specific [TypeScript](https://www.typescriptlang.org/) configuration files inherit from the workspace-wide `tsconfig.json`, and project-specific [TSLint](https://palantir.github.io/tslint/) configuration files inherit from the workspace-wide `tslint.json`.
107106

108107
| APPLICATION-SPECIFIC CONFIG FILES | PURPOSE |
109108
| :--------------------- | :------------------------------------------|

aio/content/guide/ivy-compatibility.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ That said, some applications will likely need to apply some manual updates.
1111
In version 10, [a few deprecated APIs have been removed](guide/updating-to-version-10#removals) and there are a [few breaking changes](guide/updating-to-version-10#breaking-changes) unrelated to Ivy.
1212
If you're seeing errors after updating to version 9, you'll first want to rule those changes out.
1313

14-
To do so, temporarily [turn off Ivy](guide/ivy#opting-out-of-angular-ivy) in your `tsconfig.base.json` and re-start your app.
14+
To do so, temporarily [turn off Ivy](guide/ivy#opting-out-of-angular-ivy) in your `tsconfig.json` and re-start your app.
1515

1616
If you're still seeing the errors, they are not specific to Ivy. In this case, you may want to consult the [general version 10 guide](guide/updating-to-version-10). If you've opted into any of the new, stricter type-checking settings, you may also want to check out the [template type-checking guide](guide/template-typecheck).
1717

18-
If the errors are gone, switch back to Ivy by removing the changes to the `tsconfig.base.json` and review the list of expected changes below.
18+
If the errors are gone, switch back to Ivy by removing the changes to the `tsconfig.json` and review the list of expected changes below.
1919

2020
{@a payload-size-debugging}
2121
### Payload size debugging

aio/content/guide/migration-solution-style-tsconfig.md

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

aio/content/guide/migration-update-module-and-target-compiler-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This process helps ensure that intentional changes to the options are kept in pl
99

1010
TypeScript Configuration File(s) | Changed Property | Existing Value | New Value
1111
------------- | ------------- | ------------- | ------------- | -------------
12-
`<workspace base>/tsconfig.base.json` | `"module"` | `"esnext"` | `"es2020"`
12+
`<workspace base>/tsconfig.json` | `"module"` | `"esnext"` | `"es2020"`
1313
Used in `browser` builder options (`ng build` for applications) | `"module"` | `"esnext"` | `"es2020"`
1414
Used in `ng-packgr` builder options (`ng build` for libraries) | `"module"` | `"esnext"` | `"es2020"`
1515
Used in `karma` builder options (`ng test` for applications) | `"module"` | `"esnext"` | `"es2020"`

aio/content/guide/template-typecheck.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ In case of a false positive like these, there are a few options:
114114
|Strictness flag|Effect|
115115
|-|-|
116116
|`strictInputTypes`|Whether the assignability of a binding expression to the `@Input()` field is checked. Also affects the inference of directive generic types. |
117+
|`strictInputAccessModifiers`|Whether access modifiers such as `private`/`protected`/`readonly` are honored when assigning a binding expression to an `@Input()`. If disabled, the access modifiers of the `@Input` are ignored; only the type is checked.|
117118
|`strictNullInputTypes`|Whether `strictNullChecks` is honored when checking `@Input()` bindings (per `strictInputTypes`). Turning this off can be useful when using a library that was not built with `strictNullChecks` in mind.|
118119
|`strictAttributeTypes`|Whether to check `@Input()` bindings that are made using text attributes (for example, `<mat-tab label="Step 1">` vs `<mat-tab [label]="'Step 1'">`).
119120
|`strictSafeNavigationTypes`|Whether the return type of safe navigation operations (for example, `user?.name`) will be correctly inferred based on the type of `user`). If disabled, `user?.name` will be of type `any`.

aio/content/guide/typescript-configuration.md

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,7 @@ that are important to Angular developers, including details about the following
1818
## Configuration files
1919

2020
A given Angular workspace contains several TypeScript configuration files.
21-
At the root level, there are two main TypeScript configuration files: a `tsconfig.json` file and a `tsconfig.base.json` file.
22-
23-
The `tsconfig.json` file is a ["Solution Style"](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#support-for-solution-style-tsconfigjson-files) TypeScript configuration file.
24-
Code editors and TypeScript’s language server use this file to improve development experience.
25-
Compilers do not use this file.
26-
27-
The `tsconfig.json` file contains a list of paths to the other TypeScript configuration files used in the workspace.
28-
29-
<code-example lang="json" header="tsconfig.json" linenums="false">
30-
{
31-
"files": [],
32-
"references": [
33-
{
34-
"path": "./tsconfig.app.json"
35-
},
36-
{
37-
"path": "./tsconfig.spec.json"
38-
},
39-
{
40-
"path": "./projects/my-lib/tsconfig.lib.json"
41-
}
42-
]
43-
}
44-
</code-example>
45-
46-
The `tsconfig.base.json` file specifies the base TypeScript and Angular compiler options that all projects in the workspace inherit.
21+
At the root `tsconfig.json` file specifies the base TypeScript and Angular compiler options that all projects in the workspace inherit.
4722

4823
The TypeScript and Angular have a wide range of options which can be used to configure type-checking features and generated output.
4924
For more information, see the [Configuration inheritance with extends](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends) section of the TypeScript documentation.
@@ -55,9 +30,9 @@ For details about configuration inheritance, see the [Configuration inheritance
5530

5631
</div>
5732

58-
The initial `tsconfig.base.json` for an Angular workspace typically looks like the following example.
33+
The initial `tsconfig.json` for an Angular workspace typically looks like the following example.
5934

60-
<code-example lang="json" header="tsconfig.base.json" linenums="false">
35+
<code-example lang="json" header="tsconfig.json" linenums="false">
6136
{
6237
"compileOnSave": false,
6338
"compilerOptions": {

aio/content/guide/universal.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ src/
4848
app/ ... <i>application code</i>
4949
app.server.module.ts <i>* server-side application module</i>
5050
server.ts <i>* express web server</i>
51-
tsconfig.json <i>TypeScript solution style configuration</i>
52-
tsconfig.base.json <i>TypeScript base configuration</i>
51+
tsconfig.json <i>TypeScript base configuration</i>
5352
tsconfig.app.json <i>TypeScript browser application configuration</i>
5453
tsconfig.server.json <i>TypeScript server application configuration</i>
5554
tsconfig.spec.json <i>TypeScript tests configuration</i>

aio/content/guide/updating-to-version-10.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,5 @@ Read about the migrations the CLI handles for you automatically:
7777

7878
* [Migrating missing `@Directive()`/`@Component()` decorators](guide/migration-undecorated-classes)
7979
* [Migrating `ModuleWithProviders`](guide/migration-module-with-providers)
80-
* [Solution-style `tsconfig.json` migration](guide/migration-solution-style-tsconfig)
8180
* [`tslib` direct dependency migration](guide/migration-update-libraries-tslib)
8281
* [Update `module` and `target` compiler options migration](guide/migration-update-module-and-target-compiler-options)

aio/content/navigation.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,6 @@
858858
"title": "Missing @Injectable() Decorators",
859859
"tooltip": "Migration to add missing @Injectable() decorators and incomplete provider definitions."
860860
},
861-
{
862-
"url": "guide/migration-solution-style-tsconfig",
863-
"title": "Solution-style `tsconfig.json`",
864-
"tooltip": "Migration to create a solution-style `tsconfig.json`."
865-
},
866861
{
867862
"url": "guide/migration-update-libraries-tslib",
868863
"title": "`tslib` direct dependency",

dev-infra/format/cli.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
import * as yargs from 'yargs';
99

10-
import {allChangedFilesSince, allFiles} from '../utils/repo-files';
10+
import {allChangedFilesSince, allFiles, allStagedFiles} from '../utils/repo-files';
1111

1212
import {checkFiles, formatFiles} from './format';
1313

@@ -34,6 +34,12 @@ export function buildFormatParser(localYargs: yargs.Argv) {
3434
const executionCmd = check ? checkFiles : formatFiles;
3535
executionCmd(allChangedFilesSince(sha));
3636
})
37+
.command(
38+
'staged', 'Run the formatter on all staged files', {},
39+
({check}) => {
40+
const executionCmd = check ? checkFiles : formatFiles;
41+
executionCmd(allStagedFiles());
42+
})
3743
.command('files <files..>', 'Run the formatter on provided files', {}, ({check, files}) => {
3844
const executionCmd = check ? checkFiles : formatFiles;
3945
executionCmd(files);

dev-infra/utils/repo-files.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ export function allChangedFilesSince(sha = 'HEAD') {
2727
return Array.from(new Set([...diffFiles, ...untrackedFiles]));
2828
}
2929

30+
/**
31+
* A list of all staged files which have been modified.
32+
*
33+
* Only added, created and modified files are listed as others (deleted, renamed, etc) aren't
34+
* changed or available as content to act upon.
35+
*/
36+
export function allStagedFiles() {
37+
return gitOutputAsArray(`git diff --staged --name-only --diff-filter=ACM`);
38+
}
39+
40+
41+
3042
export function allFiles() {
3143
return gitOutputAsArray(`git ls-files`);
3244
}

goldens/public-api/compiler-cli/compiler_options.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export interface StrictTemplateOptions {
3535
strictContextGenerics?: boolean;
3636
strictDomEventTypes?: boolean;
3737
strictDomLocalRefTypes?: boolean;
38+
strictInputAccessModifiers?: boolean;
3839
strictInputTypes?: boolean;
3940
strictLiteralTypes?: boolean;
4041
strictNullInputTypes?: boolean;

goldens/size-tracking/integration-payloads.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"bundle": "TODO(i): we should define ngDevMode to false in Closure, but --define only works in the global scope.",
6363
"bundle": "TODO(i): (FW-2164) TS 3.9 new class shape seems to have broken Closure in big ways. The size went from 169991 to 252338",
6464
"bundle": "TODO(i): after removal of tsickle from ngc-wrapped / ng_package, we had to switch to SIMPLE optimizations which increased the size from 252338 to 1198917, see PR#37221 and PR#37317 for more info",
65-
"bundle": 1214317
65+
"bundle": 1214857
6666
}
6767
}
6868
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
"cldr-data-coverage": "full",
210210
"husky": {
211211
"hooks": {
212+
"pre-commit": "yarn -s ng-dev format staged",
212213
"commit-msg": "yarn -s ng-dev commit-message pre-commit-validate --file-env-variable HUSKY_GIT_PARAMS"
213214
}
214215
}

packages/compiler-cli/ngcc/src/host/esm2015_host.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as ts from 'typescript';
1010
import {absoluteFromSourceFile} from '../../../src/ngtsc/file_system';
1111

1212
import {Logger} from '../../../src/ngtsc/logging';
13-
import {ClassDeclaration, ClassMember, ClassMemberKind, CtorParameter, Declaration, Decorator, EnumMember, isDecoratorIdentifier, isNamedClassDeclaration, isNamedFunctionDeclaration, isNamedVariableDeclaration, KnownDeclaration, reflectObjectLiteral, SpecialDeclarationKind, TypeScriptReflectionHost, TypeValueReference} from '../../../src/ngtsc/reflection';
13+
import {ClassDeclaration, ClassMember, ClassMemberKind, CtorParameter, Declaration, Decorator, EnumMember, isDecoratorIdentifier, isNamedClassDeclaration, isNamedFunctionDeclaration, isNamedVariableDeclaration, KnownDeclaration, reflectObjectLiteral, SpecialDeclarationKind, TypeScriptReflectionHost, TypeValueReference, TypeValueReferenceKind, ValueUnavailableKind} from '../../../src/ngtsc/reflection';
1414
import {isWithinPackage} from '../analysis/util';
1515
import {BundleProgram} from '../packages/bundle_program';
1616
import {findAll, getNameText, hasNameIdentifier, isDefined, stripDollarSuffix} from '../utils';
@@ -1594,7 +1594,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N
15941594
{decorators: null, typeExpression: null};
15951595
const nameNode = node.name;
15961596

1597-
let typeValueReference: TypeValueReference|null = null;
1597+
let typeValueReference: TypeValueReference;
15981598
if (typeExpression !== null) {
15991599
// `typeExpression` is an expression in a "type" context. Resolve it to a declared value.
16001600
// Either it's a reference to an imported type, or a type declared locally. Distinguish the
@@ -1603,19 +1603,24 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N
16031603
if (decl !== null && decl.node !== null && decl.viaModule !== null &&
16041604
isNamedDeclaration(decl.node)) {
16051605
typeValueReference = {
1606-
local: false,
1606+
kind: TypeValueReferenceKind.IMPORTED,
16071607
valueDeclaration: decl.node,
16081608
moduleName: decl.viaModule,
16091609
importedName: decl.node.name.text,
16101610
nestedPath: null,
16111611
};
16121612
} else {
16131613
typeValueReference = {
1614-
local: true,
1614+
kind: TypeValueReferenceKind.LOCAL,
16151615
expression: typeExpression,
16161616
defaultImportStatement: null,
16171617
};
16181618
}
1619+
} else {
1620+
typeValueReference = {
1621+
kind: TypeValueReferenceKind.UNAVAILABLE,
1622+
reason: {kind: ValueUnavailableKind.MISSING_TYPE},
1623+
};
16191624
}
16201625

16211626
return {

0 commit comments

Comments
 (0)