Skip to content

Commit 13e614a

Browse files
committed
Merge branch 'master' into mappedtype-inference-seperate-symbols
2 parents 86e51e0 + 0ae73a5 commit 13e614a

File tree

64 files changed

+66526
-606
lines changed

Some content is hidden

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

64 files changed

+66526
-606
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Please fill in the *entire* template below.
1616
-->
1717

1818
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
19-
**TypeScript Version:** 3.3.0-dev.201xxxxx
19+
**TypeScript Version:** 3.4.0-dev.201xxxxx
2020

2121
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
2222
**Search Terms:**

Gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ task("watch-tsserver").flags = {
232232
" --built": "Compile using the built version of the compiler."
233233
}
234234

235-
task("min", series(lkgPreBuild, buildTsc, buildServer));
235+
task("min", series(lkgPreBuild, parallel(buildTsc, buildServer)));
236236
task("min").description = "Builds only tsc and tsserver";
237237
task("min").flags = {
238238
" --built": "Compile using the built version of the compiler."

scripts/open-user-pr.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference lib="esnext.asynciterable" />
2+
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
13
import cp = require("child_process");
24
import Octokit = require("@octokit/rest");
35

@@ -35,7 +37,7 @@ gh.authenticate({
3537
type: "token",
3638
token: process.argv[2]
3739
});
38-
gh.pullRequests.create({
40+
gh.pulls.create({
3941
owner: process.env.TARGET_FORK,
4042
repo: "TypeScript",
4143
maintainer_can_modify: true,
@@ -50,7 +52,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
5052
}).then(r => {
5153
const num = r.data.number;
5254
console.log(`Pull request ${num} created.`);
53-
return gh.pullRequests.createReviewRequest({
55+
return gh.pulls.createReviewRequest({
5456
owner: process.env.TARGET_FORK,
5557
repo: "TypeScript",
5658
number: num,

src/compiler/checker.ts

Lines changed: 148 additions & 106 deletions
Large diffs are not rendered by default.

src/compiler/diagnosticMessages.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,10 @@
10151015
"category": "Error",
10161016
"code": 1353
10171017
},
1018+
"'readonly' type modifier is only permitted on array and tuple types.": {
1019+
"category": "Error",
1020+
"code": 1354
1021+
},
10181022

10191023
"Duplicate identifier '{0}'.": {
10201024
"category": "Error",
@@ -2120,6 +2124,14 @@
21202124
"category": "Error",
21212125
"code": 2588
21222126
},
2127+
"Type instantiation is excessively deep and possibly infinite.": {
2128+
"category": "Error",
2129+
"code": 2589
2130+
},
2131+
"Expression produces a union type that is too complex to represent.": {
2132+
"category": "Error",
2133+
"code": 2590
2134+
},
21232135
"JSX element attributes type '{0}' may not be a union type.": {
21242136
"category": "Error",
21252137
"code": 2600

src/compiler/factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,8 @@ namespace ts {
876876
}
877877

878878
export function createTypeOperatorNode(type: TypeNode): TypeOperatorNode;
879-
export function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword, type: TypeNode): TypeOperatorNode;
880-
export function createTypeOperatorNode(operatorOrType: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | TypeNode, type?: TypeNode) {
879+
export function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode;
880+
export function createTypeOperatorNode(operatorOrType: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword | TypeNode, type?: TypeNode) {
881881
const node = createSynthesizedNode(SyntaxKind.TypeOperator) as TypeOperatorNode;
882882
node.operator = typeof operatorOrType === "number" ? operatorOrType : SyntaxKind.KeyOfKeyword;
883883
node.type = parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type! : operatorOrType);

src/compiler/parser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2966,6 +2966,7 @@ namespace ts {
29662966
case SyntaxKind.NumberKeyword:
29672967
case SyntaxKind.BigIntKeyword:
29682968
case SyntaxKind.BooleanKeyword:
2969+
case SyntaxKind.ReadonlyKeyword:
29692970
case SyntaxKind.SymbolKeyword:
29702971
case SyntaxKind.UniqueKeyword:
29712972
case SyntaxKind.VoidKeyword:
@@ -3055,7 +3056,7 @@ namespace ts {
30553056
return finishNode(postfix);
30563057
}
30573058

3058-
function parseTypeOperator(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword) {
3059+
function parseTypeOperator(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword) {
30593060
const node = <TypeOperatorNode>createNode(SyntaxKind.TypeOperator);
30603061
parseExpected(operator);
30613062
node.operator = operator;
@@ -3077,6 +3078,7 @@ namespace ts {
30773078
switch (operator) {
30783079
case SyntaxKind.KeyOfKeyword:
30793080
case SyntaxKind.UniqueKeyword:
3081+
case SyntaxKind.ReadonlyKeyword:
30803082
return parseTypeOperator(operator);
30813083
case SyntaxKind.InferKeyword:
30823084
return parseInferType();

src/compiler/program.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,18 @@ namespace ts {
230230
const readFileWithCache = (fileName: string): string | undefined => {
231231
const key = toPath(fileName);
232232
const value = readFileCache.get(key);
233-
if (value !== undefined) return value || undefined;
233+
if (value !== undefined) return value !== false ? value : undefined;
234234
return setReadFileCache(key, fileName);
235235
};
236236
const setReadFileCache = (key: Path, fileName: string) => {
237237
const newValue = originalReadFile.call(host, fileName);
238-
readFileCache.set(key, newValue || false);
238+
readFileCache.set(key, newValue !== undefined ? newValue : false);
239239
return newValue;
240240
};
241241
host.readFile = fileName => {
242242
const key = toPath(fileName);
243243
const value = readFileCache.get(key);
244-
if (value !== undefined) return value; // could be .d.ts from output
244+
if (value !== undefined) return value !== false ? value : undefined; // could be .d.ts from output
245245
if (!fileExtensionIs(fileName, Extension.Json)) {
246246
return originalReadFile.call(host, fileName);
247247
}

src/compiler/scanner.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,15 @@ namespace ts {
661661
let pendingKind!: CommentKind;
662662
let pendingHasTrailingNewLine!: boolean;
663663
let hasPendingCommentRange = false;
664-
let collecting = trailing || pos === 0;
664+
let collecting = trailing;
665665
let accumulator = initial;
666+
if (pos === 0) {
667+
collecting = true;
668+
const shebang = getShebang(text);
669+
if (shebang) {
670+
pos = shebang.length;
671+
}
672+
}
666673
scan: while (pos >= 0 && pos < text.length) {
667674
const ch = text.charCodeAt(pos);
668675
switch (ch) {

src/compiler/transformers/ts.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,8 +1934,13 @@ namespace ts {
19341934
case SyntaxKind.ConditionalType:
19351935
return serializeTypeList([(<ConditionalTypeNode>node).trueType, (<ConditionalTypeNode>node).falseType]);
19361936

1937-
case SyntaxKind.TypeQuery:
19381937
case SyntaxKind.TypeOperator:
1938+
if ((<TypeOperatorNode>node).operator === SyntaxKind.ReadonlyKeyword) {
1939+
return serializeTypeNode((<TypeOperatorNode>node).type);
1940+
}
1941+
break;
1942+
1943+
case SyntaxKind.TypeQuery:
19391944
case SyntaxKind.IndexedAccessType:
19401945
case SyntaxKind.MappedType:
19411946
case SyntaxKind.TypeLiteral:

0 commit comments

Comments
 (0)