mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript into generators
This commit is contained in:
+22
-16
@@ -13005,15 +13005,30 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (!prototypeProperty) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
}
|
||||
}
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
else if (rightType.flags & 32768) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -23260,15 +23275,6 @@ var ts;
|
||||
scopeEmitEnd();
|
||||
if (thisNodeIsDecorated) {
|
||||
write(";");
|
||||
if (node.name) {
|
||||
writeLine();
|
||||
write("Object.defineProperty(");
|
||||
emitDeclarationName(node);
|
||||
write(", \"name\", { value: \"");
|
||||
emitDeclarationName(node);
|
||||
write("\", configurable: true });");
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
if (isClassExpressionWithStaticProperties) {
|
||||
for (var _a = 0; _a < staticProperties.length; _a++) {
|
||||
|
||||
+22
-16
@@ -13389,15 +13389,30 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (!prototypeProperty) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
}
|
||||
}
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
else if (rightType.flags & 32768) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -23644,15 +23659,6 @@ var ts;
|
||||
scopeEmitEnd();
|
||||
if (thisNodeIsDecorated) {
|
||||
write(";");
|
||||
if (node.name) {
|
||||
writeLine();
|
||||
write("Object.defineProperty(");
|
||||
emitDeclarationName(node);
|
||||
write(", \"name\", { value: \"");
|
||||
emitDeclarationName(node);
|
||||
write("\", configurable: true });");
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
if (isClassExpressionWithStaticProperties) {
|
||||
for (var _a = 0; _a < staticProperties.length; _a++) {
|
||||
|
||||
+27
-18
@@ -15732,17 +15732,34 @@ var ts;
|
||||
}
|
||||
// Target type is type of prototype property
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (!prototypeProperty) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
}
|
||||
}
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
// Narrow to target type if it is a subtype of current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
// Target type is type of construct signature
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048 /* Interface */) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
// If current type is a union type, remove all constituents that aren't subtypes of target type
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
else if (rightType.flags & 32768 /* Anonymous */) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
// Pickup type from union types
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -27577,6 +27594,7 @@ var ts;
|
||||
writeLine();
|
||||
emitToken(15 /* CloseBraceToken */, node.members.end);
|
||||
scopeEmitEnd();
|
||||
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
|
||||
// For a decorated class, we need to assign its name (if it has one). This is because we emit
|
||||
// the class as a class expression to avoid the double-binding of the identifier:
|
||||
//
|
||||
@@ -27586,15 +27604,6 @@ var ts;
|
||||
//
|
||||
if (thisNodeIsDecorated) {
|
||||
write(";");
|
||||
if (node.name) {
|
||||
writeLine();
|
||||
write("Object.defineProperty(");
|
||||
emitDeclarationName(node);
|
||||
write(", \"name\", { value: \"");
|
||||
emitDeclarationName(node);
|
||||
write("\", configurable: true });");
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
// Emit static property assignment. Because classDeclaration is lexically evaluated,
|
||||
// it is safe to emit static property assignment after classDeclaration
|
||||
|
||||
+27
-18
@@ -15732,17 +15732,34 @@ var ts;
|
||||
}
|
||||
// Target type is type of prototype property
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (!prototypeProperty) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
}
|
||||
}
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
// Narrow to target type if it is a subtype of current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
// Target type is type of construct signature
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048 /* Interface */) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
// If current type is a union type, remove all constituents that aren't subtypes of target type
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
else if (rightType.flags & 32768 /* Anonymous */) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
// Pickup type from union types
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -27577,6 +27594,7 @@ var ts;
|
||||
writeLine();
|
||||
emitToken(15 /* CloseBraceToken */, node.members.end);
|
||||
scopeEmitEnd();
|
||||
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
|
||||
// For a decorated class, we need to assign its name (if it has one). This is because we emit
|
||||
// the class as a class expression to avoid the double-binding of the identifier:
|
||||
//
|
||||
@@ -27586,15 +27604,6 @@ var ts;
|
||||
//
|
||||
if (thisNodeIsDecorated) {
|
||||
write(";");
|
||||
if (node.name) {
|
||||
writeLine();
|
||||
write("Object.defineProperty(");
|
||||
emitDeclarationName(node);
|
||||
write(", \"name\", { value: \"");
|
||||
emitDeclarationName(node);
|
||||
write("\", configurable: true });");
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
// Emit static property assignment. Because classDeclaration is lexically evaluated,
|
||||
// it is safe to emit static property assignment after classDeclaration
|
||||
|
||||
+36
-12
@@ -861,10 +861,11 @@ module ts {
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
let fileName: string;
|
||||
let sourceFile: SourceFile;
|
||||
while (true) {
|
||||
let fileName = normalizePath(combinePaths(searchPath, moduleName));
|
||||
sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
|
||||
fileName = normalizePath(combinePaths(searchPath, moduleName));
|
||||
sourceFile = forEach(supportedExtensions, extension => host.getSourceFile(fileName + extension));
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
@@ -5392,20 +5393,43 @@ module ts {
|
||||
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
|
||||
return type;
|
||||
}
|
||||
// Target type is type of prototype property
|
||||
|
||||
let targetType: Type;
|
||||
let prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (!prototypeProperty) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
// Target type is type of the protoype property
|
||||
let prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
||||
if (prototypePropertyType !== anyType) {
|
||||
targetType = prototypePropertyType;
|
||||
}
|
||||
}
|
||||
let targetType = getTypeOfSymbol(prototypeProperty);
|
||||
// Narrow to target type if it is a subtype of current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
|
||||
if (!targetType) {
|
||||
// Target type is type of construct signature
|
||||
let constructSignatures: Signature[];
|
||||
if (rightType.flags & TypeFlags.Interface) {
|
||||
constructSignatures = resolveDeclaredMembers(<InterfaceType>rightType).declaredConstructSignatures;
|
||||
}
|
||||
else if (rightType.flags & TypeFlags.Anonymous) {
|
||||
constructSignatures = getSignaturesOfType(rightType, SignatureKind.Construct);
|
||||
}
|
||||
|
||||
if (constructSignatures && constructSignatures.length) {
|
||||
targetType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature))));
|
||||
}
|
||||
}
|
||||
// If current type is a union type, remove all constituents that aren't subtypes of target type
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
|
||||
|
||||
if (targetType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@@ -640,16 +640,18 @@ module ts {
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
|
||||
let supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
/**
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
export const supportedExtensions = [".ts", ".d.ts"];
|
||||
|
||||
const extensionsToRemove = [".d.ts", ".ts", ".js"];
|
||||
export function removeFileExtension(path: string): string {
|
||||
for (let ext of supportedExtensions) {
|
||||
|
||||
for (let ext of extensionsToRemove) {
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ module ts {
|
||||
Corrupted_locale_file_0: { code: 6051, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
|
||||
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
|
||||
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
|
||||
@@ -2003,7 +2003,7 @@
|
||||
"category": "Error",
|
||||
"code": 6053
|
||||
},
|
||||
"File '{0}' must have extension '.ts' or '.d.ts'.": {
|
||||
"File '{0}' has unsupported extension. The only supported extensions are {1}.": {
|
||||
"category": "Error",
|
||||
"code": 6054
|
||||
},
|
||||
|
||||
@@ -3898,6 +3898,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
scopeEmitEnd();
|
||||
|
||||
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
|
||||
|
||||
// For a decorated class, we need to assign its name (if it has one). This is because we emit
|
||||
// the class as a class expression to avoid the double-binding of the identifier:
|
||||
//
|
||||
@@ -3907,15 +3909,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
//
|
||||
if (thisNodeIsDecorated) {
|
||||
write(";");
|
||||
if (node.name) {
|
||||
writeLine();
|
||||
write("Object.defineProperty(");
|
||||
emitDeclarationName(node);
|
||||
write(", \"name\", { value: \"");
|
||||
emitDeclarationName(node);
|
||||
write("\", configurable: true });");
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
|
||||
// Emit static property assignment. Because classDeclaration is lexically evaluated,
|
||||
|
||||
+22
-12
@@ -219,7 +219,12 @@ module ts {
|
||||
// Create the emit resolver outside of the "emitTime" tracking code below. That way
|
||||
// any cost associated with it (like type checking) are appropriate associated with
|
||||
// the type-checking counter.
|
||||
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
//
|
||||
// If the -out option is specified, we should not pass the source file to getEmitResolver.
|
||||
// This is because in the -out scenario all files need to be emitted, and therefore all
|
||||
// files need to be type checked. And the way to specify that all files need to be type
|
||||
// checked is to not pass the file to getEmitResolver.
|
||||
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
|
||||
let start = new Date().getTime();
|
||||
|
||||
@@ -307,38 +312,45 @@ module ts {
|
||||
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
|
||||
let start: number;
|
||||
let length: number;
|
||||
let extensions: string;
|
||||
let diagnosticArgument: string[];
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
let diagnostic: DiagnosticMessage;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
|
||||
diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
if (!options.allowNonTsExtensions && !forEach(supportedExtensions, extension => fileExtensionIs(host.getCanonicalFileName(fileName), extension))) {
|
||||
diagnostic = Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
|
||||
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) {
|
||||
else if (!forEach(supportedExtensions, extension => findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd))) {
|
||||
diagnostic = Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, fileName));
|
||||
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(diagnostic, fileName));
|
||||
diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,9 +429,10 @@ module ts {
|
||||
let moduleNameText = (<LiteralExpression>moduleNameExpr).text;
|
||||
if (moduleNameText) {
|
||||
let searchPath = basePath;
|
||||
let searchName: string;
|
||||
while (true) {
|
||||
let searchName = normalizePath(combinePaths(searchPath, moduleNameText));
|
||||
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
|
||||
searchName = normalizePath(combinePaths(searchPath, moduleNameText));
|
||||
if (forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, moduleNameExpr))) {
|
||||
break;
|
||||
}
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
@@ -448,10 +461,7 @@ module ts {
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
let searchName = normalizePath(combinePaths(basePath, moduleName));
|
||||
let tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
|
||||
if (!tsFile) {
|
||||
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
|
||||
}
|
||||
forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, nameLiteral));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -617,9 +617,6 @@ module ts {
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,10 +144,10 @@ module FourSlash {
|
||||
if (globalOptions.hasOwnProperty(prop)) {
|
||||
switch (prop) {
|
||||
case metadataOptionNames.allowNonTsExtensions:
|
||||
settings.allowNonTsExtensions = true;
|
||||
settings.allowNonTsExtensions = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.declaration:
|
||||
settings.declaration = true;
|
||||
settings.declaration = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.mapRoot:
|
||||
settings.mapRoot = globalOptions[prop];
|
||||
@@ -174,7 +174,7 @@ module FourSlash {
|
||||
settings.outDir = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.sourceMap:
|
||||
settings.sourceMap = true;
|
||||
settings.sourceMap = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.sourceRoot:
|
||||
settings.sourceRoot = globalOptions[prop];
|
||||
@@ -308,7 +308,7 @@ module FourSlash {
|
||||
ts.forEach(testData.files, file => {
|
||||
// Create map between fileName and its content for easily looking up when resolveReference flag is specified
|
||||
this.inputFiles[file.fileName] = file.content;
|
||||
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference]) {
|
||||
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") {
|
||||
startResolveFileRef = file;
|
||||
} else if (startResolveFileRef) {
|
||||
// If entry point for resolving file references is already specified, report duplication error
|
||||
@@ -1158,7 +1158,7 @@ module FourSlash {
|
||||
var allFourSlashFiles = this.testData.files;
|
||||
for (var idx = 0; idx < allFourSlashFiles.length; ++idx) {
|
||||
var file = allFourSlashFiles[idx];
|
||||
if (file.fileOptions[metadataOptionNames.emitThisFile]) {
|
||||
if (file.fileOptions[metadataOptionNames.emitThisFile] === "true") {
|
||||
// Find a file with the flag emitThisFile turned on
|
||||
emitFiles.push(file);
|
||||
}
|
||||
|
||||
@@ -1008,19 +1008,19 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'noemitonerror':
|
||||
options.noEmitOnError = !!setting.value;
|
||||
options.noEmitOnError = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noresolve':
|
||||
options.noResolve = !!setting.value;
|
||||
options.noResolve = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noimplicitany':
|
||||
options.noImplicitAny = !!setting.value;
|
||||
options.noImplicitAny = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'nolib':
|
||||
options.noLib = !!setting.value;
|
||||
options.noLib = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'out':
|
||||
@@ -1042,11 +1042,11 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'sourcemap':
|
||||
options.sourceMap = !!setting.value;
|
||||
options.sourceMap = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'declaration':
|
||||
options.declaration = !!setting.value;
|
||||
options.declaration = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'newline':
|
||||
@@ -1070,7 +1070,7 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'stripinternal':
|
||||
options.stripInternal = !!setting.value;
|
||||
options.stripInternal = setting.value === 'true';
|
||||
|
||||
case 'usecasesensitivefilenames':
|
||||
useCaseSensitiveFileNames = setting.value === 'true';
|
||||
@@ -1081,7 +1081,7 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'emitbom':
|
||||
options.emitBOM = !!setting.value;
|
||||
options.emitBOM = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'errortruncation':
|
||||
|
||||
Vendored
+2
@@ -3572,6 +3572,7 @@ interface PromiseLike<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3585,6 +3586,7 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
|
||||
+22
-14
@@ -1632,7 +1632,7 @@ module ts {
|
||||
private fileNameToEntry: Map<HostFileInformation>;
|
||||
private _compilationSettings: CompilerOptions;
|
||||
|
||||
constructor(private host: LanguageServiceHost) {
|
||||
constructor(private host: LanguageServiceHost, private getCanonicalFileName: (fileName: string) => string) {
|
||||
// script id => script index
|
||||
this.fileNameToEntry = {};
|
||||
|
||||
@@ -1650,6 +1650,10 @@ module ts {
|
||||
return this._compilationSettings;
|
||||
}
|
||||
|
||||
private normalizeFileName(fileName: string): string {
|
||||
return this.getCanonicalFileName(normalizeSlashes(fileName));
|
||||
}
|
||||
|
||||
private createEntry(fileName: string) {
|
||||
let entry: HostFileInformation;
|
||||
let scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@@ -1661,15 +1665,15 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
return this.fileNameToEntry[normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
}
|
||||
|
||||
public getEntry(fileName: string): HostFileInformation {
|
||||
return lookUp(this.fileNameToEntry, normalizeSlashes(fileName));
|
||||
private getEntry(fileName: string): HostFileInformation {
|
||||
return lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
}
|
||||
|
||||
public contains(fileName: string): boolean {
|
||||
return hasProperty(this.fileNameToEntry, normalizeSlashes(fileName));
|
||||
private contains(fileName: string): boolean {
|
||||
return hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
}
|
||||
|
||||
public getOrCreateEntry(fileName: string): HostFileInformation {
|
||||
@@ -1684,8 +1688,10 @@ module ts {
|
||||
let fileNames: string[] = [];
|
||||
|
||||
forEachKey(this.fileNameToEntry, key => {
|
||||
if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
let entry = this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
|
||||
return fileNames;
|
||||
@@ -2387,7 +2393,7 @@ module ts {
|
||||
|
||||
function synchronizeHostData(): void {
|
||||
// Get a fresh cache of the host information
|
||||
let hostCache = new HostCache(host);
|
||||
let hostCache = new HostCache(host, getCanonicalFileName);
|
||||
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (programUpToDate()) {
|
||||
@@ -2408,7 +2414,7 @@ module ts {
|
||||
let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: () => cancellationToken,
|
||||
getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(),
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
|
||||
getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n",
|
||||
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
||||
@@ -6033,11 +6039,13 @@ module ts {
|
||||
let end = triviaScanner.getTextPos();
|
||||
let width = end - start;
|
||||
|
||||
if (textSpanIntersectsWith(span, start, width)) {
|
||||
if (!isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
// The moment we get something that isn't trivia, then stop processing.
|
||||
if (!isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only bother with the trivia if it at least intersects the span of interest.
|
||||
if (textSpanIntersectsWith(span, start, width)) {
|
||||
if (isComment(kind)) {
|
||||
// Simple comment. Just add as is.
|
||||
pushClassification(start, width, ClassificationType.comment);
|
||||
|
||||
@@ -883,7 +883,7 @@ module ts {
|
||||
return {
|
||||
options: configFile.options,
|
||||
files: configFile.fileNames,
|
||||
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
|
||||
errors: realizeDiagnostics(configFile.errors, '\r\n')
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
function decorate() { }
|
||||
let Decorated = class {
|
||||
};
|
||||
Object.defineProperty(Decorated, "name", { value: "Decorated", configurable: true });
|
||||
Decorated = __decorate([
|
||||
decorate
|
||||
], Decorated);
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
|
||||
//// [emptyFile-declaration.js]
|
||||
//# sourceMappingURL=emptyFile-declaration.js.map
|
||||
|
||||
|
||||
//// [emptyFile-declaration.d.ts]
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [emptyFile-declaration.js.map]
|
||||
{"version":3,"file":"emptyFile-declaration.js","sourceRoot":"","sources":["emptyFile-declaration.ts"],"names":[],"mappings":""}
|
||||
@@ -1,7 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: emptyFile-declaration.js
|
||||
mapUrl: emptyFile-declaration.js.map
|
||||
sourceRoot:
|
||||
sources: emptyFile-declaration.ts
|
||||
===================================================================
|
||||
>>>//# sourceMappingURL=emptyFile-declaration.js.map
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
|
||||
//// [emptyFile-souremap.js]
|
||||
//# sourceMappingURL=emptyFile-souremap.js.map
|
||||
|
||||
//// [emptyFile-souremap.d.ts]
|
||||
//# sourceMappingURL=emptyFile-souremap.js.map
|
||||
@@ -22,10 +22,3 @@ var A = (function () {
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es3-amd.js.map
|
||||
|
||||
//// [es3-amd.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es3-amd.js.map]
|
||||
{"version":3,"file":"es3-amd.js","sourceRoot":"","sources":["es3-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
@@ -1,115 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es3-amd.js
|
||||
mapUrl: es3-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es3-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es3-amd.js
|
||||
sourceFile:es3-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es3-amd.js.map
|
||||
@@ -22,7 +22,7 @@ var A = (function () {
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es3-declaration-amd.js.map
|
||||
|
||||
|
||||
//// [es3-declaration-amd.d.ts]
|
||||
declare class A {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es3-declaration-amd.js.map]
|
||||
{"version":3,"file":"es3-declaration-amd.js","sourceRoot":"","sources":["es3-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
@@ -1,115 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es3-declaration-amd.js
|
||||
mapUrl: es3-declaration-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es3-declaration-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es3-declaration-amd.js
|
||||
sourceFile:es3-declaration-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es3-declaration-amd.js.map
|
||||
@@ -22,10 +22,3 @@ var A = (function () {
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es5-amd.js.map
|
||||
|
||||
//// [es5-amd.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es5-amd.js.map]
|
||||
{"version":3,"file":"es5-amd.js","sourceRoot":"","sources":["es5-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
@@ -1,115 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es5-amd.js
|
||||
mapUrl: es5-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es5-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es5-amd.js
|
||||
sourceFile:es5-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es5-amd.js.map
|
||||
@@ -22,7 +22,7 @@ var A = (function () {
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es5-declaration-amd.js.map
|
||||
|
||||
|
||||
//// [es5-declaration-amd.d.ts]
|
||||
declare class A {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es5-declaration-amd.js.map]
|
||||
{"version":3,"file":"es5-declaration-amd.js","sourceRoot":"","sources":["es5-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
@@ -1,115 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es5-declaration-amd.js
|
||||
mapUrl: es5-declaration-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es5-declaration-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es5-declaration-amd.js
|
||||
sourceFile:es5-declaration-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es5-declaration-amd.js.map
|
||||
@@ -23,10 +23,3 @@ var A = (function () {
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es5-umd.js.map
|
||||
|
||||
//// [es5-umd.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es5-umd.js.map]
|
||||
{"version":3,"file":"es5-umd.js","sourceRoot":"","sources":["es5-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
@@ -1,115 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es5-umd.js
|
||||
mapUrl: es5-umd.js.map
|
||||
sourceRoot:
|
||||
sources: es5-umd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es5-umd.js
|
||||
sourceFile:es5-umd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es5-umd.js.map
|
||||
@@ -33,10 +33,3 @@ export class A
|
||||
})();
|
||||
exports.A = A;
|
||||
});
|
||||
//# sourceMappingURL=es5-umd2.js.map
|
||||
|
||||
//// [es5-umd2.d.ts]
|
||||
export declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es5-umd2.js.map]
|
||||
{"version":3,"file":"es5-umd2.js","sourceRoot":"","sources":["es5-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXY,SAAC,IAWb,CAAA"}
|
||||
@@ -1,149 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es5-umd2.js
|
||||
mapUrl: es5-umd2.js.map
|
||||
sourceRoot:
|
||||
sources: es5-umd2.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es5-umd2.js
|
||||
sourceFile:es5-umd2.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>(function (deps, factory) {
|
||||
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
>>> }
|
||||
>>> else if (typeof define === 'function' && define.amd) {
|
||||
>>> define(deps, factory);
|
||||
>>> }
|
||||
>>>})(["require", "exports"], function (require, exports) {
|
||||
>>> var A = (function () {
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^^^^^
|
||||
2 > ^^->
|
||||
1->export class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> })();
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^->
|
||||
1 >
|
||||
2 > }
|
||||
3 >
|
||||
4 > export class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>> exports.A = A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^
|
||||
3 > ^^^^
|
||||
4 > ^
|
||||
1->
|
||||
2 > A
|
||||
3 >
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
4 >
|
||||
1->Emitted(17, 5) Source(2, 14) + SourceIndex(0)
|
||||
2 >Emitted(17, 14) Source(2, 15) + SourceIndex(0)
|
||||
3 >Emitted(17, 18) Source(13, 2) + SourceIndex(0)
|
||||
4 >Emitted(17, 19) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>});
|
||||
>>>//# sourceMappingURL=es5-umd2.js.map
|
||||
@@ -33,10 +33,3 @@ export default class A
|
||||
})();
|
||||
exports.default = A;
|
||||
});
|
||||
//# sourceMappingURL=es5-umd3.js.map
|
||||
|
||||
//// [es5-umd3.d.ts]
|
||||
export default class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es5-umd3.js.map]
|
||||
{"version":3,"file":"es5-umd3.js","sourceRoot":"","sources":["es5-umd3.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXD,mBAWC,CAAA"}
|
||||
@@ -1,146 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es5-umd3.js
|
||||
mapUrl: es5-umd3.js.map
|
||||
sourceRoot:
|
||||
sources: es5-umd3.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es5-umd3.js
|
||||
sourceFile:es5-umd3.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>(function (deps, factory) {
|
||||
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
>>> }
|
||||
>>> else if (typeof define === 'function' && define.amd) {
|
||||
>>> define(deps, factory);
|
||||
>>> }
|
||||
>>>})(["require", "exports"], function (require, exports) {
|
||||
>>> var A = (function () {
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^^^^^
|
||||
2 > ^^->
|
||||
1->export default class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> })();
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 > }
|
||||
3 >
|
||||
4 > export default class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>> exports.default = A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
1->
|
||||
2 > export default class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
3 >
|
||||
1->Emitted(17, 5) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(17, 24) Source(13, 2) + SourceIndex(0)
|
||||
3 >Emitted(17, 25) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>});
|
||||
>>>//# sourceMappingURL=es5-umd3.js.map
|
||||
@@ -35,11 +35,3 @@ export = A;
|
||||
})();
|
||||
return A;
|
||||
});
|
||||
//# sourceMappingURL=es5-umd4.js.map
|
||||
|
||||
//// [es5-umd4.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
export = A;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es5-umd4.js.map]
|
||||
{"version":3,"file":"es5-umd4.js","sourceRoot":"","sources":["es5-umd4.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAEU,AAAX,OAAS,CAAC,CAAC"}
|
||||
@@ -1,143 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es5-umd4.js
|
||||
mapUrl: es5-umd4.js.map
|
||||
sourceRoot:
|
||||
sources: es5-umd4.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es5-umd4.js
|
||||
sourceFile:es5-umd4.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>(function (deps, factory) {
|
||||
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
>>> }
|
||||
>>> else if (typeof define === 'function' && define.amd) {
|
||||
>>> define(deps, factory);
|
||||
>>> }
|
||||
>>>})(["require", "exports"], function (require, exports) {
|
||||
>>> var A = (function () {
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> })();
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^->
|
||||
1 >
|
||||
2 > }
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 >
|
||||
3 > ^^^^^^^
|
||||
4 > ^
|
||||
5 > ^
|
||||
1->
|
||||
>
|
||||
>export = A;
|
||||
2 >
|
||||
3 > export =
|
||||
4 > A
|
||||
5 > ;
|
||||
1->Emitted(17, 5) Source(15, 12) + SourceIndex(0)
|
||||
2 >Emitted(17, 5) Source(15, 1) + SourceIndex(0)
|
||||
3 >Emitted(17, 12) Source(15, 10) + SourceIndex(0)
|
||||
4 >Emitted(17, 13) Source(15, 11) + SourceIndex(0)
|
||||
5 >Emitted(17, 14) Source(15, 12) + SourceIndex(0)
|
||||
---
|
||||
>>>});
|
||||
>>>//# sourceMappingURL=es5-umd4.js.map
|
||||
@@ -21,10 +21,3 @@ class A {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=es6-amd.js.map
|
||||
|
||||
//// [es6-amd.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es6-amd.js.map]
|
||||
{"version":3,"file":"es6-amd.js","sourceRoot":"","sources":["es6-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
|
||||
@@ -1,91 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es6-amd.js
|
||||
mapUrl: es6-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es6-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es6-amd.js
|
||||
sourceFile:es6-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>class A {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> constructor() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> B() {
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1->()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>//# sourceMappingURL=es6-amd.js.map1->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
@@ -21,7 +21,7 @@ class A {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=es6-declaration-amd.js.map
|
||||
|
||||
|
||||
//// [es6-declaration-amd.d.ts]
|
||||
declare class A {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es6-declaration-amd.js.map]
|
||||
{"version":3,"file":"es6-declaration-amd.js","sourceRoot":"","sources":["es6-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
|
||||
@@ -1,91 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es6-declaration-amd.js
|
||||
mapUrl: es6-declaration-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es6-declaration-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es6-declaration-amd.js
|
||||
sourceFile:es6-declaration-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>class A {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> constructor() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> B() {
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1->()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>//# sourceMappingURL=es6-declaration-amd.js.map1->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
@@ -21,10 +21,3 @@ class A {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=es6-umd.js.map
|
||||
|
||||
//// [es6-umd.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es6-umd.js.map]
|
||||
{"version":3,"file":"es6-umd.js","sourceRoot":"","sources":["es6-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
|
||||
@@ -1,91 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es6-umd.js
|
||||
mapUrl: es6-umd.js.map
|
||||
sourceRoot:
|
||||
sources: es6-umd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es6-umd.js
|
||||
sourceFile:es6-umd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>class A {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> constructor() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> B() {
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1->()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>//# sourceMappingURL=es6-umd.js.map1->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
@@ -21,10 +21,3 @@ export class A {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=es6-umd2.js.map
|
||||
|
||||
//// [es6-umd2.d.ts]
|
||||
export declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
//// [es6-umd2.js.map]
|
||||
{"version":3,"file":"es6-umd2.js","sourceRoot":"","sources":["es6-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
|
||||
@@ -1,91 +0,0 @@
|
||||
===================================================================
|
||||
JsFile: es6-umd2.js
|
||||
mapUrl: es6-umd2.js.map
|
||||
sourceRoot:
|
||||
sources: es6-umd2.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es6-umd2.js
|
||||
sourceFile:es6-umd2.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>export class A {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> constructor() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->export class A
|
||||
>{
|
||||
>
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^->
|
||||
1->constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> B() {
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1->()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>//# sourceMappingURL=es6-umd2.js.map1->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
@@ -0,0 +1,12 @@
|
||||
EmitSkipped: false
|
||||
FileName : out.js
|
||||
/// <reference path='my.d.ts' />
|
||||
var foo;
|
||||
(function (foo) {
|
||||
var bar;
|
||||
(function (bar) {
|
||||
var baz1 = bar.Baz.prototype; // Should emit as bar.Baz.prototype
|
||||
})(bar = foo.bar || (foo.bar = {}));
|
||||
})(foo || (foo = {}));
|
||||
var x;
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
//// [narrowTypeByInstanceof.ts]
|
||||
class Match {
|
||||
public range(): any {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
class FileMatch {
|
||||
public resource(): any {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
type FileMatchOrMatch = FileMatch | Match;
|
||||
|
||||
|
||||
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
|
||||
|
||||
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
|
||||
let a = elementA.resource().path;
|
||||
let b = elementB.resource().path;
|
||||
} else if (elementA instanceof Match && elementB instanceof Match) {
|
||||
let a = elementA.range();
|
||||
let b = elementB.range();
|
||||
}
|
||||
|
||||
|
||||
//// [narrowTypeByInstanceof.js]
|
||||
var Match = (function () {
|
||||
function Match() {
|
||||
}
|
||||
Match.prototype.range = function () {
|
||||
return undefined;
|
||||
};
|
||||
return Match;
|
||||
})();
|
||||
var FileMatch = (function () {
|
||||
function FileMatch() {
|
||||
}
|
||||
FileMatch.prototype.resource = function () {
|
||||
return undefined;
|
||||
};
|
||||
return FileMatch;
|
||||
})();
|
||||
var elementA, elementB;
|
||||
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
|
||||
var a = elementA.resource().path;
|
||||
var b = elementB.resource().path;
|
||||
}
|
||||
else if (elementA instanceof Match && elementB instanceof Match) {
|
||||
var a = elementA.range();
|
||||
var b = elementB.range();
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
=== tests/cases/compiler/narrowTypeByInstanceof.ts ===
|
||||
class Match {
|
||||
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
|
||||
|
||||
public range(): any {
|
||||
>range : Symbol(range, Decl(narrowTypeByInstanceof.ts, 0, 17))
|
||||
|
||||
return undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
}
|
||||
|
||||
class FileMatch {
|
||||
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
|
||||
|
||||
public resource(): any {
|
||||
>resource : Symbol(resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
|
||||
|
||||
return undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
}
|
||||
|
||||
type FileMatchOrMatch = FileMatch | Match;
|
||||
>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5))
|
||||
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
|
||||
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
|
||||
|
||||
|
||||
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
|
||||
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
|
||||
>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5))
|
||||
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
|
||||
>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5))
|
||||
|
||||
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
|
||||
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
|
||||
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
|
||||
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
|
||||
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
|
||||
|
||||
let a = elementA.resource().path;
|
||||
>a : Symbol(a, Decl(narrowTypeByInstanceof.ts, 18, 7))
|
||||
>elementA.resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
|
||||
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
|
||||
>resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
|
||||
|
||||
let b = elementB.resource().path;
|
||||
>b : Symbol(b, Decl(narrowTypeByInstanceof.ts, 19, 7))
|
||||
>elementB.resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
|
||||
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
|
||||
>resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
|
||||
|
||||
} else if (elementA instanceof Match && elementB instanceof Match) {
|
||||
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
|
||||
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
|
||||
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
|
||||
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
|
||||
|
||||
let a = elementA.range();
|
||||
>a : Symbol(a, Decl(narrowTypeByInstanceof.ts, 21, 7))
|
||||
>elementA.range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
|
||||
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
|
||||
>range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
|
||||
|
||||
let b = elementB.range();
|
||||
>b : Symbol(b, Decl(narrowTypeByInstanceof.ts, 22, 7))
|
||||
>elementB.range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
|
||||
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
|
||||
>range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
=== tests/cases/compiler/narrowTypeByInstanceof.ts ===
|
||||
class Match {
|
||||
>Match : Match
|
||||
|
||||
public range(): any {
|
||||
>range : () => any
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
}
|
||||
|
||||
class FileMatch {
|
||||
>FileMatch : FileMatch
|
||||
|
||||
public resource(): any {
|
||||
>resource : () => any
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
}
|
||||
|
||||
type FileMatchOrMatch = FileMatch | Match;
|
||||
>FileMatchOrMatch : Match | FileMatch
|
||||
>FileMatch : FileMatch
|
||||
>Match : Match
|
||||
|
||||
|
||||
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
|
||||
>elementA : Match | FileMatch
|
||||
>FileMatchOrMatch : Match | FileMatch
|
||||
>elementB : Match | FileMatch
|
||||
>FileMatchOrMatch : Match | FileMatch
|
||||
|
||||
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
|
||||
>elementA instanceof FileMatch && elementB instanceof FileMatch : boolean
|
||||
>elementA instanceof FileMatch : boolean
|
||||
>elementA : Match | FileMatch
|
||||
>FileMatch : typeof FileMatch
|
||||
>elementB instanceof FileMatch : boolean
|
||||
>elementB : Match | FileMatch
|
||||
>FileMatch : typeof FileMatch
|
||||
|
||||
let a = elementA.resource().path;
|
||||
>a : any
|
||||
>elementA.resource().path : any
|
||||
>elementA.resource() : any
|
||||
>elementA.resource : () => any
|
||||
>elementA : FileMatch
|
||||
>resource : () => any
|
||||
>path : any
|
||||
|
||||
let b = elementB.resource().path;
|
||||
>b : any
|
||||
>elementB.resource().path : any
|
||||
>elementB.resource() : any
|
||||
>elementB.resource : () => any
|
||||
>elementB : FileMatch
|
||||
>resource : () => any
|
||||
>path : any
|
||||
|
||||
} else if (elementA instanceof Match && elementB instanceof Match) {
|
||||
>elementA instanceof Match && elementB instanceof Match : boolean
|
||||
>elementA instanceof Match : boolean
|
||||
>elementA : Match | FileMatch
|
||||
>Match : typeof Match
|
||||
>elementB instanceof Match : boolean
|
||||
>elementB : Match | FileMatch
|
||||
>Match : typeof Match
|
||||
|
||||
let a = elementA.range();
|
||||
>a : any
|
||||
>elementA.range() : any
|
||||
>elementA.range : () => any
|
||||
>elementA : Match
|
||||
>range : () => any
|
||||
|
||||
let b = elementB.range();
|
||||
>b : any
|
||||
>elementB.range() : any
|
||||
>elementB.range : () => any
|
||||
>elementB : Match
|
||||
>range : () => any
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
|
||||
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
|
||||
error TS6053: File 'a.ts' not found.
|
||||
|
||||
|
||||
!!! error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
|
||||
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
|
||||
!!! error TS6053: File 'a.ts' not found.
|
||||
@@ -1,6 +1,6 @@
|
||||
error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
|
||||
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
|
||||
error TS6053: File 'a.ts' not found.
|
||||
|
||||
|
||||
!!! error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
|
||||
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
|
||||
!!! error TS6053: File 'a.ts' not found.
|
||||
@@ -0,0 +1,43 @@
|
||||
//// [promiseVoidErrorCallback.ts]
|
||||
interface T1 {
|
||||
__t1: string;
|
||||
}
|
||||
|
||||
interface T2 {
|
||||
__t2: string;
|
||||
}
|
||||
|
||||
interface T3 {
|
||||
__t3: string;
|
||||
}
|
||||
|
||||
function f1(): Promise<T1> {
|
||||
return Promise.resolve({ __t1: "foo_t1" });
|
||||
}
|
||||
|
||||
function f2(x: T1): T2 {
|
||||
return { __t2: x.__t1 + ":foo_21" };
|
||||
}
|
||||
|
||||
var x3 = f1()
|
||||
.then(f2, (e: Error) => {
|
||||
throw e;
|
||||
})
|
||||
.then((x: T2) => {
|
||||
return { __t3: x.__t2 + "bar" };
|
||||
});
|
||||
|
||||
//// [promiseVoidErrorCallback.js]
|
||||
function f1() {
|
||||
return Promise.resolve({ __t1: "foo_t1" });
|
||||
}
|
||||
function f2(x) {
|
||||
return { __t2: x.__t1 + ":foo_21" };
|
||||
}
|
||||
var x3 = f1()
|
||||
.then(f2, (e) => {
|
||||
throw e;
|
||||
})
|
||||
.then((x) => {
|
||||
return { __t3: x.__t2 + "bar" };
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
=== tests/cases/compiler/promiseVoidErrorCallback.ts ===
|
||||
interface T1 {
|
||||
>T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0))
|
||||
|
||||
__t1: string;
|
||||
>__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 0, 14))
|
||||
}
|
||||
|
||||
interface T2 {
|
||||
>T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1))
|
||||
|
||||
__t2: string;
|
||||
>__t2 : Symbol(__t2, Decl(promiseVoidErrorCallback.ts, 4, 14))
|
||||
}
|
||||
|
||||
interface T3 {
|
||||
>T3 : Symbol(T3, Decl(promiseVoidErrorCallback.ts, 6, 1))
|
||||
|
||||
__t3: string;
|
||||
>__t3 : Symbol(__t3, Decl(promiseVoidErrorCallback.ts, 8, 14))
|
||||
}
|
||||
|
||||
function f1(): Promise<T1> {
|
||||
>f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4854, 11))
|
||||
>T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0))
|
||||
|
||||
return Promise.resolve({ __t1: "foo_t1" });
|
||||
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 4836, 39), Decl(lib.d.ts, 4843, 54))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4854, 11))
|
||||
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 4836, 39), Decl(lib.d.ts, 4843, 54))
|
||||
>__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 13, 28))
|
||||
}
|
||||
|
||||
function f2(x: T1): T2 {
|
||||
>f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1))
|
||||
>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 16, 12))
|
||||
>T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0))
|
||||
>T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1))
|
||||
|
||||
return { __t2: x.__t1 + ":foo_21" };
|
||||
>__t2 : Symbol(__t2, Decl(promiseVoidErrorCallback.ts, 17, 12))
|
||||
>x.__t1 : Symbol(T1.__t1, Decl(promiseVoidErrorCallback.ts, 0, 14))
|
||||
>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 16, 12))
|
||||
>__t1 : Symbol(T1.__t1, Decl(promiseVoidErrorCallback.ts, 0, 14))
|
||||
}
|
||||
|
||||
var x3 = f1()
|
||||
>x3 : Symbol(x3, Decl(promiseVoidErrorCallback.ts, 20, 3))
|
||||
>f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158))
|
||||
>f1() .then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158))
|
||||
>f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1))
|
||||
|
||||
.then(f2, (e: Error) => {
|
||||
>then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158))
|
||||
>f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1))
|
||||
>e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15))
|
||||
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
|
||||
|
||||
throw e;
|
||||
>e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15))
|
||||
|
||||
})
|
||||
.then((x: T2) => {
|
||||
>then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158))
|
||||
>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11))
|
||||
>T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1))
|
||||
|
||||
return { __t3: x.__t2 + "bar" };
|
||||
>__t3 : Symbol(__t3, Decl(promiseVoidErrorCallback.ts, 25, 12))
|
||||
>x.__t2 : Symbol(T2.__t2, Decl(promiseVoidErrorCallback.ts, 4, 14))
|
||||
>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11))
|
||||
>__t2 : Symbol(T2.__t2, Decl(promiseVoidErrorCallback.ts, 4, 14))
|
||||
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
=== tests/cases/compiler/promiseVoidErrorCallback.ts ===
|
||||
interface T1 {
|
||||
>T1 : T1
|
||||
|
||||
__t1: string;
|
||||
>__t1 : string
|
||||
}
|
||||
|
||||
interface T2 {
|
||||
>T2 : T2
|
||||
|
||||
__t2: string;
|
||||
>__t2 : string
|
||||
}
|
||||
|
||||
interface T3 {
|
||||
>T3 : T3
|
||||
|
||||
__t3: string;
|
||||
>__t3 : string
|
||||
}
|
||||
|
||||
function f1(): Promise<T1> {
|
||||
>f1 : () => Promise<T1>
|
||||
>Promise : Promise<T>
|
||||
>T1 : T1
|
||||
|
||||
return Promise.resolve({ __t1: "foo_t1" });
|
||||
>Promise.resolve({ __t1: "foo_t1" }) : Promise<{ __t1: string; }>
|
||||
>Promise.resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
>{ __t1: "foo_t1" } : { __t1: string; }
|
||||
>__t1 : string
|
||||
>"foo_t1" : string
|
||||
}
|
||||
|
||||
function f2(x: T1): T2 {
|
||||
>f2 : (x: T1) => T2
|
||||
>x : T1
|
||||
>T1 : T1
|
||||
>T2 : T2
|
||||
|
||||
return { __t2: x.__t1 + ":foo_21" };
|
||||
>{ __t2: x.__t1 + ":foo_21" } : { __t2: string; }
|
||||
>__t2 : string
|
||||
>x.__t1 + ":foo_21" : string
|
||||
>x.__t1 : string
|
||||
>x : T1
|
||||
>__t1 : string
|
||||
>":foo_21" : string
|
||||
}
|
||||
|
||||
var x3 = f1()
|
||||
>x3 : Promise<{ __t3: string; }>
|
||||
>f1() .then(f2, (e: Error) => { throw e;}) .then((x: T2) => { return { __t3: x.__t2 + "bar" };}) : Promise<{ __t3: string; }>
|
||||
>f1() .then(f2, (e: Error) => { throw e;}) .then : { <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
||||
>f1() .then(f2, (e: Error) => { throw e;}) : Promise<T2>
|
||||
>f1() .then : { <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
||||
>f1() : Promise<T1>
|
||||
>f1 : () => Promise<T1>
|
||||
|
||||
.then(f2, (e: Error) => {
|
||||
>then : { <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
||||
>f2 : (x: T1) => T2
|
||||
>(e: Error) => { throw e;} : (e: Error) => void
|
||||
>e : Error
|
||||
>Error : Error
|
||||
|
||||
throw e;
|
||||
>e : Error
|
||||
|
||||
})
|
||||
.then((x: T2) => {
|
||||
>then : { <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
||||
>(x: T2) => { return { __t3: x.__t2 + "bar" };} : (x: T2) => { __t3: string; }
|
||||
>x : T2
|
||||
>T2 : T2
|
||||
|
||||
return { __t3: x.__t2 + "bar" };
|
||||
>{ __t3: x.__t2 + "bar" } : { __t3: string; }
|
||||
>__t3 : string
|
||||
>x.__t2 + "bar" : string
|
||||
>x.__t2 : string
|
||||
>x : T2
|
||||
>__t2 : string
|
||||
>"bar" : string
|
||||
|
||||
});
|
||||
@@ -0,0 +1,229 @@
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(12,10): error TS2339: Property 'bar' does not exist on type 'A'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(34,10): error TS2339: Property 'bar' does not exist on type 'B<number>'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(65,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(111,10): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'string | F'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts (12 errors) ====
|
||||
interface AConstructor {
|
||||
new (): A;
|
||||
}
|
||||
interface A {
|
||||
foo: string;
|
||||
}
|
||||
declare var A: AConstructor;
|
||||
|
||||
var obj1: A | string;
|
||||
if (obj1 instanceof A) { // narrowed to A.
|
||||
obj1.foo;
|
||||
obj1.bar;
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'A'.
|
||||
}
|
||||
|
||||
var obj2: any;
|
||||
if (obj2 instanceof A) { // can't narrow type from 'any'
|
||||
obj2.foo;
|
||||
obj2.bar;
|
||||
}
|
||||
|
||||
// a construct signature with generics
|
||||
interface BConstructor {
|
||||
new <T>(): B<T>;
|
||||
}
|
||||
interface B<T> {
|
||||
foo: T;
|
||||
}
|
||||
declare var B: BConstructor;
|
||||
|
||||
var obj3: B<number> | string;
|
||||
if (obj3 instanceof B) { // narrowed to B<number>.
|
||||
obj3.foo = 1;
|
||||
obj3.foo = "str";
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
obj3.bar = "str";
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'B<number>'.
|
||||
}
|
||||
|
||||
var obj4: any;
|
||||
if (obj4 instanceof B) { // can't narrow type from 'any'
|
||||
obj4.foo = "str";
|
||||
obj4.foo = 1;
|
||||
obj4.bar = "str";
|
||||
}
|
||||
|
||||
// has multiple construct signature
|
||||
interface CConstructor {
|
||||
new (value: string): C1;
|
||||
new (value: number): C2;
|
||||
}
|
||||
interface C1 {
|
||||
foo: string;
|
||||
c: string;
|
||||
bar1: number;
|
||||
}
|
||||
interface C2 {
|
||||
foo: string;
|
||||
c: string;
|
||||
bar2: number;
|
||||
}
|
||||
declare var C: CConstructor;
|
||||
|
||||
var obj5: C1 | A;
|
||||
if (obj5 instanceof C) { // narrowed to C1|C2.
|
||||
obj5.foo;
|
||||
obj5.c;
|
||||
obj5.bar1;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar1' does not exist on type 'C1 | C2'.
|
||||
obj5.bar2;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar2' does not exist on type 'C1 | C2'.
|
||||
}
|
||||
|
||||
var obj6: any;
|
||||
if (obj6 instanceof C) { // can't narrow type from 'any'
|
||||
obj6.foo;
|
||||
obj6.bar1;
|
||||
obj6.bar2;
|
||||
}
|
||||
|
||||
// with object type literal
|
||||
interface D {
|
||||
foo: string;
|
||||
}
|
||||
declare var D: { new (): D; };
|
||||
|
||||
var obj7: D | string;
|
||||
if (obj7 instanceof D) { // narrowed to D.
|
||||
obj7.foo;
|
||||
obj7.bar;
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'D'.
|
||||
}
|
||||
|
||||
var obj8: any;
|
||||
if (obj8 instanceof D) { // can't narrow type from 'any'
|
||||
obj8.foo;
|
||||
obj8.bar;
|
||||
}
|
||||
|
||||
// a construct signature that returns a union type
|
||||
interface EConstructor {
|
||||
new (): E1 | E2;
|
||||
}
|
||||
interface E1 {
|
||||
foo: string;
|
||||
bar1: number;
|
||||
}
|
||||
interface E2 {
|
||||
foo: string;
|
||||
bar2: number;
|
||||
}
|
||||
declare var E: EConstructor;
|
||||
|
||||
var obj9: E1 | A;
|
||||
if (obj9 instanceof E) { // narrowed to E1 | E2
|
||||
obj9.foo;
|
||||
obj9.bar1;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar1' does not exist on type 'E1 | E2'.
|
||||
obj9.bar2;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar2' does not exist on type 'E1 | E2'.
|
||||
}
|
||||
|
||||
var obj10: any;
|
||||
if (obj10 instanceof E) { // can't narrow type from 'any'
|
||||
obj10.foo;
|
||||
obj10.bar1;
|
||||
obj10.bar2;
|
||||
}
|
||||
|
||||
// a construct signature that returns any
|
||||
interface FConstructor {
|
||||
new (): any;
|
||||
}
|
||||
interface F {
|
||||
foo: string;
|
||||
bar: number;
|
||||
}
|
||||
declare var F: FConstructor;
|
||||
|
||||
var obj11: F | string;
|
||||
if (obj11 instanceof F) { // can't type narrowing, construct signature returns any.
|
||||
obj11.foo;
|
||||
~~~
|
||||
!!! error TS2339: Property 'foo' does not exist on type 'string | F'.
|
||||
obj11.bar;
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'string | F'.
|
||||
}
|
||||
|
||||
var obj12: any;
|
||||
if (obj12 instanceof F) { // can't narrow type from 'any'
|
||||
obj12.foo;
|
||||
obj12.bar;
|
||||
}
|
||||
|
||||
// a type with a prototype, it overrides the construct signature
|
||||
interface GConstructor {
|
||||
prototype: G1; // high priority
|
||||
new (): G2; // low priority
|
||||
}
|
||||
interface G1 {
|
||||
foo1: number;
|
||||
}
|
||||
interface G2 {
|
||||
foo2: boolean;
|
||||
}
|
||||
declare var G: GConstructor;
|
||||
|
||||
var obj13: G1 | G2;
|
||||
if (obj13 instanceof G) { // narrowed to G1. G1 is return type of prototype property.
|
||||
obj13.foo1;
|
||||
obj13.foo2;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'foo2' does not exist on type 'G1'.
|
||||
}
|
||||
|
||||
var obj14: any;
|
||||
if (obj14 instanceof G) { // can't narrow type from 'any'
|
||||
obj14.foo1;
|
||||
obj14.foo2;
|
||||
}
|
||||
|
||||
// a type with a prototype that has any type
|
||||
interface HConstructor {
|
||||
prototype: any; // high priority, but any type is ignored. interface has implicit `prototype: any`.
|
||||
new (): H; // low priority
|
||||
}
|
||||
interface H {
|
||||
foo: number;
|
||||
}
|
||||
declare var H: HConstructor;
|
||||
|
||||
var obj15: H | string;
|
||||
if (obj15 instanceof H) { // narrowed to H.
|
||||
obj15.foo;
|
||||
obj15.bar;
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'H'.
|
||||
}
|
||||
|
||||
var obj16: any;
|
||||
if (obj16 instanceof H) { // can't narrow type from 'any'
|
||||
obj16.foo1;
|
||||
obj16.foo2;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
//// [typeGuardsWithInstanceOfByConstructorSignature.ts]
|
||||
interface AConstructor {
|
||||
new (): A;
|
||||
}
|
||||
interface A {
|
||||
foo: string;
|
||||
}
|
||||
declare var A: AConstructor;
|
||||
|
||||
var obj1: A | string;
|
||||
if (obj1 instanceof A) { // narrowed to A.
|
||||
obj1.foo;
|
||||
obj1.bar;
|
||||
}
|
||||
|
||||
var obj2: any;
|
||||
if (obj2 instanceof A) { // can't narrow type from 'any'
|
||||
obj2.foo;
|
||||
obj2.bar;
|
||||
}
|
||||
|
||||
// a construct signature with generics
|
||||
interface BConstructor {
|
||||
new <T>(): B<T>;
|
||||
}
|
||||
interface B<T> {
|
||||
foo: T;
|
||||
}
|
||||
declare var B: BConstructor;
|
||||
|
||||
var obj3: B<number> | string;
|
||||
if (obj3 instanceof B) { // narrowed to B<number>.
|
||||
obj3.foo = 1;
|
||||
obj3.foo = "str";
|
||||
obj3.bar = "str";
|
||||
}
|
||||
|
||||
var obj4: any;
|
||||
if (obj4 instanceof B) { // can't narrow type from 'any'
|
||||
obj4.foo = "str";
|
||||
obj4.foo = 1;
|
||||
obj4.bar = "str";
|
||||
}
|
||||
|
||||
// has multiple construct signature
|
||||
interface CConstructor {
|
||||
new (value: string): C1;
|
||||
new (value: number): C2;
|
||||
}
|
||||
interface C1 {
|
||||
foo: string;
|
||||
c: string;
|
||||
bar1: number;
|
||||
}
|
||||
interface C2 {
|
||||
foo: string;
|
||||
c: string;
|
||||
bar2: number;
|
||||
}
|
||||
declare var C: CConstructor;
|
||||
|
||||
var obj5: C1 | A;
|
||||
if (obj5 instanceof C) { // narrowed to C1|C2.
|
||||
obj5.foo;
|
||||
obj5.c;
|
||||
obj5.bar1;
|
||||
obj5.bar2;
|
||||
}
|
||||
|
||||
var obj6: any;
|
||||
if (obj6 instanceof C) { // can't narrow type from 'any'
|
||||
obj6.foo;
|
||||
obj6.bar1;
|
||||
obj6.bar2;
|
||||
}
|
||||
|
||||
// with object type literal
|
||||
interface D {
|
||||
foo: string;
|
||||
}
|
||||
declare var D: { new (): D; };
|
||||
|
||||
var obj7: D | string;
|
||||
if (obj7 instanceof D) { // narrowed to D.
|
||||
obj7.foo;
|
||||
obj7.bar;
|
||||
}
|
||||
|
||||
var obj8: any;
|
||||
if (obj8 instanceof D) { // can't narrow type from 'any'
|
||||
obj8.foo;
|
||||
obj8.bar;
|
||||
}
|
||||
|
||||
// a construct signature that returns a union type
|
||||
interface EConstructor {
|
||||
new (): E1 | E2;
|
||||
}
|
||||
interface E1 {
|
||||
foo: string;
|
||||
bar1: number;
|
||||
}
|
||||
interface E2 {
|
||||
foo: string;
|
||||
bar2: number;
|
||||
}
|
||||
declare var E: EConstructor;
|
||||
|
||||
var obj9: E1 | A;
|
||||
if (obj9 instanceof E) { // narrowed to E1 | E2
|
||||
obj9.foo;
|
||||
obj9.bar1;
|
||||
obj9.bar2;
|
||||
}
|
||||
|
||||
var obj10: any;
|
||||
if (obj10 instanceof E) { // can't narrow type from 'any'
|
||||
obj10.foo;
|
||||
obj10.bar1;
|
||||
obj10.bar2;
|
||||
}
|
||||
|
||||
// a construct signature that returns any
|
||||
interface FConstructor {
|
||||
new (): any;
|
||||
}
|
||||
interface F {
|
||||
foo: string;
|
||||
bar: number;
|
||||
}
|
||||
declare var F: FConstructor;
|
||||
|
||||
var obj11: F | string;
|
||||
if (obj11 instanceof F) { // can't type narrowing, construct signature returns any.
|
||||
obj11.foo;
|
||||
obj11.bar;
|
||||
}
|
||||
|
||||
var obj12: any;
|
||||
if (obj12 instanceof F) { // can't narrow type from 'any'
|
||||
obj12.foo;
|
||||
obj12.bar;
|
||||
}
|
||||
|
||||
// a type with a prototype, it overrides the construct signature
|
||||
interface GConstructor {
|
||||
prototype: G1; // high priority
|
||||
new (): G2; // low priority
|
||||
}
|
||||
interface G1 {
|
||||
foo1: number;
|
||||
}
|
||||
interface G2 {
|
||||
foo2: boolean;
|
||||
}
|
||||
declare var G: GConstructor;
|
||||
|
||||
var obj13: G1 | G2;
|
||||
if (obj13 instanceof G) { // narrowed to G1. G1 is return type of prototype property.
|
||||
obj13.foo1;
|
||||
obj13.foo2;
|
||||
}
|
||||
|
||||
var obj14: any;
|
||||
if (obj14 instanceof G) { // can't narrow type from 'any'
|
||||
obj14.foo1;
|
||||
obj14.foo2;
|
||||
}
|
||||
|
||||
// a type with a prototype that has any type
|
||||
interface HConstructor {
|
||||
prototype: any; // high priority, but any type is ignored. interface has implicit `prototype: any`.
|
||||
new (): H; // low priority
|
||||
}
|
||||
interface H {
|
||||
foo: number;
|
||||
}
|
||||
declare var H: HConstructor;
|
||||
|
||||
var obj15: H | string;
|
||||
if (obj15 instanceof H) { // narrowed to H.
|
||||
obj15.foo;
|
||||
obj15.bar;
|
||||
}
|
||||
|
||||
var obj16: any;
|
||||
if (obj16 instanceof H) { // can't narrow type from 'any'
|
||||
obj16.foo1;
|
||||
obj16.foo2;
|
||||
}
|
||||
|
||||
|
||||
//// [typeGuardsWithInstanceOfByConstructorSignature.js]
|
||||
var obj1;
|
||||
if (obj1 instanceof A) {
|
||||
obj1.foo;
|
||||
obj1.bar;
|
||||
}
|
||||
var obj2;
|
||||
if (obj2 instanceof A) {
|
||||
obj2.foo;
|
||||
obj2.bar;
|
||||
}
|
||||
var obj3;
|
||||
if (obj3 instanceof B) {
|
||||
obj3.foo = 1;
|
||||
obj3.foo = "str";
|
||||
obj3.bar = "str";
|
||||
}
|
||||
var obj4;
|
||||
if (obj4 instanceof B) {
|
||||
obj4.foo = "str";
|
||||
obj4.foo = 1;
|
||||
obj4.bar = "str";
|
||||
}
|
||||
var obj5;
|
||||
if (obj5 instanceof C) {
|
||||
obj5.foo;
|
||||
obj5.c;
|
||||
obj5.bar1;
|
||||
obj5.bar2;
|
||||
}
|
||||
var obj6;
|
||||
if (obj6 instanceof C) {
|
||||
obj6.foo;
|
||||
obj6.bar1;
|
||||
obj6.bar2;
|
||||
}
|
||||
var obj7;
|
||||
if (obj7 instanceof D) {
|
||||
obj7.foo;
|
||||
obj7.bar;
|
||||
}
|
||||
var obj8;
|
||||
if (obj8 instanceof D) {
|
||||
obj8.foo;
|
||||
obj8.bar;
|
||||
}
|
||||
var obj9;
|
||||
if (obj9 instanceof E) {
|
||||
obj9.foo;
|
||||
obj9.bar1;
|
||||
obj9.bar2;
|
||||
}
|
||||
var obj10;
|
||||
if (obj10 instanceof E) {
|
||||
obj10.foo;
|
||||
obj10.bar1;
|
||||
obj10.bar2;
|
||||
}
|
||||
var obj11;
|
||||
if (obj11 instanceof F) {
|
||||
obj11.foo;
|
||||
obj11.bar;
|
||||
}
|
||||
var obj12;
|
||||
if (obj12 instanceof F) {
|
||||
obj12.foo;
|
||||
obj12.bar;
|
||||
}
|
||||
var obj13;
|
||||
if (obj13 instanceof G) {
|
||||
obj13.foo1;
|
||||
obj13.foo2;
|
||||
}
|
||||
var obj14;
|
||||
if (obj14 instanceof G) {
|
||||
obj14.foo1;
|
||||
obj14.foo2;
|
||||
}
|
||||
var obj15;
|
||||
if (obj15 instanceof H) {
|
||||
obj15.foo;
|
||||
obj15.bar;
|
||||
}
|
||||
var obj16;
|
||||
if (obj16 instanceof H) {
|
||||
obj16.foo1;
|
||||
obj16.foo2;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
class Match {
|
||||
public range(): any {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
class FileMatch {
|
||||
public resource(): any {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
type FileMatchOrMatch = FileMatch | Match;
|
||||
|
||||
|
||||
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
|
||||
|
||||
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
|
||||
let a = elementA.resource().path;
|
||||
let b = elementB.resource().path;
|
||||
} else if (elementA instanceof Match && elementB instanceof Match) {
|
||||
let a = elementA.range();
|
||||
let b = elementB.range();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//@target: ES6
|
||||
interface T1 {
|
||||
__t1: string;
|
||||
}
|
||||
|
||||
interface T2 {
|
||||
__t2: string;
|
||||
}
|
||||
|
||||
interface T3 {
|
||||
__t3: string;
|
||||
}
|
||||
|
||||
function f1(): Promise<T1> {
|
||||
return Promise.resolve({ __t1: "foo_t1" });
|
||||
}
|
||||
|
||||
function f2(x: T1): T2 {
|
||||
return { __t2: x.__t1 + ":foo_21" };
|
||||
}
|
||||
|
||||
var x3 = f1()
|
||||
.then(f2, (e: Error) => {
|
||||
throw e;
|
||||
})
|
||||
.then((x: T2) => {
|
||||
return { __t3: x.__t2 + "bar" };
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
// @separateCompilation: true
|
||||
// @sourceMap:sourcemap.map
|
||||
// @sourceMap:true
|
||||
// @target: es6
|
||||
|
||||
// @filename: file1.ts
|
||||
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
interface AConstructor {
|
||||
new (): A;
|
||||
}
|
||||
interface A {
|
||||
foo: string;
|
||||
}
|
||||
declare var A: AConstructor;
|
||||
|
||||
var obj1: A | string;
|
||||
if (obj1 instanceof A) { // narrowed to A.
|
||||
obj1.foo;
|
||||
obj1.bar;
|
||||
}
|
||||
|
||||
var obj2: any;
|
||||
if (obj2 instanceof A) { // can't narrow type from 'any'
|
||||
obj2.foo;
|
||||
obj2.bar;
|
||||
}
|
||||
|
||||
// a construct signature with generics
|
||||
interface BConstructor {
|
||||
new <T>(): B<T>;
|
||||
}
|
||||
interface B<T> {
|
||||
foo: T;
|
||||
}
|
||||
declare var B: BConstructor;
|
||||
|
||||
var obj3: B<number> | string;
|
||||
if (obj3 instanceof B) { // narrowed to B<number>.
|
||||
obj3.foo = 1;
|
||||
obj3.foo = "str";
|
||||
obj3.bar = "str";
|
||||
}
|
||||
|
||||
var obj4: any;
|
||||
if (obj4 instanceof B) { // can't narrow type from 'any'
|
||||
obj4.foo = "str";
|
||||
obj4.foo = 1;
|
||||
obj4.bar = "str";
|
||||
}
|
||||
|
||||
// has multiple construct signature
|
||||
interface CConstructor {
|
||||
new (value: string): C1;
|
||||
new (value: number): C2;
|
||||
}
|
||||
interface C1 {
|
||||
foo: string;
|
||||
c: string;
|
||||
bar1: number;
|
||||
}
|
||||
interface C2 {
|
||||
foo: string;
|
||||
c: string;
|
||||
bar2: number;
|
||||
}
|
||||
declare var C: CConstructor;
|
||||
|
||||
var obj5: C1 | A;
|
||||
if (obj5 instanceof C) { // narrowed to C1|C2.
|
||||
obj5.foo;
|
||||
obj5.c;
|
||||
obj5.bar1;
|
||||
obj5.bar2;
|
||||
}
|
||||
|
||||
var obj6: any;
|
||||
if (obj6 instanceof C) { // can't narrow type from 'any'
|
||||
obj6.foo;
|
||||
obj6.bar1;
|
||||
obj6.bar2;
|
||||
}
|
||||
|
||||
// with object type literal
|
||||
interface D {
|
||||
foo: string;
|
||||
}
|
||||
declare var D: { new (): D; };
|
||||
|
||||
var obj7: D | string;
|
||||
if (obj7 instanceof D) { // narrowed to D.
|
||||
obj7.foo;
|
||||
obj7.bar;
|
||||
}
|
||||
|
||||
var obj8: any;
|
||||
if (obj8 instanceof D) { // can't narrow type from 'any'
|
||||
obj8.foo;
|
||||
obj8.bar;
|
||||
}
|
||||
|
||||
// a construct signature that returns a union type
|
||||
interface EConstructor {
|
||||
new (): E1 | E2;
|
||||
}
|
||||
interface E1 {
|
||||
foo: string;
|
||||
bar1: number;
|
||||
}
|
||||
interface E2 {
|
||||
foo: string;
|
||||
bar2: number;
|
||||
}
|
||||
declare var E: EConstructor;
|
||||
|
||||
var obj9: E1 | A;
|
||||
if (obj9 instanceof E) { // narrowed to E1 | E2
|
||||
obj9.foo;
|
||||
obj9.bar1;
|
||||
obj9.bar2;
|
||||
}
|
||||
|
||||
var obj10: any;
|
||||
if (obj10 instanceof E) { // can't narrow type from 'any'
|
||||
obj10.foo;
|
||||
obj10.bar1;
|
||||
obj10.bar2;
|
||||
}
|
||||
|
||||
// a construct signature that returns any
|
||||
interface FConstructor {
|
||||
new (): any;
|
||||
}
|
||||
interface F {
|
||||
foo: string;
|
||||
bar: number;
|
||||
}
|
||||
declare var F: FConstructor;
|
||||
|
||||
var obj11: F | string;
|
||||
if (obj11 instanceof F) { // can't type narrowing, construct signature returns any.
|
||||
obj11.foo;
|
||||
obj11.bar;
|
||||
}
|
||||
|
||||
var obj12: any;
|
||||
if (obj12 instanceof F) { // can't narrow type from 'any'
|
||||
obj12.foo;
|
||||
obj12.bar;
|
||||
}
|
||||
|
||||
// a type with a prototype, it overrides the construct signature
|
||||
interface GConstructor {
|
||||
prototype: G1; // high priority
|
||||
new (): G2; // low priority
|
||||
}
|
||||
interface G1 {
|
||||
foo1: number;
|
||||
}
|
||||
interface G2 {
|
||||
foo2: boolean;
|
||||
}
|
||||
declare var G: GConstructor;
|
||||
|
||||
var obj13: G1 | G2;
|
||||
if (obj13 instanceof G) { // narrowed to G1. G1 is return type of prototype property.
|
||||
obj13.foo1;
|
||||
obj13.foo2;
|
||||
}
|
||||
|
||||
var obj14: any;
|
||||
if (obj14 instanceof G) { // can't narrow type from 'any'
|
||||
obj14.foo1;
|
||||
obj14.foo2;
|
||||
}
|
||||
|
||||
// a type with a prototype that has any type
|
||||
interface HConstructor {
|
||||
prototype: any; // high priority, but any type is ignored. interface has implicit `prototype: any`.
|
||||
new (): H; // low priority
|
||||
}
|
||||
interface H {
|
||||
foo: number;
|
||||
}
|
||||
declare var H: HConstructor;
|
||||
|
||||
var obj15: H | string;
|
||||
if (obj15 instanceof H) { // narrowed to H.
|
||||
obj15.foo;
|
||||
obj15.bar;
|
||||
}
|
||||
|
||||
var obj16: any;
|
||||
if (obj16 instanceof H) { // can't narrow type from 'any'
|
||||
obj16.foo1;
|
||||
obj16.foo2;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @BaselineFile: getEmitOutputOut.baseline
|
||||
// @out: out.js
|
||||
|
||||
// @Filename: my.d.ts
|
||||
// @emitThisFile: false
|
||||
////declare module foo.bar {
|
||||
//// class Baz { }
|
||||
////}
|
||||
|
||||
// @Filename: input0.ts
|
||||
// @emitThisFile: false
|
||||
/////// <reference path='my.d.ts' />
|
||||
////module foo.bar {
|
||||
//// var baz1 = <any>Baz.prototype; // Should emit as bar.Baz.prototype
|
||||
////}
|
||||
|
||||
// @Filename: input1.ts
|
||||
// @emitThisFile: true
|
||||
////var x;
|
||||
|
||||
verify.baselineGetEmitOutput();
|
||||
Reference in New Issue
Block a user