Skip to content

Commit 8ff551c

Browse files
committed
merge with master
2 parents 04b0aa2 + 7b48a18 commit 8ff551c

File tree

198 files changed

+5376
-3032
lines changed

Some content is hidden

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

198 files changed

+5376
-3032
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ tests/services/baselines/local/*
2121
tests/baselines/prototyping/local/*
2222
tests/baselines/rwc/*
2323
tests/baselines/test262/*
24-
tests/baselines/reference/projectOutput/*
24+
tests/baselines/reference/projectOutput/*
2525
tests/baselines/local/projectOutput/*
2626
tests/services/baselines/prototyping/local/*
2727
tests/services/browser/typescriptServices.js
2828
scripts/configureNightly.js
2929
scripts/processDiagnosticMessages.d.ts
3030
scripts/processDiagnosticMessages.js
31-
scripts/importDefinitelyTypedTests.js
31+
scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js
3232
src/harness/*.js
33+
src/compiler/diagnosticInformationMap.generated.ts
3334
rwc-report.html
3435
*.swp
3536
build.json
@@ -45,6 +46,7 @@ scripts/run.bat
4546
scripts/word2md.js
4647
scripts/ior.js
4748
scripts/*.js.map
49+
scripts/typings/
4850
coverage/
4951
internal/
5052
**/.DS_Store

Jakefile.js

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ function concatenateFiles(destinationFile, sourceFiles) {
206206
var useDebugMode = true;
207207
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
208208
var compilerFilename = "tsc.js";
209+
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
210+
var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
211+
209212
/* Compiles a file from a list of sources
210213
* @param outFile: the target file name
211214
* @param sources: an array of the names of the source files
@@ -220,7 +223,7 @@ var compilerFilename = "tsc.js";
220223
*/
221224
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
222225
file(outFile, prereqs, function() {
223-
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
226+
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
224227
var options = "--module commonjs --noImplicitAny --noEmitOnError";
225228

226229
// Keep comments when specifically requested
@@ -257,7 +260,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
257260
options += " --stripInternal"
258261
}
259262

260-
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
263+
var cmd = host + " " + compilerPath + " " + options + " ";
261264
cmd = cmd + sources.join(" ");
262265
console.log(cmd + "\n");
263266

@@ -328,7 +331,7 @@ compileFile(processDiagnosticMessagesJs,
328331

329332
// The generated diagnostics map; built for the compiler and for the 'generate-diagnostics' task
330333
file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson], function () {
331-
var cmd = "node " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson;
334+
var cmd = host + " " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson;
332335
console.log(cmd);
333336
var ex = jake.createExec([cmd]);
334337
// Add listeners for output and error
@@ -374,7 +377,7 @@ task("setDebugMode", function() {
374377
});
375378

376379
task("configure-nightly", [configureNightlyJs], function() {
377-
var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs;
380+
var cmd = host + " " + configureNightlyJs + " " + packageJson + " " + programTs;
378381
console.log(cmd);
379382
exec(cmd);
380383
}, { async: true });
@@ -386,6 +389,32 @@ task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "r
386389
exec(cmd);
387390
});
388391

392+
var scriptsTsdJson = path.join(scriptsDirectory, "tsd.json");
393+
file(scriptsTsdJson);
394+
395+
task("tsd-scripts", [scriptsTsdJson], function () {
396+
var cmd = "tsd --config " + scriptsTsdJson + " install";
397+
console.log(cmd)
398+
exec(cmd);
399+
}, { async: true })
400+
401+
var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests");
402+
var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js");
403+
var importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts");
404+
405+
file(importDefinitelyTypedTestsTs);
406+
file(importDefinitelyTypedTestsJs, ["tsd-scripts", importDefinitelyTypedTestsTs], function () {
407+
var cmd = host + " " + LKGCompiler + " -p " + importDefinitelyTypedTestsDirectory;
408+
console.log(cmd);
409+
exec(cmd);
410+
}, { async: true });
411+
412+
task("importDefinitelyTypedTests", [importDefinitelyTypedTestsJs], function () {
413+
var cmd = host + " " + importDefinitelyTypedTestsJs + " ./ ../DefinitelyTyped";
414+
console.log(cmd);
415+
exec(cmd);
416+
}, { async: true });
417+
389418
// Local target to build the compiler and services
390419
var tscFile = path.join(builtLocalDirectory, compilerFilename);
391420
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
@@ -394,6 +423,7 @@ var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
394423
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
395424
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
396425
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
426+
var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts");
397427

398428
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
399429
/*prefixes*/ [copyright],
@@ -410,11 +440,19 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
410440

411441
prependFile(copyright, standaloneDefinitionsFile);
412442

413-
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
443+
// Stanalone/web definition file using global 'ts' namespace
414444
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
415445
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
416-
definitionFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
417-
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
446+
447+
// Official node package definition file, pointed to by 'typings' in package.json
448+
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
449+
var nodeDefinitionsFileContents = definitionFileContents + "\r\nexport = ts;";
450+
fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents);
451+
452+
// Node package definition file to be distributed without the package. Created by replacing
453+
// 'ts' namespace with '"typescript"' as a module.
454+
var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
455+
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
418456
});
419457

420458

@@ -771,17 +809,36 @@ task("update-sublime", ["local", serverFile], function() {
771809
jake.cpR(serverFile + ".map", "../TypeScript-Sublime-Plugin/tsserver/");
772810
});
773811

812+
var tslintRuleDir = "scripts/tslint";
813+
var tslintRules = ([
814+
"nextLineRule",
815+
"noInferrableTypesRule",
816+
"noNullRule",
817+
"booleanTriviaRule"
818+
]);
819+
var tslintRulesFiles = tslintRules.map(function(p) {
820+
return path.join(tslintRuleDir, p + ".ts");
821+
});
822+
var tslintRulesOutFiles = tslintRules.map(function(p) {
823+
return path.join(builtLocalDirectory, "tslint", p + ".js");
824+
});
825+
desc("Compiles tslint rules to js");
826+
task("build-rules", tslintRulesOutFiles);
827+
tslintRulesFiles.forEach(function(ruleFile, i) {
828+
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ true, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
829+
});
830+
774831
// if the codebase were free of linter errors we could make jake runtests
775832
// run this task automatically
776833
desc("Runs tslint on the compiler sources");
777-
task("lint", [], function() {
834+
task("lint", ["build-rules"], function() {
778835
function success(f) { return function() { console.log('SUCCESS: No linter errors in ' + f + '\n'); }};
779836
function failure(f) { return function() { console.log('FAILURE: Please fix linting errors in ' + f + '\n') }};
780837

781838
var lintTargets = compilerSources.concat(harnessCoreSources);
782839
for (var i in lintTargets) {
783840
var f = lintTargets[i];
784-
var cmd = 'tslint -c tslint.json ' + f;
841+
var cmd = 'tslint --rules-dir built/local/tslint -c tslint.json ' + f;
785842
exec(cmd, success(f), failure(f));
786843
}
787844
}, { async: true });

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
3030
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
3131
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
3232
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
33-
* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)).
33+
* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true), [pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)).
3434

3535

3636
## Documentation

lib/lib.core.es6.d.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3965,7 +3965,34 @@ interface ObjectConstructor {
39653965
* Copy the values of all of the enumerable own properties from one or more source objects to a
39663966
* target object. Returns the target object.
39673967
* @param target The target object to copy to.
3968-
* @param sources One or more source objects to copy properties from.
3968+
* @param source The source object from which to copy properties.
3969+
*/
3970+
assign<T, U>(target: T, source: U): T & U;
3971+
3972+
/**
3973+
* Copy the values of all of the enumerable own properties from one or more source objects to a
3974+
* target object. Returns the target object.
3975+
* @param target The target object to copy to.
3976+
* @param source1 The first source object from which to copy properties.
3977+
* @param source2 The second source object from which to copy properties.
3978+
*/
3979+
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
3980+
3981+
/**
3982+
* Copy the values of all of the enumerable own properties from one or more source objects to a
3983+
* target object. Returns the target object.
3984+
* @param target The target object to copy to.
3985+
* @param source1 The first source object from which to copy properties.
3986+
* @param source2 The second source object from which to copy properties.
3987+
* @param source3 The third source object from which to copy properties.
3988+
*/
3989+
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
3990+
3991+
/**
3992+
* Copy the values of all of the enumerable own properties from one or more source objects to a
3993+
* target object. Returns the target object.
3994+
* @param target The target object to copy to.
3995+
* @param sources One or more source objects from which to copy properties
39693996
*/
39703997
assign(target: any, ...sources: any[]): any;
39713998

lib/lib.d.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3881,7 +3881,7 @@ declare module Intl {
38813881
currency?: string;
38823882
currencyDisplay?: string;
38833883
useGrouping?: boolean;
3884-
minimumintegerDigits?: number;
3884+
minimumIntegerDigits?: number;
38853885
minimumFractionDigits?: number;
38863886
maximumFractionDigits?: number;
38873887
minimumSignificantDigits?: number;
@@ -3894,7 +3894,7 @@ declare module Intl {
38943894
style: string;
38953895
currency?: string;
38963896
currencyDisplay?: string;
3897-
minimumintegerDigits: number;
3897+
minimumIntegerDigits: number;
38983898
minimumFractionDigits: number;
38993899
maximumFractionDigits: number;
39003900
minimumSignificantDigits?: number;
@@ -3928,6 +3928,7 @@ declare module Intl {
39283928
timeZoneName?: string;
39293929
formatMatcher?: string;
39303930
hour12?: boolean;
3931+
timeZone?: string;
39313932
}
39323933

39333934
interface ResolvedDateTimeFormatOptions {
@@ -3997,18 +3998,45 @@ interface Number {
39973998

39983999
interface Date {
39994000
/**
4000-
* Converts a date to a string by using the current or specified locale.
4001+
* Converts a date and time to a string by using the current or specified locale.
40014002
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
40024003
* @param options An object that contains one or more properties that specify comparison options.
40034004
*/
40044005
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
4005-
40064006
/**
40074007
* Converts a date to a string by using the current or specified locale.
4008+
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
4009+
* @param options An object that contains one or more properties that specify comparison options.
4010+
*/
4011+
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
4012+
4013+
/**
4014+
* Converts a time to a string by using the current or specified locale.
4015+
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
4016+
* @param options An object that contains one or more properties that specify comparison options.
4017+
*/
4018+
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
4019+
4020+
/**
4021+
* Converts a date and time to a string by using the current or specified locale.
40084022
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
40094023
* @param options An object that contains one or more properties that specify comparison options.
40104024
*/
40114025
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
4026+
4027+
/**
4028+
* Converts a date to a string by using the current or specified locale.
4029+
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
4030+
* @param options An object that contains one or more properties that specify comparison options.
4031+
*/
4032+
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
4033+
4034+
/**
4035+
* Converts a time to a string by using the current or specified locale.
4036+
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
4037+
* @param options An object that contains one or more properties that specify comparison options.
4038+
*/
4039+
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
40124040
}
40134041

40144042

lib/lib.dom.d.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ declare module Intl {
5757
currency?: string;
5858
currencyDisplay?: string;
5959
useGrouping?: boolean;
60-
minimumintegerDigits?: number;
60+
minimumIntegerDigits?: number;
6161
minimumFractionDigits?: number;
6262
maximumFractionDigits?: number;
6363
minimumSignificantDigits?: number;
@@ -70,7 +70,7 @@ declare module Intl {
7070
style: string;
7171
currency?: string;
7272
currencyDisplay?: string;
73-
minimumintegerDigits: number;
73+
minimumIntegerDigits: number;
7474
minimumFractionDigits: number;
7575
maximumFractionDigits: number;
7676
minimumSignificantDigits?: number;
@@ -104,6 +104,7 @@ declare module Intl {
104104
timeZoneName?: string;
105105
formatMatcher?: string;
106106
hour12?: boolean;
107+
timeZone?: string;
107108
}
108109

109110
interface ResolvedDateTimeFormatOptions {
@@ -173,18 +174,45 @@ interface Number {
173174

174175
interface Date {
175176
/**
176-
* Converts a date to a string by using the current or specified locale.
177+
* Converts a date and time to a string by using the current or specified locale.
177178
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
178179
* @param options An object that contains one or more properties that specify comparison options.
179180
*/
180181
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
181-
182182
/**
183183
* Converts a date to a string by using the current or specified locale.
184+
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
185+
* @param options An object that contains one or more properties that specify comparison options.
186+
*/
187+
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
188+
189+
/**
190+
* Converts a time to a string by using the current or specified locale.
191+
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
192+
* @param options An object that contains one or more properties that specify comparison options.
193+
*/
194+
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
195+
196+
/**
197+
* Converts a date and time to a string by using the current or specified locale.
184198
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
185199
* @param options An object that contains one or more properties that specify comparison options.
186200
*/
187201
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
202+
203+
/**
204+
* Converts a date to a string by using the current or specified locale.
205+
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
206+
* @param options An object that contains one or more properties that specify comparison options.
207+
*/
208+
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
209+
210+
/**
211+
* Converts a time to a string by using the current or specified locale.
212+
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
213+
* @param options An object that contains one or more properties that specify comparison options.
214+
*/
215+
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
188216
}
189217

190218

0 commit comments

Comments
 (0)