mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into conditionalTypes
This commit is contained in:
@@ -291,14 +291,13 @@ Zeeshan Ahmed <ziishaned@gmail.com>
|
||||
Orta <orta.therox+github@gmail.com> # Orta Therox
|
||||
IdeaHunter <admin@fckn.me> # @IdeaHunter
|
||||
kujon <jakub.korzeniowski@gmail.com> # Jakub Korzeniowski
|
||||
Matt <begincalendar@users.noreply.github.com> @begincalendar
|
||||
Matt <begincalendar@users.noreply.github.com> # @begincalendar
|
||||
meyer <github.com@meyer.fm> # @meyer
|
||||
micbou <contact@micbou.com> # @micbou
|
||||
Alan Agius <alan.agius4@gmail.com>
|
||||
Alex Khomchenko <akhomchenko@gmail.com>
|
||||
Oussama Ben Brahim <benbraou@gmail.com> benbraou <benbraou@users.noreply.github.com>
|
||||
Cameron Taggart <cameron.taggart@gmail.com>
|
||||
csigs <csigs@outlook.com> csigs <csigs@users.noreply.github.com>
|
||||
Eugene Timokhov <timocov@gmail.com>
|
||||
Kris Zyp <kriszyp@gmail.com>
|
||||
Jing Ma <mjingm87@qq.com>
|
||||
@@ -312,4 +311,9 @@ Stanislav Iliev <gigobest2@gmail.com>
|
||||
Wenlu Wang <805037171@163.com> wenlu.wang <805037171@163.com> kingwl <805037171@163.com>
|
||||
Wilson Hobbs <wilsonhobbs1@gmail.com>
|
||||
Yuval Greenfield <ubershmekel@gmail.com>
|
||||
Daniel <nieltg@users.noreply.github.com> # @nieltg
|
||||
Daniel <nieltg@users.noreply.github.com> # @nieltg
|
||||
Adnan Chowdhury <bttf@users.noreply.github.com>
|
||||
Esakki Raj <esakkiraj.tce@gmail.com>
|
||||
Jack Williams <jw@jackw.io>
|
||||
Philippe Voinov <philippevoinov@gmail.com>
|
||||
Stephan Ginthör <26004708+Lazarus535@users.noreply.github.com>
|
||||
+6
-2
@@ -3,6 +3,7 @@ TypeScript is authored by:
|
||||
* Abubaker Bashir
|
||||
* Adam Freidin
|
||||
* Adi Dahiya
|
||||
* Adnan Chowdhury
|
||||
* Adrian Leonhard
|
||||
* Ahmad Farid
|
||||
* Akshar Patel
|
||||
@@ -36,6 +37,7 @@ TypeScript is authored by:
|
||||
* Asad Saeeduddin
|
||||
* Avery Morin
|
||||
* Basarat Ali Syed
|
||||
* @begincalendar
|
||||
* Ben Duffield
|
||||
* Ben Mosher
|
||||
* Benjamin Bock
|
||||
@@ -59,7 +61,6 @@ TypeScript is authored by:
|
||||
* Colby Russell
|
||||
* Colin Snover
|
||||
* Cotton Hou
|
||||
* csigs
|
||||
* Cyrus Najmabadi
|
||||
* Dafrok Zhang
|
||||
* Dahan Gong
|
||||
@@ -87,6 +88,7 @@ TypeScript is authored by:
|
||||
* Eric Tsang
|
||||
* Erik Edrosa
|
||||
* Erik McClenney
|
||||
* Esakki Raj
|
||||
* Ethan Resnick
|
||||
* Ethan Rubio
|
||||
* Eugene Timokhov
|
||||
@@ -124,6 +126,7 @@ TypeScript is authored by:
|
||||
* Ivan Enderlin
|
||||
* Ivo Gabe de Wolff
|
||||
* Iwata Hidetaka
|
||||
* Jack Williams
|
||||
* Jakub Korzeniowski
|
||||
* Jakub Młokosiewicz
|
||||
* James Henry
|
||||
@@ -182,7 +185,6 @@ TypeScript is authored by:
|
||||
* Martin Hiller
|
||||
* Martin Vseticka
|
||||
* Masahiro Wakame
|
||||
* Matt
|
||||
* Matt Bierner
|
||||
* Matt McCutchen
|
||||
* Matt Mitchell
|
||||
@@ -224,6 +226,7 @@ TypeScript is authored by:
|
||||
* Perry Jiang
|
||||
* Peter Burns
|
||||
* Philip Bulley
|
||||
* Philippe Voinov
|
||||
* Piero Cangianiello
|
||||
* @piloopin
|
||||
* Prayag Verma
|
||||
@@ -261,6 +264,7 @@ TypeScript is authored by:
|
||||
* Stanislav Iliev
|
||||
* Stanislav Sysoev
|
||||
* Stas Vilchik
|
||||
* Stephan Ginthör
|
||||
* Steve Lucco
|
||||
* Sudheesh Singanamalla
|
||||
* Sébastien Arod
|
||||
|
||||
+1
-1
@@ -1115,7 +1115,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
|
||||
const fileMatcher = cmdLineOptions.files;
|
||||
const files = fileMatcher
|
||||
? `src/**/${fileMatcher}`
|
||||
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
|
||||
: `Gulpfile.ts "scripts/generateLocalizedDiagnosticMessages.ts" "scripts/tslint/**/*.ts" "src/**/*.ts" --exclude "src/lib/*.d.ts"`;
|
||||
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
|
||||
console.log("Linting: " + cmd);
|
||||
child_process.execSync(cmd, { stdio: [0, 1, 2] });
|
||||
|
||||
+26
-8
@@ -8449,11 +8449,18 @@ namespace ts {
|
||||
|
||||
function instantiateList<T>(items: T[], mapper: TypeMapper, instantiator: (item: T, mapper: TypeMapper) => T): T[] {
|
||||
if (items && items.length) {
|
||||
const result: T[] = [];
|
||||
for (const v of items) {
|
||||
result.push(instantiator(v, mapper));
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
const mapped = instantiator(item, mapper);
|
||||
if (item !== mapped) {
|
||||
const result = i === 0 ? [] : items.slice(0, i);
|
||||
result.push(mapped);
|
||||
for (i++; i < items.length; i++) {
|
||||
result.push(instantiator(items[i], mapper));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
@@ -8583,8 +8590,13 @@ namespace ts {
|
||||
}
|
||||
|
||||
function instantiateSymbol(symbol: Symbol, mapper: TypeMapper): Symbol {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (links.type && !maybeTypeOfKind(links.type, TypeFlags.Object | TypeFlags.TypeVariable | TypeFlags.Index)) {
|
||||
// If the type of the symbol is already resolved, and if that type could not possibly
|
||||
// be affected by instantiation, simply return the symbol itself.
|
||||
return symbol;
|
||||
}
|
||||
if (getCheckFlags(symbol) & CheckFlags.Instantiated) {
|
||||
const links = getSymbolLinks(symbol);
|
||||
// If symbol being instantiated is itself a instantiation, fetch the original target and combine the
|
||||
// type mappers. This ensures that original type identities are properly preserved and that aliases
|
||||
// always reference a non-aliases.
|
||||
@@ -8748,14 +8760,20 @@ namespace ts {
|
||||
return getAnonymousTypeInstantiation(<MappedType>type, mapper);
|
||||
}
|
||||
if ((<ObjectType>type).objectFlags & ObjectFlags.Reference) {
|
||||
return createTypeReference((<TypeReference>type).target, instantiateTypes((<TypeReference>type).typeArguments, mapper));
|
||||
const typeArguments = (<TypeReference>type).typeArguments;
|
||||
const newTypeArguments = instantiateTypes(typeArguments, mapper);
|
||||
return newTypeArguments !== typeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
|
||||
}
|
||||
}
|
||||
if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Primitive)) {
|
||||
return getUnionType(instantiateTypes((<UnionType>type).types, mapper), UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
|
||||
const types = (<UnionType>type).types;
|
||||
const newTypes = instantiateTypes(types, mapper);
|
||||
return newTypes !== types ? getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
|
||||
}
|
||||
if (type.flags & TypeFlags.Intersection) {
|
||||
return getIntersectionType(instantiateTypes((<IntersectionType>type).types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
|
||||
const types = (<IntersectionType>type).types;
|
||||
const newTypes = instantiateTypes(types, mapper);
|
||||
return newTypes !== types ? getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
|
||||
}
|
||||
if (type.flags & TypeFlags.Index) {
|
||||
return getIndexType(instantiateType((<IndexType>type).type, mapper));
|
||||
|
||||
+24
-3
@@ -2363,9 +2363,30 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
return forEachEmittedFile(getEmitHost(), ({ jsFilePath, declarationFilePath }) =>
|
||||
isSameFile(jsFilePath, file) ||
|
||||
(declarationFilePath && isSameFile(declarationFilePath, file)));
|
||||
// If this is source file, its not emitted file
|
||||
const filePath = toPath(file);
|
||||
if (getSourceFileByPath(filePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If options have --outFile or --out just check that
|
||||
const out = options.outFile || options.out;
|
||||
if (out) {
|
||||
return isSameFile(filePath, out) || isSameFile(filePath, removeFileExtension(out) + Extension.Dts);
|
||||
}
|
||||
|
||||
// If --outDir, check if file is in that directory
|
||||
if (options.outDir) {
|
||||
return containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
||||
}
|
||||
|
||||
if (fileExtensionIsOneOf(filePath, supportedJavascriptExtensions) || fileExtensionIs(filePath, Extension.Dts)) {
|
||||
// Otherwise just check if sourceFile with the name exists
|
||||
const filePathWithoutExtension = removeFileExtension(filePath);
|
||||
return !!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Ts) as Path) ||
|
||||
!!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Tsx) as Path);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSameFile(file1: string, file2: string) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<Cmt Name="LcxAdmin" />
|
||||
<Cmt Name="Loc" />
|
||||
<Cmt Name="Note" />
|
||||
<Cmt Name="RCCX" />
|
||||
<Cmt Name="Rccx" />
|
||||
</OwnedComments>
|
||||
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
|
||||
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
|
||||
@@ -5103,6 +5103,15 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[仅发出 ".d.ts" 声明文件。 ]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<Cmt Name="ManifestData" />
|
||||
<Cmt Name="Mnemonic" />
|
||||
<Cmt Name="Note" />
|
||||
<Cmt Name="RCCX" />
|
||||
<Cmt Name="Rccx" />
|
||||
<Cmt Name="UIType" />
|
||||
<Cmt Name="UTSData" />
|
||||
<Cmt Name="UTSUI" />
|
||||
@@ -5112,6 +5112,15 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Émettez uniquement les fichiers de déclaration '.d.ts'.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
|
||||
@@ -8656,7 +8665,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Les déclarations 'enum' peuvent uniquement être utilisées dans un fichier .ts.]]></Val>
|
||||
<Val><![CDATA['Les déclarations enum' peuvent uniquement être utilisées dans un fichier .ts.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<Cmt Name="LcxAdmin" />
|
||||
<Cmt Name="Loc" />
|
||||
<Cmt Name="Note" />
|
||||
<Cmt Name="RCCX" />
|
||||
<Cmt Name="Rccx" />
|
||||
</OwnedComments>
|
||||
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
|
||||
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
|
||||
@@ -5103,6 +5103,15 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Crea solo i file di dichiarazione '.d.ts'.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
|
||||
@@ -8647,7 +8656,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA['enum declarations' può essere usato solo in un file con estensione ts.]]></Val>
|
||||
<Val><![CDATA[Le dichiarazioni 'enum' possono essere usate solo in un file con estensione ts.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace ts.server {
|
||||
const os: {
|
||||
homedir?(): string;
|
||||
tmpdir(): string;
|
||||
platform(): string;
|
||||
} = require("os");
|
||||
|
||||
interface NodeSocket {
|
||||
@@ -824,8 +825,9 @@ namespace ts.server {
|
||||
const logger = createLogger();
|
||||
|
||||
const sys = <ServerHost>ts.sys;
|
||||
const nodeVersion = getNodeMajorVersion();
|
||||
// use watchGuard process on Windows when node version is 4 or later
|
||||
const useWatchGuard = process.platform === "win32" && getNodeMajorVersion() >= 4;
|
||||
const useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
|
||||
const originalWatchDirectory: ServerHost["watchDirectory"] = sys.watchDirectory.bind(sys);
|
||||
const noopWatcher: FileWatcher = { close: noop };
|
||||
// This is the function that catches the exceptions when watching directory, and yet lets project service continue to function
|
||||
@@ -980,8 +982,9 @@ namespace ts.server {
|
||||
};
|
||||
|
||||
logger.info(`Starting TS Server`);
|
||||
logger.info(`Version: ${versionMajorMinor}`);
|
||||
logger.info(`Version: ${version}`);
|
||||
logger.info(`Arguments: ${process.argv.join(" ")}`);
|
||||
logger.info(`Platform: ${os.platform()} NodeVersion: ${nodeVersion} CaseSensitive: ${sys.useCaseSensitiveFileNames}`);
|
||||
|
||||
const ioSession = new IOSession(options);
|
||||
process.on("uncaughtException", err => {
|
||||
|
||||
Reference in New Issue
Block a user