Skip to content

Commit 2071466

Browse files
committed
Merge branch 'master' into requireJson
2 parents c154b81 + 17b10dc commit 2071466

File tree

1,506 files changed

+56157
-55790
lines changed

Some content is hidden

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

1,506 files changed

+56157
-55790
lines changed

Diff for: .circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ workflows:
6565
base: &base
6666
environment:
6767
- workerCount: 4
68+
- timeout: 400000
6869
steps:
6970
- checkout
7071
- run: |

Diff for: .npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ tslint.json
1515
Jakefile.js
1616
.editorconfig
1717
.gitattributes
18+
.gitmodules
1819
.settings/
1920
.travis.yml
21+
.circleci
2022
.vscode/
23+
.parallelperf.json
2124
test.config
2225
package-lock.json
26+
yarn.lock

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node_js:
88
sudo: false
99

1010
env:
11-
- workerCount=3
11+
- workerCount=3 timeout=600000
1212

1313
matrix:
1414
fast_finish: true

Diff for: Gulpfile.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,16 @@ const es2017LibrarySource = [
143143
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
144144
({ target: "lib." + source, sources: ["header.d.ts", source] }));
145145

146-
const es2018LibrarySource = [];
146+
const es2018LibrarySource = [
147+
"es2018.regexp.d.ts",
148+
"es2018.promise.d.ts"
149+
];
147150
const es2018LibrarySourceMap = es2018LibrarySource.map(source =>
148151
({ target: "lib." + source, sources: ["header.d.ts", source] }));
149152

150153
const esnextLibrarySource = [
151154
"esnext.asynciterable.d.ts",
152-
"esnext.array.d.ts",
153-
"esnext.promise.d.ts"
155+
"esnext.array.d.ts"
154156
];
155157

156158
const esnextLibrarySourceMap = esnextLibrarySource.map(source =>

Diff for: Jakefile.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,18 @@ var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
206206
return { target: "lib." + source, sources: ["header.d.ts", source] };
207207
});
208208

209-
var es2018LibrarySource = [];
209+
var es2018LibrarySource = [
210+
"es2018.regexp.d.ts",
211+
"es2018.promise.d.ts"
212+
];
210213

211214
var es2018LibrarySourceMap = es2018LibrarySource.map(function (source) {
212215
return { target: "lib." + source, sources: ["header.d.ts", source] };
213216
});
214217

215218
var esnextLibrarySource = [
216219
"esnext.asynciterable.d.ts",
217-
"esnext.array.d.ts",
218-
"esnext.promise.d.ts"
220+
"esnext.array.d.ts"
219221
];
220222

221223
var esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {

Diff for: src/compiler/binder.ts

+128-92
Large diffs are not rendered by default.

Diff for: src/compiler/checker.ts

+633-399
Large diffs are not rendered by default.

Diff for: src/compiler/commandLineParser.ts

+17-27
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ namespace ts {
6262
category: Diagnostics.Command_line_Options,
6363
description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental
6464
},
65+
{
66+
name: "preserveWatchOutput",
67+
type: "boolean",
68+
showInSimplifiedHelpView: false,
69+
category: Diagnostics.Command_line_Options,
70+
description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen,
71+
},
6572
{
6673
name: "watch",
6774
shortName: "w",
@@ -144,9 +151,10 @@ namespace ts {
144151
"es2017.string": "lib.es2017.string.d.ts",
145152
"es2017.intl": "lib.es2017.intl.d.ts",
146153
"es2017.typedarrays": "lib.es2017.typedarrays.d.ts",
154+
"es2018.promise": "lib.es2018.promise.d.ts",
155+
"es2018.regexp": "lib.es2018.regexp.d.ts",
147156
"esnext.array": "lib.esnext.array.d.ts",
148157
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
149-
"esnext.promise": "lib.esnext.promise.d.ts",
150158
}),
151159
},
152160
showInSimplifiedHelpView: true,
@@ -1742,7 +1750,7 @@ namespace ts {
17421750
function getExtendedConfig(
17431751
sourceFile: TsConfigSourceFile,
17441752
extendedConfigPath: string,
1745-
host: ts.ParseConfigHost,
1753+
host: ParseConfigHost,
17461754
basePath: string,
17471755
resolutionStack: string[],
17481756
errors: Push<Diagnostic>,
@@ -2032,7 +2040,7 @@ namespace ts {
20322040
export function getFileNamesFromConfigSpecs(spec: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions: ReadonlyArray<JsFileExtensionInfo> = []): ExpandResult {
20332041
basePath = normalizePath(basePath);
20342042

2035-
const keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
2043+
const keyMapper = host.useCaseSensitiveFileNames ? identity : toLowerCase;
20362044

20372045
// Literal file names (provided via the "files" array in tsconfig.json) are stored in a
20382046
// file map with a possibly case insensitive key. We use this map later when when including
@@ -2119,7 +2127,7 @@ namespace ts {
21192127
}
21202128
}
21212129

2122-
function specToDiagnostic(spec: string, allowTrailingRecursion: boolean): ts.DiagnosticMessage | undefined {
2130+
function specToDiagnostic(spec: string, allowTrailingRecursion: boolean): DiagnosticMessage | undefined {
21232131
if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
21242132
return Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0;
21252133
}
@@ -2146,7 +2154,7 @@ namespace ts {
21462154
// /a/b/a?z - Watch /a/b directly to catch any new file matching a?z
21472155
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
21482156
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
2149-
const wildcardDirectories: ts.MapLike<WatchDirectoryFlags> = {};
2157+
const wildcardDirectories: MapLike<WatchDirectoryFlags> = {};
21502158
if (include !== undefined) {
21512159
const recursiveKeys: string[] = [];
21522160
for (const file of include) {
@@ -2237,31 +2245,13 @@ namespace ts {
22372245
}
22382246
}
22392247

2240-
/**
2241-
* Gets a case sensitive key.
2242-
*
2243-
* @param key The original key.
2244-
*/
2245-
function caseSensitiveKeyMapper(key: string) {
2246-
return key;
2247-
}
2248-
2249-
/**
2250-
* Gets a case insensitive key.
2251-
*
2252-
* @param key The original key.
2253-
*/
2254-
function caseInsensitiveKeyMapper(key: string) {
2255-
return key.toLowerCase();
2256-
}
2257-
22582248
/**
22592249
* Produces a cleaned version of compiler options with personally identifiying info (aka, paths) removed.
22602250
* Also converts enum values back to strings.
22612251
*/
22622252
/* @internal */
2263-
export function convertCompilerOptionsForTelemetry(opts: ts.CompilerOptions): ts.CompilerOptions {
2264-
const out: ts.CompilerOptions = {};
2253+
export function convertCompilerOptionsForTelemetry(opts: CompilerOptions): CompilerOptions {
2254+
const out: CompilerOptions = {};
22652255
for (const key in opts) {
22662256
if (opts.hasOwnProperty(key)) {
22672257
const type = getOptionFromName(key);
@@ -2285,9 +2275,9 @@ namespace ts {
22852275
return typeof value === "boolean" ? value : "";
22862276
case "list":
22872277
const elementType = (option as CommandLineOptionOfListType).element;
2288-
return ts.isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
2278+
return isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
22892279
default:
2290-
return ts.forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
2280+
return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
22912281
if (optionEnumValue === value) {
22922282
return optionStringValue;
22932283
}

Diff for: src/compiler/core.ts

+41-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ namespace ts {
2525
/* @internal */
2626
namespace ts {
2727
export const emptyArray: never[] = [] as never[];
28+
export function closeFileWatcher(watcher: FileWatcher) {
29+
watcher.close();
30+
}
31+
2832
/** Create a MapLike with good performance. */
2933
function createDictionaryObject<T>(): MapLike<T> {
3034
const map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword
@@ -1590,7 +1594,7 @@ namespace ts {
15901594
return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]);
15911595
}
15921596

1593-
export let localizedDiagnosticMessages: MapLike<string> = undefined;
1597+
export let localizedDiagnosticMessages: MapLike<string>;
15941598

15951599
export function getLocaleSpecificMessage(message: DiagnosticMessage) {
15961600
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
@@ -2539,7 +2543,6 @@ namespace ts {
25392543
path = normalizePath(path);
25402544
currentDirectory = normalizePath(currentDirectory);
25412545

2542-
const comparer = useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive;
25432546
const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
25442547

25452548
const regexFlag = useCaseSensitiveFileNames ? "" : "i";
@@ -2560,7 +2563,7 @@ namespace ts {
25602563
function visitDirectory(path: string, absolutePath: string, depth: number | undefined) {
25612564
const { files, directories } = getFileSystemEntries(path);
25622565

2563-
for (const current of sort(files, comparer)) {
2566+
for (const current of sort(files, compareStringsCaseSensitive)) {
25642567
const name = combinePaths(path, current);
25652568
const absoluteName = combinePaths(absolutePath, current);
25662569
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
@@ -2583,7 +2586,7 @@ namespace ts {
25832586
}
25842587
}
25852588

2586-
for (const current of sort(directories, comparer)) {
2589+
for (const current of sort(directories, compareStringsCaseSensitive)) {
25872590
const name = combinePaths(path, current);
25882591
const absoluteName = combinePaths(absolutePath, current);
25892592
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
@@ -2618,7 +2621,7 @@ namespace ts {
26182621
// Iterate over each include base path and include unique base paths that are not a
26192622
// subpath of an existing base path
26202623
for (const includeBasePath of includeBasePaths) {
2621-
if (ts.every(basePaths, basePath => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
2624+
if (every(basePaths, basePath => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
26222625
basePaths.push(includeBasePath);
26232626
}
26242627
}
@@ -3049,7 +3052,7 @@ namespace ts {
30493052

30503053
/** Return the object corresponding to the best pattern to match `candidate`. */
30513054
export function findBestPatternMatch<T>(values: ReadonlyArray<T>, getPattern: (value: T) => Pattern, candidate: string): T | undefined {
3052-
let matchedValue: T | undefined = undefined;
3055+
let matchedValue: T | undefined;
30533056
// use length of prefix as betterness criteria
30543057
let longestMatchPrefixLength = -1;
30553058

@@ -3147,4 +3150,36 @@ namespace ts {
31473150
export function singleElementArray<T>(t: T | undefined): T[] | undefined {
31483151
return t === undefined ? undefined : [t];
31493152
}
3153+
3154+
export function enumerateInsertsAndDeletes<T, U>(newItems: ReadonlyArray<T>, oldItems: ReadonlyArray<U>, comparer: (a: T, b: U) => Comparison, inserted: (newItem: T) => void, deleted: (oldItem: U) => void, unchanged?: (oldItem: U, newItem: T) => void) {
3155+
unchanged = unchanged || noop;
3156+
let newIndex = 0;
3157+
let oldIndex = 0;
3158+
const newLen = newItems.length;
3159+
const oldLen = oldItems.length;
3160+
while (newIndex < newLen && oldIndex < oldLen) {
3161+
const newItem = newItems[newIndex];
3162+
const oldItem = oldItems[oldIndex];
3163+
const compareResult = comparer(newItem, oldItem);
3164+
if (compareResult === Comparison.LessThan) {
3165+
inserted(newItem);
3166+
newIndex++;
3167+
}
3168+
else if (compareResult === Comparison.GreaterThan) {
3169+
deleted(oldItem);
3170+
oldIndex++;
3171+
}
3172+
else {
3173+
unchanged(oldItem, newItem);
3174+
newIndex++;
3175+
oldIndex++;
3176+
}
3177+
}
3178+
while (newIndex < newLen) {
3179+
inserted(newItems[newIndex++]);
3180+
}
3181+
while (oldIndex < oldLen) {
3182+
deleted(oldItems[oldIndex++]);
3183+
}
3184+
}
31503185
}

Diff for: src/compiler/declarationEmitter.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,12 @@ namespace ts {
608608
"?");
609609
}
610610
write(": ");
611-
emitType(node.type);
611+
if (node.type) {
612+
emitType(node.type);
613+
}
614+
else {
615+
write("any");
616+
}
612617
write(";");
613618
writeLine();
614619
decreaseIndent();

Diff for: src/compiler/diagnosticMessages.json

+39-2
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,10 @@
23172317
"category": "Error",
23182318
"code": 2723
23192319
},
2320+
"Module '{0}' has no exported member '{1}'. Did you mean '{2}'?": {
2321+
"category": "Error",
2322+
"code": 2724
2323+
},
23202324
"Import declaration '{0}' is using private name '{1}'.": {
23212325
"category": "Error",
23222326
"code": 4000
@@ -2602,7 +2606,7 @@
26022606
"code": 4083
26032607
},
26042608
"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.": {
2605-
"category": "Message",
2609+
"category": "Error",
26062610
"code": 4090
26072611
},
26082612
"Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.": {
@@ -3296,7 +3300,7 @@
32963300
"category": "Message",
32973301
"code": 6146
32983302
},
3299-
"Resolution for module '{0}' was found in cache.": {
3303+
"Resolution for module '{0}' was found in cache from location '{1}'.": {
33003304
"category": "Message",
33013305
"code": 6147
33023306
},
@@ -3472,6 +3476,14 @@
34723476
"category": "Message",
34733477
"code": 6190
34743478
},
3479+
"Whether to keep outdated console output in watch mode instead of clearing the screen.": {
3480+
"category": "Message",
3481+
"code": 6191
3482+
},
3483+
"All imports in import declaration are unused.": {
3484+
"category": "Error",
3485+
"code": 6192
3486+
},
34753487
"Variable '{0}' implicitly has an '{1}' type.": {
34763488
"category": "Error",
34773489
"code": 7005
@@ -3788,6 +3800,10 @@
37883800
"category": "Error",
37893801
"code": 17016
37903802
},
3803+
"JSX fragment is not supported when using an inline JSX factory pragma": {
3804+
"category": "Error",
3805+
"code": 17017
3806+
},
37913807

37923808
"Circularity detected while resolving configuration: {0}": {
37933809
"category": "Error",
@@ -3806,6 +3822,23 @@
38063822
"code": 18003
38073823
},
38083824

3825+
"File is a CommonJS module; it may be converted to an ES6 module.": {
3826+
"category": "Suggestion",
3827+
"code": 80001
3828+
},
3829+
"This constructor function may be converted to a class declaration.": {
3830+
"category": "Suggestion",
3831+
"code": 80002
3832+
},
3833+
"Import may be converted to a default import.": {
3834+
"category": "Suggestion",
3835+
"code": 80003
3836+
},
3837+
"JSDoc types may be moved to TypeScript types.": {
3838+
"category": "Suggestion",
3839+
"code": 80004
3840+
},
3841+
38093842
"Add missing 'super()' call": {
38103843
"category": "Message",
38113844
"code": 90001
@@ -3822,6 +3855,10 @@
38223855
"category": "Message",
38233856
"code": 90004
38243857
},
3858+
"Remove import from '{0}'": {
3859+
"category": "Message",
3860+
"code": 90005
3861+
},
38253862
"Implement interface '{0}'": {
38263863
"category": "Message",
38273864
"code": 90006

0 commit comments

Comments
 (0)