Skip to content

Commit b11c4be

Browse files
committed
Merge from master.
2 parents cf55087 + 9a62db2 commit b11c4be

File tree

688 files changed

+7819
-4062
lines changed

Some content is hidden

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

688 files changed

+7819
-4062
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6920,7 +6920,7 @@ namespace ts {
69206920
// subtype of T but not structurally identical to T. This specifically means that two distinct but
69216921
// structurally identical types (such as two classes) are not considered instances of each other.
69226922
function isTypeInstanceOf(source: Type, target: Type): boolean {
6923-
return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target);
6923+
return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target);
69246924
}
69256925

69266926
/**

src/compiler/transformers/es2015.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3627,10 +3627,15 @@ namespace ts {
36273627
scoped: false,
36283628
priority: 0,
36293629
text: `
3630-
var __extends = (this && this.__extends) || function (d, b) {
3631-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3632-
function __() { this.constructor = d; }
3633-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3634-
};`
3630+
var __extends = (this && this.__extends) || (function () {
3631+
var extendStatics = Object.setPrototypeOf ||
3632+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3633+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3634+
return function (d, b) {
3635+
extendStatics(d, b);
3636+
function __() { this.constructor = d; }
3637+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3638+
};
3639+
})();`
36353640
};
36363641
}

src/compiler/transformers/jsx.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ namespace ts {
150150
return decoded ? createLiteral(decoded, /*location*/ node) : node;
151151
}
152152
else if (node.kind === SyntaxKind.JsxExpression) {
153+
if (node.expression === undefined) {
154+
return createLiteral(true);
155+
}
153156
return visitJsxExpression(<JsxExpression>node);
154157
}
155158
else {

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ namespace ts {
15501550
name?: Identifier;
15511551
}
15521552

1553-
export type BlockLike = SourceFile | Block | ModuleBlock | CaseClause;
1553+
export type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause;
15541554

15551555
export interface Block extends Statement {
15561556
kind: SyntaxKind.Block;

src/harness/fourslash.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,23 +262,12 @@ namespace FourSlash {
262262
// Initialize the language service with all the scripts
263263
let startResolveFileRef: FourSlashFile;
264264

265+
let configFileName: string;
265266
ts.forEach(testData.files, file => {
266267
// Create map between fileName and its content for easily looking up when resolveReference flag is specified
267268
this.inputFiles[file.fileName] = file.content;
268-
269269
if (ts.getBaseFileName(file.fileName).toLowerCase() === "tsconfig.json") {
270-
const configJson = ts.parseConfigFileTextToJson(file.fileName, file.content);
271-
assert.isTrue(configJson.config !== undefined);
272-
273-
// Extend our existing compiler options so that we can also support tsconfig only options
274-
if (configJson.config.compilerOptions) {
275-
const baseDirectory = ts.normalizePath(ts.getDirectoryPath(file.fileName));
276-
const tsConfig = ts.convertCompilerOptionsFromJson(configJson.config.compilerOptions, baseDirectory, file.fileName);
277-
278-
if (!tsConfig.errors || !tsConfig.errors.length) {
279-
compilationOptions = ts.extend(compilationOptions, tsConfig.options);
280-
}
281-
}
270+
configFileName = file.fileName;
282271
}
283272

284273
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") {
@@ -290,6 +279,21 @@ namespace FourSlash {
290279
}
291280
});
292281

282+
if (configFileName) {
283+
const baseDir = ts.normalizePath(ts.getDirectoryPath(configFileName));
284+
const host = new Utils.MockParseConfigHost(baseDir, /*ignoreCase*/ false, this.inputFiles);
285+
286+
const configJsonObj = ts.parseConfigFileTextToJson(configFileName, this.inputFiles[configFileName]);
287+
assert.isTrue(configJsonObj.config !== undefined);
288+
289+
const { options, errors } = ts.parseJsonConfigFileContent(configJsonObj.config, host, baseDir);
290+
291+
// Extend our existing compiler options so that we can also support tsconfig only options
292+
if (!errors || errors.length === 0) {
293+
compilationOptions = ts.extend(compilationOptions, options);
294+
}
295+
}
296+
293297

294298
if (compilationOptions.typeRoots) {
295299
compilationOptions.typeRoots = compilationOptions.typeRoots.map(p => ts.getNormalizedAbsolutePath(p, this.basePath));

src/services/codefixes/importFixes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ namespace ts.codefix {
443443
return undefined;
444444
}
445445

446+
const relativeNameWithIndex = removeFileExtension(relativeName);
446447
relativeName = removeExtensionAndIndexPostFix(relativeName);
447448

448449
if (options.paths) {
@@ -462,7 +463,7 @@ namespace ts.codefix {
462463
return key.replace("\*", matchedStar);
463464
}
464465
}
465-
else if (pattern === relativeName) {
466+
else if (pattern === relativeName || pattern === relativeNameWithIndex) {
466467
return key;
467468
}
468469
}

tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ module A {
2121

2222

2323
//// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js]
24-
var __extends = (this && this.__extends) || function (d, b) {
25-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
26-
function __() { this.constructor = d; }
27-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28-
};
24+
var __extends = (this && this.__extends) || (function () {
25+
var extendStatics = Object.setPrototypeOf ||
26+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
28+
return function (d, b) {
29+
extendStatics(d, b);
30+
function __() { this.constructor = d; }
31+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32+
};
33+
})();
2934
var A;
3035
(function (A) {
3136
var Point = (function () {

tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ module A {
2525

2626

2727
//// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js]
28-
var __extends = (this && this.__extends) || function (d, b) {
29-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
30-
function __() { this.constructor = d; }
31-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32-
};
28+
var __extends = (this && this.__extends) || (function () {
29+
var extendStatics = Object.setPrototypeOf ||
30+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32+
return function (d, b) {
33+
extendStatics(d, b);
34+
function __() { this.constructor = d; }
35+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36+
};
37+
})();
3338
var A;
3439
(function (A) {
3540
var Point = (function () {

tests/baselines/reference/abstractClassInLocalScope.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88

99

1010
//// [abstractClassInLocalScope.js]
11-
var __extends = (this && this.__extends) || function (d, b) {
12-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
13-
function __() { this.constructor = d; }
14-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15-
};
11+
var __extends = (this && this.__extends) || (function () {
12+
var extendStatics = Object.setPrototypeOf ||
13+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
15+
return function (d, b) {
16+
extendStatics(d, b);
17+
function __() { this.constructor = d; }
18+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19+
};
20+
})();
1621
(function () {
1722
var A = (function () {
1823
function A() {

tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88

99

1010
//// [abstractClassInLocalScopeIsAbstract.js]
11-
var __extends = (this && this.__extends) || function (d, b) {
12-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
13-
function __() { this.constructor = d; }
14-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15-
};
11+
var __extends = (this && this.__extends) || (function () {
12+
var extendStatics = Object.setPrototypeOf ||
13+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
15+
return function (d, b) {
16+
extendStatics(d, b);
17+
function __() { this.constructor = d; }
18+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19+
};
20+
})();
1621
(function () {
1722
var A = (function () {
1823
function A() {

0 commit comments

Comments
 (0)