Merge remote-tracking branch 'origin/master' into pathMappingModuleResolution

This commit is contained in:
vladima
2015-12-03 22:49:55 -08:00
175 changed files with 1853 additions and 287 deletions
+4 -2
View File
@@ -36,11 +36,13 @@ Your pull request should:
The library sources are in: [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib)
To build the library files, run
Library files in `built/local/` are updated by running
```Shell
jake lib
jake
```
The files in `lib/` are used to bootstrap compilation and usually do not need to be updated.
#### `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts`
These two files represent the DOM typings and are auto-generated. To make any modifications to them, please submit a PR to https://github.com/Microsoft/TSJS-lib-generator
Binary file not shown.
+1 -1
View File
@@ -1323,7 +1323,7 @@ x = "hello"; // Ok
x = 42; // Ok
x = test; // Error, boolean not assignable
x = test ? 5 : "five"; // Ok
x = test ? 0 : false; // Error, number | boolean not asssignable
x = test ? 0 : false; // Error, number | boolean not assignable
```
it is possible to assign 'x' a value of type `string`, `number`, or the union type `string | number`, but not any other type. To access a value in 'x', a type guard can be used to first narrow the type of 'x' to either `string` or `number`:
+1 -1
View File
@@ -1,4 +1,4 @@
# Read this!
These files are not meant to be edited by hand.
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory.
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. Running `jake LKG` will then appropriately update the files in this directory.
+63 -51
View File
@@ -379,6 +379,14 @@ namespace ts {
return node.kind === SyntaxKind.SourceFile && !isExternalOrCommonJsModule(<SourceFile>node);
}
/** Is this type one of the apparent types created from the primitive types. */
function isPrimitiveApparentType(type: Type): boolean {
return type === globalStringType ||
type === globalNumberType ||
type === globalBooleanType ||
type === globalESSymbolType;
}
function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol {
if (meaning && hasProperty(symbols, name)) {
const symbol = symbols[name];
@@ -1521,9 +1529,9 @@ namespace ts {
return result;
}
function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string {
function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string {
const writer = getSingleLineStringWriter();
getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind);
const result = writer.string();
releaseStringWriter(writer);
@@ -1875,7 +1883,7 @@ namespace ts {
if (flags & TypeFormatFlags.InElementType) {
writePunctuation(writer, SyntaxKind.OpenParenToken);
}
buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, symbolStack);
buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, /*kind*/ undefined, symbolStack);
if (flags & TypeFormatFlags.InElementType) {
writePunctuation(writer, SyntaxKind.CloseParenToken);
}
@@ -1887,7 +1895,7 @@ namespace ts {
}
writeKeyword(writer, SyntaxKind.NewKeyword);
writeSpace(writer);
buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, symbolStack);
buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, /*kind*/ undefined, symbolStack);
if (flags & TypeFormatFlags.InElementType) {
writePunctuation(writer, SyntaxKind.CloseParenToken);
}
@@ -1901,15 +1909,12 @@ namespace ts {
writer.writeLine();
writer.increaseIndent();
for (const signature of resolved.callSignatures) {
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack);
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack);
writePunctuation(writer, SyntaxKind.SemicolonToken);
writer.writeLine();
}
for (const signature of resolved.constructSignatures) {
writeKeyword(writer, SyntaxKind.NewKeyword);
writeSpace(writer);
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack);
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, SignatureKind.Construct, symbolStack);
writePunctuation(writer, SyntaxKind.SemicolonToken);
writer.writeLine();
}
@@ -1950,7 +1955,7 @@ namespace ts {
if (p.flags & SymbolFlags.Optional) {
writePunctuation(writer, SyntaxKind.QuestionToken);
}
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack);
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack);
writePunctuation(writer, SyntaxKind.SemicolonToken);
writer.writeLine();
}
@@ -2070,7 +2075,12 @@ namespace ts {
buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack);
}
function buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) {
function buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, symbolStack?: Symbol[]) {
if (kind === SignatureKind.Construct) {
writeKeyword(writer, SyntaxKind.NewKeyword);
writeSpace(writer);
}
if (signature.target && (flags & TypeFormatFlags.WriteTypeArgumentsOfSignature)) {
// Instantiated signature, write type arguments instead
// This is achieved by passing in the mapper separately
@@ -5073,9 +5083,6 @@ namespace ts {
}
return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false);
}
if (source.flags & TypeFlags.TypeParameter && target.flags & TypeFlags.TypeParameter) {
return typeParameterIdenticalTo(<TypeParameter>source, <TypeParameter>target);
}
if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union ||
source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) {
if (result = eachTypeRelatedToSomeType(<UnionOrIntersectionType>source, <UnionOrIntersectionType>target)) {
@@ -5206,17 +5213,6 @@ namespace ts {
return result;
}
function typeParameterIdenticalTo(source: TypeParameter, target: TypeParameter): Ternary {
// covers case when both type parameters does not have constraint (both equal to noConstraintType)
if (source.constraint === target.constraint) {
return Ternary.True;
}
if (source.constraint === noConstraintType || target.constraint === noConstraintType) {
return Ternary.False;
}
return isIdenticalTo(source.constraint, target.constraint);
}
// Determine if two object types are related by structure. First, check if the result is already available in the global cache.
// Second, check if we have already started a comparison of the given two types in which case we assume the result to be true.
// Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are
@@ -5442,20 +5438,26 @@ namespace ts {
outer: for (const t of targetSignatures) {
if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) {
let localErrors = reportErrors;
const checkedAbstractAssignability = false;
// Only elaborate errors from the first failure
let shouldElaborateErrors = reportErrors;
for (const s of sourceSignatures) {
if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) {
const related = signatureRelatedTo(s, t, localErrors);
const related = signatureRelatedTo(s, t, shouldElaborateErrors);
if (related) {
result &= related;
errorInfo = saveErrorInfo;
continue outer;
}
// Only report errors from the first failure
localErrors = false;
shouldElaborateErrors = false;
}
}
// don't elaborate the primitive apparent types (like Number)
// because the actual primitives will have already been reported.
if (shouldElaborateErrors && !isPrimitiveApparentType(source)) {
reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1,
typeToString(source),
signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind));
}
return Ternary.False;
}
}
@@ -5765,26 +5767,19 @@ namespace ts {
if (!(isMatchingSignature(source, target, partialMatch))) {
return Ternary.False;
}
let result = Ternary.True;
if (source.typeParameters && target.typeParameters) {
if (source.typeParameters.length !== target.typeParameters.length) {
return Ternary.False;
}
for (let i = 0, len = source.typeParameters.length; i < len; ++i) {
const related = compareTypes(source.typeParameters[i], target.typeParameters[i]);
if (!related) {
return Ternary.False;
}
result &= related;
}
}
else if (source.typeParameters || target.typeParameters) {
// Check that the two signatures have the same number of type parameters. We might consider
// also checking that any type parameter constraints match, but that would require instantiating
// the constraints with a common set of type arguments to get relatable entities in places where
// type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile,
// particularly as we're comparing erased versions of the signatures below.
if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) {
return Ternary.False;
}
// Spec 1.0 Section 3.8.3 & 3.8.4:
// M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N
source = getErasedSignature(source);
target = getErasedSignature(target);
let result = Ternary.True;
const targetLen = target.parameters.length;
for (let i = 0; i < targetLen; i++) {
const s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
@@ -6183,9 +6178,12 @@ namespace ts {
}
else {
source = getApparentType(source);
if (source.flags & TypeFlags.ObjectType && (target.flags & (TypeFlags.Reference | TypeFlags.Tuple) ||
(target.flags & TypeFlags.Anonymous) && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class))) {
// If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members
if (source.flags & TypeFlags.ObjectType && (
target.flags & TypeFlags.Reference && (<TypeReference>target).typeArguments ||
target.flags & TypeFlags.Tuple ||
target.flags & TypeFlags.Anonymous && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class))) {
// If source is an object type, and target is a type reference with type arguments, a tuple type,
// the type of a method, or a type literal, infer from members
if (isInProcess(source, target)) {
return;
}
@@ -15967,13 +15965,27 @@ namespace ts {
if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
const variableList = <VariableDeclarationList>forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
if (variableList.declarations.length > 1) {
const declarations = variableList.declarations;
// declarations.length can be zero if there is an error in variable declaration in for-of or for-in
// See http://www.ecma-international.org/ecma-262/6.0/#sec-for-in-and-for-of-statements for details
// For example:
// var let = 10;
// for (let of [1,2,3]) {} // this is invalid ES6 syntax
// for (let in [1,2,3]) {} // this is invalid ES6 syntax
// We will then want to skip on grammar checking on variableList declaration
if (!declarations.length) {
return false;
}
if (declarations.length > 1) {
const diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement
? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
const firstDeclaration = variableList.declarations[0];
const firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
const diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement
? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
@@ -16172,7 +16184,7 @@ namespace ts {
}
}
const checkLetConstNames = languageVersion >= ScriptTarget.ES6 && (isLet(node) || isConst(node));
const checkLetConstNames = (isLet(node) || isConst(node));
// 1. LexicalDeclaration : LetOrConst BindingList ;
// It is a Syntax Error if the BoundNames of BindingList contains "let".
@@ -16186,7 +16198,7 @@ namespace ts {
function checkGrammarNameInLetOrConstDeclarations(name: Identifier | BindingPattern): boolean {
if (name.kind === SyntaxKind.Identifier) {
if ((<Identifier>name).text === "let") {
if ((<Identifier>name).originalKeywordKind === SyntaxKind.LetKeyword) {
return grammarErrorOnNode(name, Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
+4
View File
@@ -1732,6 +1732,10 @@
"category": "Error",
"code": 2657
},
"Type '{0}' provides no match for the signature '{1}'": {
"category": "Error",
"code": 2658
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
+25 -30
View File
@@ -3628,12 +3628,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// only allow export default at a source file level
if (modulekind === ModuleKind.CommonJS || modulekind === ModuleKind.AMD || modulekind === ModuleKind.UMD) {
if (!isEs6Module) {
if (languageVersion === ScriptTarget.ES5) {
if (languageVersion !== ScriptTarget.ES3) {
// default value of configurable, enumerable, writable are `false`.
write("Object.defineProperty(exports, \"__esModule\", { value: true });");
writeLine();
}
else if (languageVersion === ScriptTarget.ES3) {
else {
write("exports.__esModule = true;");
writeLine();
}
@@ -5171,35 +5171,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (!(node.flags & NodeFlags.Export)) {
return;
}
// If this is an exported class, but not on the top level (i.e. on an internal
// module), export it
if (node.flags & NodeFlags.Default) {
// if this is a top level default export of decorated class, write the export after the declaration.
writeLine();
if (thisNodeIsDecorated && modulekind === ModuleKind.ES6) {
write("export default ");
emitDeclarationName(node);
write(";");
}
else if (modulekind === ModuleKind.System) {
write(`${exportFunctionForFile}("default", `);
emitDeclarationName(node);
write(");");
}
else if (modulekind !== ModuleKind.ES6) {
write(`exports.default = `);
emitDeclarationName(node);
write(";");
}
if (modulekind !== ModuleKind.ES6) {
emitExportMemberAssignment(node as ClassDeclaration);
}
else if (node.parent.kind !== SyntaxKind.SourceFile || (modulekind !== ModuleKind.ES6 && !(node.flags & NodeFlags.Default))) {
writeLine();
emitStart(node);
emitModuleMemberName(node);
write(" = ");
emitDeclarationName(node);
emitEnd(node);
write(";");
else {
// If this is an exported class, but not on the top level (i.e. on an internal
// module), export it
if (node.flags & NodeFlags.Default) {
// if this is a top level default export of decorated class, write the export after the declaration.
if (thisNodeIsDecorated) {
writeLine();
write("export default ");
emitDeclarationName(node);
write(";");
}
}
else if (node.parent.kind !== SyntaxKind.SourceFile) {
writeLine();
emitStart(node);
emitModuleMemberName(node);
write(" = ");
emitDeclarationName(node);
emitEnd(node);
write(";");
}
}
}
+8 -8
View File
@@ -1030,19 +1030,17 @@ namespace ts {
}
function getSemanticDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
// For JavaScript files, we don't want to report the normal typescript semantic errors.
// Instead, we just report errors for using TypeScript-only constructs from within a
// JavaScript file.
if (isSourceFileJavaScript(sourceFile)) {
return getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken);
}
return runWithCancellationToken(() => {
const typeChecker = getDiagnosticsProducingTypeChecker();
Debug.assert(!!sourceFile.bindDiagnostics);
const bindDiagnostics = sourceFile.bindDiagnostics;
const checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken);
// For JavaScript files, we don't want to report the normal typescript semantic errors.
// Instead, we just report errors for using TypeScript-only constructs from within a
// JavaScript file.
const checkDiagnostics = isSourceFileJavaScript(sourceFile) ?
getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) :
typeChecker.getDiagnostics(sourceFile, cancellationToken);
const fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
@@ -1448,6 +1446,8 @@ namespace ts {
const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
if (importedFile && resolution.isExternalLibraryImport) {
// Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files,
// this check is ok. Otherwise this would be never true for javascript file
if (!isExternalModule(importedFile)) {
const start = getTokenPosOfNode(file.imports[i], file);
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
+54 -2
View File
@@ -47,6 +47,21 @@ namespace ts {
constructor(o: any);
}
declare var ChakraHost: {
args: string[];
currentDirectory: string;
executingFile: string;
echo(s: string): void;
quit(exitCode?: number): void;
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
createDirectory(path: string): void;
resolvePath(path: string): string;
readFile(path: string): string;
writeFile(path: string, contents: string): void;
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
};
export var sys: System = (function () {
function getWScriptSystem(): System {
@@ -194,6 +209,7 @@ namespace ts {
}
};
}
function getNodeSystem(): System {
const _fs = require("fs");
const _path = require("path");
@@ -281,7 +297,7 @@ namespace ts {
// REVIEW: for now this implementation uses polling.
// The advantage of polling is that it works reliably
// on all os and with network mounted files.
// For 90 referenced files, the average time to detect
// For 90 referenced files, the average time to detect
// changes is 2*msInterval (by default 5 seconds).
// The overhead of this is .04 percent (1/2500) with
// average pause of < 1 millisecond (and max
@@ -406,7 +422,7 @@ namespace ts {
};
},
watchDirectory: (path, callback, recursive) => {
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
return _fs.watch(
path,
@@ -454,6 +470,37 @@ namespace ts {
}
};
}
function getChakraSystem(): System {
return {
newLine: "\r\n",
args: ChakraHost.args,
useCaseSensitiveFileNames: false,
write: ChakraHost.echo,
readFile(path: string, encoding?: string) {
// encoding is automatically handled by the implementation in ChakraHost
return ChakraHost.readFile(path);
},
writeFile(path: string, data: string, writeByteOrderMark?: boolean) {
// If a BOM is required, emit one
if (writeByteOrderMark) {
data = "\uFEFF" + data;
}
ChakraHost.writeFile(path, data);
},
resolvePath: ChakraHost.resolvePath,
fileExists: ChakraHost.fileExists,
directoryExists: ChakraHost.directoryExists,
createDirectory: ChakraHost.createDirectory,
getExecutingFilePath: () => ChakraHost.executingFile,
getCurrentDirectory: () => ChakraHost.currentDirectory,
readDirectory: ChakraHost.readDirectory,
exit: ChakraHost.quit,
};
}
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
return getWScriptSystem();
}
@@ -462,8 +509,13 @@ namespace ts {
// process.browser check excludes webpack and browserify
return getNodeSystem();
}
else if (typeof ChakraHost !== "undefined") {
return getChakraSystem();
}
else {
return undefined; // Unsupported host
}
})();
}
+1 -1
View File
@@ -1757,7 +1757,7 @@ namespace ts {
export interface SymbolDisplayBuilder {
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void;
+5 -3
View File
@@ -1889,8 +1889,10 @@ namespace ts {
* Resolves a local path to a path which is absolute to the base of the emit
*/
export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string {
const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
const relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false);
const getCanonicalFileName = (f: string) => host.getCanonicalFileName(f);
const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);
const filePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
const relativePath = getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
return removeFileExtension(relativePath);
}
@@ -2398,7 +2400,7 @@ namespace ts {
* Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph
* as the fallback implementation does not check for circular references by default.
*/
export const stringify: (value: any) => string = JSON && JSON.stringify
export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify
? JSON.stringify
: stringifyFallback;
@@ -11,11 +11,13 @@ define(["require", "exports"], function (require, exports) {
"use strict";
class default_1 {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
});
//// [b.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function default_1() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
});
@@ -10,8 +10,10 @@ export default function() {}
"use strict";
class default_1 {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
//// [b.js]
"use strict";
function default_1() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
@@ -18,6 +18,7 @@ export default function() {}
"use strict";
class default_1 {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
});
//// [b.js]
@@ -31,5 +32,6 @@ export default function() {}
})(function (require, exports) {
"use strict";
function default_1() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
});
@@ -1,11 +1,19 @@
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(28,1): error TS2322: Type 'S2' is not assignable to type 'T'.
Type 'S2' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(29,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T'.
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(30,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(31,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(32,1): error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'.
Type 'S2' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(33,1): error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(34,1): error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'.
Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(35,1): error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'.
Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts (8 errors) ====
@@ -39,25 +47,33 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
t = s2;
~
!!! error TS2322: Type 'S2' is not assignable to type 'T'.
!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void'
t = a3;
~
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'T'.
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
t = (x: string) => 1;
~
!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
t = function (x: string) { return ''; }
~
!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
a = s2;
~
!!! error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void'
a = a3;
~
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
a = (x: string) => 1;
~
!!! error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
a = function (x: string) { return ''; }
~
!!! error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
@@ -9,9 +9,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(34,1): error TS2322: Type 'S2' is not assignable to type 'T'.
Types of property 'f' are incompatible.
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(35,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'.
Types of property 'f' are incompatible.
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(36,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
Property 'f' is missing in type '(x: string) => number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(37,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
@@ -19,9 +21,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(38,1): error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'.
Types of property 'f' are incompatible.
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(39,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'.
Types of property 'f' are incompatible.
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(40,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'.
Property 'f' is missing in type '(x: string) => number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(41,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }'.
@@ -79,11 +83,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type 'S2' is not assignable to type 'T'.
!!! error TS2322: Types of property 'f' are incompatible.
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
t = a3;
~
!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'.
!!! error TS2322: Types of property 'f' are incompatible.
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
t = (x: string) => 1;
~
!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
@@ -97,11 +103,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'.
!!! error TS2322: Types of property 'f' are incompatible.
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
a = a3;
~
!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'.
!!! error TS2322: Types of property 'f' are incompatible.
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
a = (x: string) => 1;
~
!!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'.
@@ -11,12 +11,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new <T>(x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'.
Types of parameters 'x' and 'x' are incompatible.
Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'.
Type '(a: any) => any' provides no match for the signature 'new (a: number): number'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
Types of parameters 'x' and 'x' are incompatible.
Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new <T>(x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }'.
Types of parameters 'x' and 'x' are incompatible.
Type '(a: any) => any' is not assignable to type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }'.
Type '(a: any) => any' provides no match for the signature 'new <T extends Derived>(a: T): T'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
Types of parameters 'x' and 'x' are incompatible.
Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' is not assignable to type '(a: any) => any'.
@@ -116,6 +118,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type 'new <T>(x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'.
!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number'
b16 = a16; // error
~~~
!!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
@@ -128,6 +131,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type 'new <T>(x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }'.
!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new <T extends Derived>(a: T): T'
b17 = a17; // error
~~~
!!! error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
@@ -1,4 +1,5 @@
tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
==== tests/cases/compiler/assignmentCompatability24.ts (1 errors) ====
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'inte
}
__test2__.__val__obj = __test1__.__val__obj4
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
@@ -1,4 +1,5 @@
tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
==== tests/cases/compiler/assignmentCompatability33.ts (1 errors) ====
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'inte
}
__test2__.__val__obj = __test1__.__val__obj4
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
@@ -1,4 +1,5 @@
tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tnumber>(a: Tnumber) => Tnumber'.
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tnumber>(a: Tnumber): Tnumber'
==== tests/cases/compiler/assignmentCompatability34.ts (1 errors) ====
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'inte
}
__test2__.__val__obj = __test1__.__val__obj4
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tnumber>(a: Tnumber) => Tnumber'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tnumber>(a: Tnumber) => Tnumber'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tnumber>(a: Tnumber): Tnumber'
@@ -1,4 +1,5 @@
tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tnumber>(param: Tnumber) => any'.
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tnumber>(param: Tnumber): any'
==== tests/cases/compiler/assignmentCompatability37.ts (1 errors) ====
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'inte
}
__test2__.__val__aa = __test1__.__val__obj4
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tnumber>(param: Tnumber) => any'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tnumber>(param: Tnumber) => any'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tnumber>(param: Tnumber): any'
@@ -1,4 +1,5 @@
tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tstring>(param: Tstring) => any'.
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tstring>(param: Tstring): any'
==== tests/cases/compiler/assignmentCompatability38.ts (1 errors) ====
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'inte
}
__test2__.__val__aa = __test1__.__val__obj4
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tstring>(param: Tstring) => any'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tstring>(param: Tstring) => any'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tstring>(param: Tstring): any'
@@ -1,5 +1,7 @@
tests/cases/compiler/callConstructAssignment.ts(7,1): error TS2322: Type 'new () => any' is not assignable to type '() => void'.
Type 'new () => any' provides no match for the signature '(): void'
tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() => void' is not assignable to type 'new () => any'.
Type '() => void' provides no match for the signature 'new (): any'
==== tests/cases/compiler/callConstructAssignment.ts (2 errors) ====
@@ -12,6 +14,8 @@ tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() =>
foo = bar; // error
~~~
!!! error TS2322: Type 'new () => any' is not assignable to type '() => void'.
!!! error TS2322: Type 'new () => any' provides no match for the signature '(): void'
bar = foo; // error
~~~
!!! error TS2322: Type '() => void' is not assignable to type 'new () => any'.
!!! error TS2322: Type '() => void' is not assignable to type 'new () => any'.
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
@@ -16,17 +16,17 @@ export var pi = Math.PI;
export var y = x * i;
//// [concat.js]
define("tests/cases/compiler/baz", ["require", "exports", "tests/cases/compiler/a/bar", "tests/cases/compiler/a/foo"], function (require, exports, bar_1, foo_1) {
define("baz", ["require", "exports", "a/bar", "a/foo"], function (require, exports, bar_1, foo_1) {
"use strict";
exports.pi = Math.PI;
exports.y = bar_1.x * foo_1.i;
});
define("tests/cases/compiler/a/foo", ["require", "exports", "tests/cases/compiler/baz"], function (require, exports, baz_1) {
define("a/foo", ["require", "exports", "baz"], function (require, exports, baz_1) {
"use strict";
exports.i = Math.sqrt(-1);
exports.z = baz_1.pi * baz_1.pi;
});
define("tests/cases/compiler/a/bar", ["require", "exports", "tests/cases/compiler/a/foo"], function (require, exports, foo_2) {
define("a/bar", ["require", "exports", "a/foo"], function (require, exports, foo_2) {
"use strict";
exports.x = foo_2.z + foo_2.z;
});
@@ -1,10 +1,12 @@
tests/cases/compiler/constructorAsType.ts(1,5): error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'.
Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }'
==== tests/cases/compiler/constructorAsType.ts (1 errors) ====
var Person:new () => {name: string;} = function () {return {name:"joe"};};
~~~~~~
!!! error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'.
!!! error TS2322: Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }'
var Person2:{new() : {name:string;};};
@@ -28,6 +28,7 @@ define(["require", "exports"], function (require, exports) {
Foo = __decorate([
decorator
], Foo);
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Foo;
});
//// [b.js]
@@ -45,5 +46,6 @@ define(["require", "exports"], function (require, exports) {
default_1 = __decorate([
decorator
], default_1);
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
});
@@ -27,6 +27,7 @@ let Foo = class {
Foo = __decorate([
decorator
], Foo);
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Foo;
//// [b.js]
"use strict";
@@ -42,4 +43,5 @@ let default_1 = class {
default_1 = __decorate([
decorator
], default_1);
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
@@ -35,6 +35,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
Foo = __decorate([
decorator
], Foo);
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Foo;
});
//// [b.js]
@@ -59,5 +60,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
default_1 = __decorate([
decorator
], default_1);
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
});
@@ -12,11 +12,13 @@ define(["require", "exports"], function (require, exports) {
"use strict";
class Foo {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Foo;
});
//// [b.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function foo() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = foo;
});
@@ -11,8 +11,10 @@ export default function foo() {}
"use strict";
class Foo {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Foo;
//// [b.js]
"use strict";
function foo() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = foo;
@@ -19,6 +19,7 @@ export default function foo() {}
"use strict";
class Foo {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Foo;
});
//// [b.js]
@@ -32,5 +33,6 @@ export default function foo() {}
})(function (require, exports) {
"use strict";
function foo() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = foo;
});
@@ -27,6 +27,7 @@ var x1: number = m;
exports.a = 10;
exports.x = exports.a;
exports.m = exports.a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {};
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js]
"use strict";
@@ -41,6 +41,7 @@ export { a, b, c, d, e1, e2, f1, f2 };
//// [t1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = "hello";
//// [t3.js]
"use strict";
@@ -10,7 +10,7 @@ function foo() {
//// [a.js]
define("tests/cases/compiler/a", ["require", "exports"], function (require, exports) {
define("a", ["require", "exports"], function (require, exports) {
"use strict";
var c = (function () {
function c() {
@@ -3,15 +3,21 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
Type 'Function' provides no match for the signature '(x: string): string'
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string[]' is not assignable to type 'string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
Type 'typeof C' provides no match for the signature '(x: string): string'
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
Type 'new (x: string) => string' provides no match for the signature '(x: string): string'
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '<U, V>(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(29,16): error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'.
Type 'typeof C2' provides no match for the signature '(x: string): string'
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(30,16): error TS2345: Argument of type 'new <T>(x: T) => T' is not assignable to parameter of type '(x: string) => string'.
Type 'new <T>(x: T) => T' provides no match for the signature '(x: string): string'
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
Type 'F2' provides no match for the signature '(x: string): string'
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
Type '() => void' is not assignable to type '(x: string) => string'.
@@ -51,6 +57,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
var r = foo2(new Function());
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'Function' provides no match for the signature '(x: string): string'
var r2 = foo2((x: string[]) => x);
~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
@@ -59,9 +66,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
var r6 = foo2(C);
~
!!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'typeof C' provides no match for the signature '(x: string): string'
var r7 = foo2(b);
~
!!! error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'new (x: string) => string' provides no match for the signature '(x: string): string'
var r8 = foo2(<U>(x: U) => x); // no error expected
var r11 = foo2(<U, V>(x: U, y: V) => x);
~~~~~~~~~~~~~~~~~~~~~~~
@@ -69,15 +78,18 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
var r13 = foo2(C2);
~~
!!! error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'typeof C2' provides no match for the signature '(x: string): string'
var r14 = foo2(b2);
~~
!!! error TS2345: Argument of type 'new <T>(x: T) => T' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'new <T>(x: T) => T' provides no match for the signature '(x: string): string'
interface F2 extends Function { foo: string; }
var f2: F2;
var r16 = foo2(f2);
~~
!!! error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'F2' provides no match for the signature '(x: string): string'
function fff<T extends { (): void }, U extends T>(x: T, y: U) {
~~~~~~~~~~~
@@ -1,4 +1,5 @@
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'.
Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>'
==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts (1 errors) ====
@@ -10,4 +11,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): erro
} ()
~~~~~~~~
!!! error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'.
!!! error TS2322: Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>'
}
@@ -0,0 +1,32 @@
//// [genericSignatureIdentity.ts]
// This test is here to remind us of our current limits of type identity checking.
// Ideally all of the below declarations would be considered different (and thus errors)
// but they aren't because we erase type parameters to type any and don't check that
// constraints are identical.
var x: {
<T extends Date>(x: T): T;
};
var x: {
<T extends number>(x: T): T;
};
var x: {
<T>(x: T): T;
};
var x: {
<T>(x: any): any;
};
//// [genericSignatureIdentity.js]
// This test is here to remind us of our current limits of type identity checking.
// Ideally all of the below declarations would be considered different (and thus errors)
// but they aren't because we erase type parameters to type any and don't check that
// constraints are identical.
var x;
var x;
var x;
var x;
@@ -0,0 +1,49 @@
=== tests/cases/compiler/genericSignatureIdentity.ts ===
// This test is here to remind us of our current limits of type identity checking.
// Ideally all of the below declarations would be considered different (and thus errors)
// but they aren't because we erase type parameters to type any and don't check that
// constraints are identical.
var x: {
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
<T extends Date>(x: T): T;
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 6, 21))
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5))
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5))
};
var x: {
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
<T extends number>(x: T): T;
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5))
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 10, 23))
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5))
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5))
};
var x: {
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
<T>(x: T): T;
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5))
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 14, 8))
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5))
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5))
};
var x: {
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
<T>(x: any): any;
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 18, 5))
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 18, 8))
};
@@ -0,0 +1,49 @@
=== tests/cases/compiler/genericSignatureIdentity.ts ===
// This test is here to remind us of our current limits of type identity checking.
// Ideally all of the below declarations would be considered different (and thus errors)
// but they aren't because we erase type parameters to type any and don't check that
// constraints are identical.
var x: {
>x : <T extends Date>(x: T) => T
<T extends Date>(x: T): T;
>T : T
>Date : Date
>x : T
>T : T
>T : T
};
var x: {
>x : <T extends Date>(x: T) => T
<T extends number>(x: T): T;
>T : T
>x : T
>T : T
>T : T
};
var x: {
>x : <T extends Date>(x: T) => T
<T>(x: T): T;
>T : T
>x : T
>T : T
>T : T
};
var x: {
>x : <T extends Date>(x: T) => T
<T>(x: any): any;
>T : T
>x : any
};
@@ -14,17 +14,24 @@ tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(106,21): error TS2304: Cannot find name 'i1'.
tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'.
Type '{}' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'.
Type 'Object' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
Type 'Base' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(120,22): error TS2304: Cannot find name 'i2'.
tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'.
Type '{}' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'.
Type 'Object' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'.
Type 'Base' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
Type '() => void' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'.
@@ -50,9 +57,12 @@ tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(162,22): error TS2304: Cannot find name 'i5'.
tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'.
Type '{}' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'.
Type 'Object' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'.
Type 'Base' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'.
Type 'void' is not assignable to type 'number'.
tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
@@ -60,9 +70,13 @@ tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(176,22): error TS2304: Cannot find name 'i6'.
tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'.
Type '{}' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'.
Type 'Object' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other.
Type 'Base' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
Type '() => void' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'.
@@ -216,15 +230,18 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
var obj12: i2 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i2'.
!!! error TS2322: Type '{}' provides no match for the signature '(): any'
var obj13: i2 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i2'.
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
var obj14: i2 = new obj11;
~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
var obj15: i2 = new Base;
~~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i2'.
!!! error TS2322: Type 'Base' provides no match for the signature '(): any'
var obj16: i2 = null;
var obj17: i2 = function ():any { return 0; };
//var obj18: i2 = function foo() { };
@@ -246,17 +263,21 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
var obj23: i3 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i3'.
!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'
var obj24: i3 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i3'.
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
var obj25: i3 = new obj22;
var obj26: i3 = new Base;
~~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i3'.
!!! error TS2322: Type 'Base' provides no match for the signature 'new (): any'
var obj27: i3 = null;
var obj28: i3 = function () { };
~~~~~
!!! error TS2322: Type '() => void' is not assignable to type 'i3'.
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
//var obj29: i3 = function foo() { };
var obj30: i3 = <i3> anyVar;
var obj31: i3 = new <i3> anyVar;
@@ -338,15 +359,18 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
var obj56: i6 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i6'.
!!! error TS2322: Type '{}' provides no match for the signature '(): any'
var obj57: i6 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i6'.
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
var obj58: i6 = new obj55;
~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
var obj59: i6 = new Base;
~~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i6'.
!!! error TS2322: Type 'Base' provides no match for the signature '(): any'
var obj60: i6 = null;
var obj61: i6 = function () { };
~~~~~
@@ -371,17 +395,21 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
var obj67: i7 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i7'.
!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'
var obj68: i7 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i7'.
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
var obj69: i7 = new obj66;
var obj70: i7 = <i7>new Base;
~~~~~~~~~~~~
!!! error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other.
!!! error TS2352: Type 'Base' provides no match for the signature 'new (): any'
var obj71: i7 = null;
var obj72: i7 = function () { };
~~~~~
!!! error TS2322: Type '() => void' is not assignable to type 'i7'.
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
//var obj73: i7 = function foo() { };
var obj74: i7 = <i7> anyVar;
var obj75: i7 = new <i7> anyVar;
@@ -3,6 +3,7 @@ tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1'
tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1' incorrectly implements interface 'I2'.
Property 'iFn' is private in type 'C1' but not in type 'I2'.
tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() => C2' is not assignable to type 'I4'.
Type '() => C2' provides no match for the signature 'new (): I3'
==== tests/cases/compiler/interfaceImplementation1.ts (3 errors) ====
@@ -48,6 +49,7 @@ tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() =
var a:I4 = function(){
~
!!! error TS2322: Type '() => C2' is not assignable to type 'I4'.
!!! error TS2322: Type '() => C2' provides no match for the signature 'new (): I3'
return new C2();
}
new a();
@@ -0,0 +1,22 @@
tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(5,13): error TS1005: '=' expected.
tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(5,20): error TS1005: ',' expected.
tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(7,1): error TS1005: ';' expected.
==== tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts (3 errors) ====
// This should be an error
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
var let = 10;
for (let of [1,2,3]) {}
~
!!! error TS1005: '=' expected.
~
!!! error TS1005: ',' expected.
for (let in [1,2,3]) {}
~~~
!!! error TS1005: ';' expected.
@@ -0,0 +1,18 @@
//// [invalidLetInForOfAndForIn_ES5.ts]
// This should be an error
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
var let = 10;
for (let of [1,2,3]) {}
for (let in [1,2,3]) {}
//// [invalidLetInForOfAndForIn_ES5.js]
// This should be an error
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
var let = 10;
for (let of = [1, 2, 3], { }; ; )
for ( in [1, 2, 3]) { }
@@ -0,0 +1,22 @@
tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(5,13): error TS1005: '=' expected.
tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(5,20): error TS1005: ',' expected.
tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(7,1): error TS1005: ';' expected.
==== tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts (3 errors) ====
// This should be an error
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
var let = 10;
for (let of [1,2,3]) {}
~
!!! error TS1005: '=' expected.
~
!!! error TS1005: ',' expected.
for (let in [1,2,3]) {}
~~~
!!! error TS1005: ';' expected.
@@ -0,0 +1,18 @@
//// [invalidLetInForOfAndForIn_ES6.ts]
// This should be an error
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
var let = 10;
for (let of [1,2,3]) {}
for (let in [1,2,3]) {}
//// [invalidLetInForOfAndForIn_ES6.js]
// This should be an error
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
var let = 10;
for (let of = [1, 2, 3], { }; ; )
for ( in [1, 2, 3]) { }
@@ -0,0 +1,12 @@
tests/cases/compiler/a.js(1,5): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/a.js(2,7): error TS2300: Duplicate identifier 'a'.
==== tests/cases/compiler/a.js (2 errors) ====
var a = 10;
~
!!! error TS2300: Duplicate identifier 'a'.
class a {
~
!!! error TS2300: Duplicate identifier 'a'.
}
@@ -0,0 +1,27 @@
tests/cases/compiler/a.js(1,5): error TS2451: Cannot redeclare block-scoped variable 'C'.
tests/cases/compiler/a.js(2,5): error TS2451: Cannot redeclare block-scoped variable 'C'.
tests/cases/compiler/a.js(6,5): error TS7027: Unreachable code detected.
tests/cases/compiler/a.js(11,9): error TS1100: Invalid use of 'arguments' in strict mode.
==== tests/cases/compiler/a.js (4 errors) ====
let C = "sss";
~
!!! error TS2451: Cannot redeclare block-scoped variable 'C'.
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
~
!!! error TS2451: Cannot redeclare block-scoped variable 'C'.
function f() {
return;
return; // Error: Unreachable code detected.
~~~~~~
!!! error TS7027: Unreachable code detected.
}
function b() {
"use strict";
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
~~~~~~~~~
!!! error TS1100: Invalid use of 'arguments' in strict mode.
}
@@ -1,21 +0,0 @@
=== tests/cases/compiler/a.js ===
let C = "sss";
>C : Symbol(C, Decl(a.js, 0, 3))
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
>C : Symbol(C, Decl(a.js, 1, 3))
function f() {
>f : Symbol(f, Decl(a.js, 1, 10))
return;
return; // Error: Unreachable code detected.
}
function b() {
>b : Symbol(b, Decl(a.js, 6, 1))
"use strict";
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
>arguments : Symbol(arguments, Decl(a.js, 10, 7))
}
@@ -1,26 +0,0 @@
=== tests/cases/compiler/a.js ===
let C = "sss";
>C : string
>"sss" : string
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
>C : number
>0 : number
function f() {
>f : () => void
return;
return; // Error: Unreachable code detected.
}
function b() {
>b : () => void
"use strict";
>"use strict" : string
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
>arguments : number
>0 : number
}
@@ -0,0 +1,18 @@
tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports.
tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports.
tests/cases/compiler/a.js(3,1): error TS8003: 'export=' can only be used in a .ts file.
tests/cases/compiler/a.js(3,16): error TS1109: Expression expected.
==== tests/cases/compiler/a.js (4 errors) ====
export default class a {
~
!!! error TS2528: A module cannot have multiple default exports.
}
export default var a = 10;
~~~~~~~~~~~~~~
!!! error TS2528: A module cannot have multiple default exports.
~~~~~~~~~~~~~~
!!! error TS8003: 'export=' can only be used in a .ts file.
~~~
!!! error TS1109: Expression expected.
@@ -0,0 +1,31 @@
tests/cases/compiler/a.js(3,9): error TS7029: Fallthrough case in switch.
tests/cases/compiler/a.js(16,5): error TS7027: Unreachable code detected.
tests/cases/compiler/a.js(19,1): error TS7028: Unused label.
==== tests/cases/compiler/a.js (3 errors) ====
function foo(a, b) {
switch (a) {
case 10:
~~~~
!!! error TS7029: Fallthrough case in switch.
if (b) {
return b;
}
case 20:
return a;
}
}
function bar() {
return x;
function bar2() {
}
var x = 10; // error
~~~
!!! error TS7027: Unreachable code detected.
}
label1: var x2 = 10;
~~~~~~
!!! error TS7028: Unused label.
@@ -0,0 +1,81 @@
tests/cases/compiler/a.js(3,5): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/a.js(5,5): error TS1117: An object literal cannot have multiple properties with the same name in strict mode.
tests/cases/compiler/a.js(5,5): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
tests/cases/compiler/a.js(8,8): error TS1102: 'delete' cannot be called on an identifier in strict mode.
tests/cases/compiler/a.js(10,10): error TS1100: Invalid use of 'eval' in strict mode.
tests/cases/compiler/a.js(12,10): error TS1100: Invalid use of 'arguments' in strict mode.
tests/cases/compiler/a.js(15,1): error TS1101: 'with' statements are not allowed in strict mode.
tests/cases/compiler/b.js(3,7): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
tests/cases/compiler/b.js(6,13): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/c.js(1,12): error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode.
tests/cases/compiler/c.js(2,5): error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode.
tests/cases/compiler/d.js(2,9): error TS1121: Octal literals are not allowed in strict mode.
tests/cases/compiler/d.js(2,11): error TS1005: ',' expected.
==== tests/cases/compiler/a.js (8 errors) ====
"use strict";
var a = {
a: "hello", // error
~
!!! error TS2300: Duplicate identifier 'a'.
b: 10,
a: 10 // error
~
!!! error TS1117: An object literal cannot have multiple properties with the same name in strict mode.
~
!!! error TS2300: Duplicate identifier 'a'.
};
var let = 10; // error
~~~
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
delete a; // error
~
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
try {
} catch (eval) { // error
~~~~
!!! error TS1100: Invalid use of 'eval' in strict mode.
}
function arguments() { // error
~~~~~~~~~
!!! error TS1100: Invalid use of 'arguments' in strict mode.
}
with (a) {
~~~~
!!! error TS1101: 'with' statements are not allowed in strict mode.
b = 10;
}
==== tests/cases/compiler/b.js (2 errors) ====
// this is not in strict mode but class definitions are always in strict mode
class c {
a(eval) { //error
~~~~
!!! error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
}
method() {
var let = 10; // error
~~~
!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
}
}
==== tests/cases/compiler/c.js (2 errors) ====
export var let = 10; // external modules are automatically in strict mode
~~~
!!! error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode.
var eval = function () {
~~~~
!!! error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode.
};
==== tests/cases/compiler/d.js (2 errors) ====
"use strict";
var x = 009; // error
~~
!!! error TS1121: Octal literals are not allowed in strict mode.
~
!!! error TS1005: ',' expected.
@@ -1,9 +1,12 @@
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file.
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
==== tests/cases/compiler/a.js (1 errors) ====
==== tests/cases/compiler/a.js (2 errors) ====
export = b;
~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
~~~~~~~~~~~
!!! error TS8003: 'export=' can only be used in a .ts file.
@@ -0,0 +1,19 @@
tests/cases/compiler/moduleA/a.js(2,17): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/b.ts' is not a module. Please contact the package author to update the package definition.
==== tests/cases/compiler/moduleA/a.js (1 errors) ====
import {a} from "b";
~~~
!!! error TS2656: Exported external package typings file 'b.ts' is not a module. Please contact the package author to update the package definition.
a++;
import {c} from "c";
c++;
==== tests/cases/compiler/node_modules/b.ts (0 errors) ====
var a = 10;
==== tests/cases/compiler/node_modules/c.js (0 errors) ====
exports.a = 10;
c = 10;
@@ -0,0 +1,6 @@
//// [letAsIdentifier2.ts]
function let() {}
//// [letAsIdentifier2.js]
function let() { }
@@ -0,0 +1,5 @@
=== tests/cases/compiler/letAsIdentifier2.ts ===
function let() {}
>let : Symbol(let, Decl(letAsIdentifier2.ts, 0, 0))
@@ -0,0 +1,5 @@
=== tests/cases/compiler/letAsIdentifier2.ts ===
function let() {}
>let : () => void
@@ -0,0 +1,16 @@
tests/cases/compiler/letInConstDeclarations_ES5.ts(3,15): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInConstDeclarations_ES5.ts(6,19): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInConstDeclarations_ES5.ts (2 errors) ====
// All use of let in const declaration should be an error
const x = 50, let = 5;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
{
const x = 10, let = 20;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
@@ -0,0 +1,15 @@
//// [letInConstDeclarations_ES5.ts]
// All use of let in const declaration should be an error
const x = 50, let = 5;
{
const x = 10, let = 20;
}
//// [letInConstDeclarations_ES5.js]
// All use of let in const declaration should be an error
var x = 50, let = 5;
{
var x_1 = 10, let_1 = 20;
}
@@ -0,0 +1,16 @@
tests/cases/compiler/letInConstDeclarations_ES6.ts(3,15): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInConstDeclarations_ES6.ts(6,19): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInConstDeclarations_ES6.ts (2 errors) ====
// All use of let in const declaration should be an error
const x = 50, let = 5;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
{
const x = 10, let = 20;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
@@ -0,0 +1,15 @@
//// [letInConstDeclarations_ES6.ts]
// All use of let in const declaration should be an error
const x = 50, let = 5;
{
const x = 10, let = 20;
}
//// [letInConstDeclarations_ES6.js]
// All use of let in const declaration should be an error
const x = 50, let = 5;
{
const x = 10, let = 20;
}
@@ -0,0 +1,48 @@
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(3,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(5,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(7,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(9,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(12,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(14,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(16,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(18,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts (8 errors) ====
// Should be an error
for (let let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (let let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
{
for (let let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (let let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
@@ -0,0 +1,43 @@
//// [letInLetConstDeclOfForOfAndForIn_ES5.ts]
// Should be an error
for (let let of [1,2,3]) {}
for (const let of [1,2,3]) {}
for (let let in [1,2,3]) {}
for (const let in [1,2,3]) {}
{
for (let let of [1,2,3]) {}
for (const let of [1,2,3]) {}
for (let let in [1,2,3]) {}
for (const let in [1,2,3]) {}
}
//// [letInLetConstDeclOfForOfAndForIn_ES5.js]
// Should be an error
for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) {
var let = _a[_i];
}
for (var _b = 0, _c = [1, 2, 3]; _b < _c.length; _b++) {
var let = _c[_b];
}
for (var let in [1, 2, 3]) { }
for (var let in [1, 2, 3]) { }
{
for (var _d = 0, _e = [1, 2, 3]; _d < _e.length; _d++) {
var let = _e[_d];
}
for (var _f = 0, _g = [1, 2, 3]; _f < _g.length; _f++) {
var let = _g[_f];
}
for (var let in [1, 2, 3]) { }
for (var let in [1, 2, 3]) { }
}
@@ -0,0 +1,48 @@
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(3,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(5,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(7,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(9,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(12,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(14,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(16,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(18,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts (8 errors) ====
// Should be an error
for (let let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (let let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
{
for (let let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let of [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (let let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (const let in [1,2,3]) {}
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
@@ -0,0 +1,35 @@
//// [letInLetConstDeclOfForOfAndForIn_ES6.ts]
// Should be an error
for (let let of [1,2,3]) {}
for (const let of [1,2,3]) {}
for (let let in [1,2,3]) {}
for (const let in [1,2,3]) {}
{
for (let let of [1,2,3]) {}
for (const let of [1,2,3]) {}
for (let let in [1,2,3]) {}
for (const let in [1,2,3]) {}
}
//// [letInLetConstDeclOfForOfAndForIn_ES6.js]
// Should be an error
for (let let of [1, 2, 3]) { }
for (const let of [1, 2, 3]) { }
for (let let in [1, 2, 3]) { }
for (const let in [1, 2, 3]) { }
{
for (let let of [1, 2, 3]) { }
for (const let of [1, 2, 3]) { }
for (let let in [1, 2, 3]) { }
for (const let in [1, 2, 3]) { }
}
@@ -0,0 +1,16 @@
tests/cases/compiler/letInLetDeclarations_ES5.ts(3,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetDeclarations_ES5.ts(6,17): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInLetDeclarations_ES5.ts (2 errors) ====
// All use of let in const declaration should be an error
let x = 50, let = 5;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
{
let x = 10, let = 20;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
@@ -0,0 +1,15 @@
//// [letInLetDeclarations_ES5.ts]
// All use of let in const declaration should be an error
let x = 50, let = 5;
{
let x = 10, let = 20;
}
//// [letInLetDeclarations_ES5.js]
// All use of let in const declaration should be an error
var x = 50, let = 5;
{
var x_1 = 10, let_1 = 20;
}
@@ -0,0 +1,16 @@
tests/cases/compiler/letInLetDeclarations_ES6.ts(3,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetDeclarations_ES6.ts(6,17): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInLetDeclarations_ES6.ts (2 errors) ====
// All use of let in const declaration should be an error
let x = 50, let = 5;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
{
let x = 10, let = 20;
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
@@ -0,0 +1,15 @@
//// [letInLetDeclarations_ES6.ts]
// All use of let in const declaration should be an error
let x = 50, let = 5;
{
let x = 10, let = 20;
}
//// [letInLetDeclarations_ES6.js]
// All use of let in const declaration should be an error
let x = 50, let = 5;
{
let x = 10, let = 20;
}
@@ -1,23 +0,0 @@
tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ====
{
let let = 1; // should error
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (let let in []) { } // should error
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
{
const let = 1; // should error
~~~
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
{
function let() { // should be ok
}
}
@@ -1,25 +0,0 @@
//// [letInLetOrConstDeclarations.ts]
{
let let = 1; // should error
for (let let in []) { } // should error
}
{
const let = 1; // should error
}
{
function let() { // should be ok
}
}
//// [letInLetOrConstDeclarations.js]
{
let let = 1; // should error
for (let let in []) { } // should error
}
{
const let = 1; // should error
}
{
function let() {
}
}
@@ -0,0 +1,16 @@
//// [letInVarDeclOfForIn_ES5.ts]
// should not be an error
for (var let in [1,2,3]) {}
{
for (var let in [1,2,3]) {}
}
//// [letInVarDeclOfForIn_ES5.js]
// should not be an error
for (var let in [1, 2, 3]) { }
{
for (var let in [1, 2, 3]) { }
}
@@ -0,0 +1,11 @@
=== tests/cases/compiler/letInVarDeclOfForIn_ES5.ts ===
// should not be an error
for (var let in [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForIn_ES5.ts, 2, 8), Decl(letInVarDeclOfForIn_ES5.ts, 5, 9))
{
for (var let in [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForIn_ES5.ts, 2, 8), Decl(letInVarDeclOfForIn_ES5.ts, 5, 9))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/letInVarDeclOfForIn_ES5.ts ===
// should not be an error
for (var let in [1,2,3]) {}
>let : any
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
{
for (var let in [1,2,3]) {}
>let : any
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
}
@@ -0,0 +1,16 @@
//// [letInVarDeclOfForIn_ES6.ts]
// should not be an error
for (var let in [1,2,3]) {}
{
for (var let in [1,2,3]) {}
}
//// [letInVarDeclOfForIn_ES6.js]
// should not be an error
for (var let in [1, 2, 3]) { }
{
for (var let in [1, 2, 3]) { }
}
@@ -0,0 +1,11 @@
=== tests/cases/compiler/letInVarDeclOfForIn_ES6.ts ===
// should not be an error
for (var let in [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForIn_ES6.ts, 2, 8), Decl(letInVarDeclOfForIn_ES6.ts, 5, 9))
{
for (var let in [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForIn_ES6.ts, 2, 8), Decl(letInVarDeclOfForIn_ES6.ts, 5, 9))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/letInVarDeclOfForIn_ES6.ts ===
// should not be an error
for (var let in [1,2,3]) {}
>let : any
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
{
for (var let in [1,2,3]) {}
>let : any
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
}
@@ -0,0 +1,20 @@
//// [letInVarDeclOfForOf_ES5.ts]
// should not be an error
for (var let of [1,2,3]) {}
{
for (var let of [1,2,3]) {}
}
//// [letInVarDeclOfForOf_ES5.js]
// should not be an error
for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) {
var let = _a[_i];
}
{
for (var _b = 0, _c = [1, 2, 3]; _b < _c.length; _b++) {
var let = _c[_b];
}
}
@@ -0,0 +1,11 @@
=== tests/cases/compiler/letInVarDeclOfForOf_ES5.ts ===
// should not be an error
for (var let of [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForOf_ES5.ts, 2, 8), Decl(letInVarDeclOfForOf_ES5.ts, 5, 9))
{
for (var let of [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForOf_ES5.ts, 2, 8), Decl(letInVarDeclOfForOf_ES5.ts, 5, 9))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/letInVarDeclOfForOf_ES5.ts ===
// should not be an error
for (var let of [1,2,3]) {}
>let : number
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
{
for (var let of [1,2,3]) {}
>let : number
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
}
@@ -0,0 +1,16 @@
//// [letInVarDeclOfForOf_ES6.ts]
// should not be an error
for (var let of [1,2,3]) {}
{
for (var let of [1,2,3]) {}
}
//// [letInVarDeclOfForOf_ES6.js]
// should not be an error
for (var let of [1, 2, 3]) { }
{
for (var let of [1, 2, 3]) { }
}
@@ -0,0 +1,11 @@
=== tests/cases/compiler/letInVarDeclOfForOf_ES6.ts ===
// should not be an error
for (var let of [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForOf_ES6.ts, 2, 8), Decl(letInVarDeclOfForOf_ES6.ts, 5, 9))
{
for (var let of [1,2,3]) {}
>let : Symbol(let, Decl(letInVarDeclOfForOf_ES6.ts, 2, 8), Decl(letInVarDeclOfForOf_ES6.ts, 5, 9))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/letInVarDeclOfForOf_ES6.ts ===
// should not be an error
for (var let of [1,2,3]) {}
>let : number
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
{
for (var let of [1,2,3]) {}
>let : number
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
}
@@ -1,5 +1,7 @@
tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
Type 'Object' provides no match for the signature '(): void'
tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'.
Type 'Object' provides no match for the signature '(): void'
==== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ====
@@ -13,6 +15,7 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf
i = f;
~
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
var a: {
(): void
@@ -20,4 +23,5 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf
f = a;
a = f;
~
!!! error TS2322: Type 'Object' is not assignable to type '() => void'.
!!! error TS2322: Type 'Object' is not assignable to type '() => void'.
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
@@ -1,5 +1,7 @@
tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
Type 'Object' provides no match for the signature 'new (): any'
tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type 'new () => any'.
Type 'Object' provides no match for the signature 'new (): any'
==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ====
@@ -13,6 +15,7 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb
i = f;
~
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
var a: {
new(): any
@@ -20,4 +23,5 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb
f = a;
a = f;
~
!!! error TS2322: Type 'Object' is not assignable to type 'new () => any'.
!!! error TS2322: Type 'Object' is not assignable to type 'new () => any'.
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
@@ -0,0 +1,27 @@
//// [tests/cases/conformance/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd.ts] ////
//// [a.ts]
import foo from "./b";
export default class Foo {}
foo();
//// [b.ts]
import Foo from "./a";
export default function foo() { new Foo(); }
//// [output.js]
define("b", ["require", "exports", "a"], function (require, exports, a_1) {
"use strict";
function foo() { new a_1.default(); }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = foo;
});
define("a", ["require", "exports", "b"], function (require, exports, b_1) {
"use strict";
class Foo {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Foo;
b_1.default();
});
@@ -0,0 +1,18 @@
=== tests/cases/conformance/es6/moduleExportsAmd/src/a.ts ===
import foo from "./b";
>foo : Symbol(foo, Decl(a.ts, 0, 6))
export default class Foo {}
>Foo : Symbol(Foo, Decl(a.ts, 0, 22))
foo();
>foo : Symbol(foo, Decl(a.ts, 0, 6))
=== tests/cases/conformance/es6/moduleExportsAmd/src/b.ts ===
import Foo from "./a";
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
export default function foo() { new Foo(); }
>foo : Symbol(foo, Decl(b.ts, 0, 22))
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
@@ -0,0 +1,20 @@
=== tests/cases/conformance/es6/moduleExportsAmd/src/a.ts ===
import foo from "./b";
>foo : () => void
export default class Foo {}
>Foo : Foo
foo();
>foo() : void
>foo : () => void
=== tests/cases/conformance/es6/moduleExportsAmd/src/b.ts ===
import Foo from "./a";
>Foo : typeof Foo
export default function foo() { new Foo(); }
>foo : () => void
>new Foo() : Foo
>Foo : typeof Foo
@@ -0,0 +1,44 @@
//// [tests/cases/conformance/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem.ts] ////
//// [a.ts]
import foo from "./b";
export default class Foo {}
foo();
//// [b.ts]
import Foo from "./a";
export default function foo() { new Foo(); }
//// [output.js]
System.register("b", ["a"], function(exports_1) {
"use strict";
var a_1;
function foo() { new a_1.default(); }
exports_1("default", foo);
return {
setters:[
function (a_1_1) {
a_1 = a_1_1;
}],
execute: function() {
}
}
});
System.register("a", ["b"], function(exports_2) {
"use strict";
var b_1;
var Foo;
return {
setters:[
function (b_1_1) {
b_1 = b_1_1;
}],
execute: function() {
class Foo {
}
exports_2("default", Foo);
b_1.default();
}
}
});
@@ -0,0 +1,18 @@
=== tests/cases/conformance/es6/moduleExportsSystem/src/a.ts ===
import foo from "./b";
>foo : Symbol(foo, Decl(a.ts, 0, 6))
export default class Foo {}
>Foo : Symbol(Foo, Decl(a.ts, 0, 22))
foo();
>foo : Symbol(foo, Decl(a.ts, 0, 6))
=== tests/cases/conformance/es6/moduleExportsSystem/src/b.ts ===
import Foo from "./a";
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
export default function foo() { new Foo(); }
>foo : Symbol(foo, Decl(b.ts, 0, 22))
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
@@ -0,0 +1,20 @@
=== tests/cases/conformance/es6/moduleExportsSystem/src/a.ts ===
import foo from "./b";
>foo : () => void
export default class Foo {}
>Foo : Foo
foo();
>foo() : void
>foo : () => void
=== tests/cases/conformance/es6/moduleExportsSystem/src/b.ts ===
import Foo from "./a";
>Foo : typeof Foo
export default function foo() { new Foo(); }
>foo : () => void
>new Foo() : Foo
>Foo : typeof Foo
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) {
define("ref/a", ["require", "exports"], function (require, exports) {
"use strict";
var A = (function () {
function A() {
@@ -23,7 +23,7 @@ define("tests/cases/compiler/ref/a", ["require", "exports"], function (require,
})();
exports.A = A;
});
define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) {
define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) {
"use strict";
var B = (function (_super) {
__extends(B, _super);
@@ -37,12 +37,12 @@ define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/re
//# sourceMappingURL=all.js.map
//// [all.d.ts]
declare module "tests/cases/compiler/ref/a" {
declare module "ref/a" {
export class A {
}
}
declare module "tests/cases/compiler/b" {
import { A } from "tests/cases/compiler/ref/a";
declare module "b" {
import { A } from "ref/a";
export class B extends A {
}
}
@@ -13,7 +13,7 @@ sourceFile:tests/cases/compiler/ref/a.ts
>>> function __() { this.constructor = d; }
>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
>>>};
>>>define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) {
>>>define("ref/a", ["require", "exports"], function (require, exports) {
>>> "use strict";
>>> var A = (function () {
1 >^^^^
@@ -79,7 +79,7 @@ emittedFile:all.js
sourceFile:tests/cases/compiler/b.ts
-------------------------------------------------------------------
>>>});
>>>define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) {
>>>define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) {
>>> "use strict";
>>> var B = (function (_super) {
1 >^^^^
@@ -20,12 +20,12 @@ var __extends = (this && this.__extends) || function (d, b) {
//# sourceMappingURL=all.js.map
//// [all.d.ts]
declare module "tests/cases/compiler/ref/a" {
declare module "ref/a" {
export class A {
}
}
declare module "tests/cases/compiler/b" {
import { A } from "tests/cases/compiler/ref/a";
declare module "b" {
import { A } from "ref/a";
export class B extends A {
}
}
@@ -15,12 +15,12 @@ export class B extends A { }
//# sourceMappingURL=all.js.map
//// [all.d.ts]
declare module "tests/cases/compiler/ref/a" {
declare module "ref/a" {
export class A {
}
}
declare module "tests/cases/compiler/b" {
import { A } from "tests/cases/compiler/ref/a";
declare module "b" {
import { A } from "ref/a";
export class B extends A {
}
}
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
System.register("tests/cases/compiler/ref/a", [], function(exports_1) {
System.register("ref/a", [], function(exports_1) {
"use strict";
var A;
return {
@@ -29,7 +29,7 @@ System.register("tests/cases/compiler/ref/a", [], function(exports_1) {
}
}
});
System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], function(exports_2) {
System.register("b", ["ref/a"], function(exports_2) {
"use strict";
var a_1;
var B;
@@ -53,12 +53,12 @@ System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], functi
//# sourceMappingURL=all.js.map
//// [all.d.ts]
declare module "tests/cases/compiler/ref/a" {
declare module "ref/a" {
export class A {
}
}
declare module "tests/cases/compiler/b" {
import { A } from "tests/cases/compiler/ref/a";
declare module "b" {
import { A } from "ref/a";
export class B extends A {
}
}
@@ -13,7 +13,7 @@ sourceFile:tests/cases/compiler/ref/a.ts
>>> function __() { this.constructor = d; }
>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
>>>};
>>>System.register("tests/cases/compiler/ref/a", [], function(exports_1) {
>>>System.register("ref/a", [], function(exports_1) {
>>> "use strict";
>>> var A;
>>> return {
@@ -82,7 +82,7 @@ sourceFile:tests/cases/compiler/b.ts
>>> }
>>> }
>>>});
>>>System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], function(exports_2) {
>>>System.register("b", ["ref/a"], function(exports_2) {
>>> "use strict";
>>> var a_1;
>>> var B;
@@ -20,12 +20,12 @@ var __extends = (this && this.__extends) || function (d, b) {
//# sourceMappingURL=all.js.map
//// [all.d.ts]
declare module "tests/cases/compiler/ref/a" {
declare module "ref/a" {
export class A {
}
}
declare module "tests/cases/compiler/b" {
import { A } from "tests/cases/compiler/ref/a";
declare module "b" {
import { A } from "ref/a";
export class B extends A {
}
}
@@ -42,7 +42,7 @@ var Foo = (function () {
}
return Foo;
})();
define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) {
define("ref/a", ["require", "exports"], function (require, exports) {
"use strict";
/// <reference path="./b.ts" />
var A = (function () {
@@ -52,7 +52,7 @@ define("tests/cases/compiler/ref/a", ["require", "exports"], function (require,
})();
exports.A = A;
});
define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) {
define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) {
"use strict";
var B = (function (_super) {
__extends(B, _super);
@@ -71,13 +71,13 @@ declare class Foo {
member: Bar;
}
declare var GlobalFoo: Foo;
declare module "tests/cases/compiler/ref/a" {
declare module "ref/a" {
export class A {
member: typeof GlobalFoo;
}
}
declare module "tests/cases/compiler/b" {
import { A } from "tests/cases/compiler/ref/a";
declare module "b" {
import { A } from "ref/a";
export class B extends A {
}
}

Some files were not shown because too many files have changed in this diff Show More