Skip to content

Commit 6bb62d6

Browse files
committed
Merge remote-tracking branch 'upstream/master' into javaScriptPrototypes
2 parents fabc43d + 0ab538f commit 6bb62d6

191 files changed

Lines changed: 20505 additions & 380 deletions

File tree

Some content is hidden

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

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ Your pull request should:
3636

3737
The library sources are in: [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib)
3838

39-
To build the library files, run
39+
Library files in `built/local/` are updated by running
4040
```Shell
41-
jake lib
41+
jake
4242
```
4343

44+
The files in `lib/` are used to bootstrap compilation and usually do not need to be updated.
45+
4446
#### `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts`
4547

4648
These two files represent the DOM typings and are auto-generated. To make any modifications to them, please submit a PR to https://github.com/Microsoft/TSJS-lib-generator

Jakefile.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ var scriptSources = [
113113
"tslint/nextLineRule.ts",
114114
"tslint/noNullRule.ts",
115115
"tslint/preferConstRule.ts",
116-
"tslint/typeOperatorSpacingRule.ts"
116+
"tslint/typeOperatorSpacingRule.ts",
117+
"tslint/noInOperatorRule.ts"
117118
].map(function (f) {
118119
return path.join(scriptsDirectory, f);
119120
});
@@ -875,7 +876,8 @@ var tslintRules = ([
875876
"noNullRule",
876877
"preferConstRule",
877878
"booleanTriviaRule",
878-
"typeOperatorSpacingRule"
879+
"typeOperatorSpacingRule",
880+
"noInOperatorRule"
879881
]);
880882
var tslintRulesFiles = tslintRules.map(function(p) {
881883
return path.join(tslintRuleDir, p + ".ts");
@@ -926,13 +928,17 @@ var lintTargets = compilerSources
926928
desc("Runs tslint on the compiler sources");
927929
task("lint", ["build-rules"], function() {
928930
var lintOptions = getLinterOptions();
931+
var failed = 0;
929932
for (var i in lintTargets) {
930933
var result = lintFile(lintOptions, lintTargets[i]);
931934
if (result.failureCount > 0) {
932935
console.log(result.output);
933-
fail('Linter errors.', result.failureCount);
936+
failed += result.failureCount;
934937
}
935938
}
939+
if (failed > 0) {
940+
fail('Linter errors.', failed);
941+
}
936942
});
937943

938944
/**
-662 Bytes
Binary file not shown.
936 Bytes
Binary file not shown.

doc/spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ x = "hello"; // Ok
13231323
x = 42; // Ok
13241324
x = test; // Error, boolean not assignable
13251325
x = test ? 5 : "five"; // Ok
1326-
x = test ? 0 : false; // Error, number | boolean not asssignable
1326+
x = test ? 0 : false; // Error, number | boolean not assignable
13271327
```
13281328

13291329
it is possible to assign 'x' a value of type `string`, `number`, or the union type `string | number`, but not any other type. To access a value in 'x', a type guard can be used to first narrow the type of 'x' to either `string` or `number`:

lib/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Read this!
22

33
These files are not meant to be edited by hand.
4-
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory.
4+
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. Running `jake LKG` will then appropriately update the files in this directory.

scripts/tslint/noInOperatorRule.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as Lint from "tslint/lib/lint";
2+
import * as ts from "typescript";
3+
4+
5+
export class Rule extends Lint.Rules.AbstractRule {
6+
public static FAILURE_STRING = "Don't use the 'in' keyword - use 'hasProperty' to check for key presence instead";
7+
8+
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
9+
return this.applyWithWalker(new InWalker(sourceFile, this.getOptions()));
10+
}
11+
}
12+
13+
class InWalker extends Lint.RuleWalker {
14+
visitNode(node: ts.Node) {
15+
super.visitNode(node);
16+
if (node.kind === ts.SyntaxKind.InKeyword && node.parent && node.parent.kind === ts.SyntaxKind.BinaryExpression) {
17+
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
18+
}
19+
}
20+
}

src/compiler/checker.ts

Lines changed: 120 additions & 96 deletions
Large diffs are not rendered by default.

src/compiler/declarationEmitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ namespace ts {
16751675
/* @internal */
16761676
export function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection) {
16771677
const emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit);
1678-
const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath);
1678+
const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit;
16791679
if (!emitSkipped) {
16801680
const declarationOutput = emitDeclarationResult.referencePathsOutput
16811681
+ getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,10 @@
17321732
"category": "Error",
17331733
"code": 2657
17341734
},
1735+
"Type '{0}' provides no match for the signature '{1}'": {
1736+
"category": "Error",
1737+
"code": 2658
1738+
},
17351739
"Import declaration '{0}' is using private name '{1}'.": {
17361740
"category": "Error",
17371741
"code": 4000

0 commit comments

Comments
 (0)