Merge pull request #2460 from Microsoft/exportEquals

Revised ES6 modules
This commit is contained in:
Anders Hejlsberg
2015-03-25 11:01:00 -07:00
201 changed files with 4249 additions and 1482 deletions
+37 -12
View File
@@ -123,7 +123,7 @@ module ts {
case SyntaxKind.ExportDeclaration:
return "__export";
case SyntaxKind.ExportAssignment:
return "default";
return (<ExportAssignment>node).isExportEquals ? "export=" : "default";
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ClassDeclaration:
return node.flags & NodeFlags.Default ? "default" : undefined;
@@ -188,14 +188,6 @@ module ts {
return symbol;
}
function isAmbientContext(node: Node): boolean {
while (node) {
if (node.flags & NodeFlags.Ambient) return true;
node = node.parent;
}
return false;
}
function declareModuleMember(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) {
let hasExportModifier = getCombinedNodeFlags(node) & NodeFlags.Export;
if (symbolKind & SymbolFlags.Alias) {
@@ -218,7 +210,7 @@ module ts {
// 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol,
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
if (hasExportModifier || isAmbientContext(container)) {
if (hasExportModifier || container.flags & NodeFlags.ExportContext) {
let exportKind = (symbolKind & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
(symbolKind & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
(symbolKind & SymbolFlags.Namespace ? SymbolFlags.ExportNamespace : 0);
@@ -311,7 +303,39 @@ module ts {
bindChildren(node, symbolKind, isBlockScopeContainer);
}
function isAmbientContext(node: Node): boolean {
while (node) {
if (node.flags & NodeFlags.Ambient) return true;
node = node.parent;
}
return false;
}
function hasExportDeclarations(node: ModuleDeclaration | SourceFile): boolean {
var body = node.kind === SyntaxKind.SourceFile ? node : (<ModuleDeclaration>node).body;
if (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock) {
for (let stat of (<Block>body).statements) {
if (stat.kind === SyntaxKind.ExportDeclaration || stat.kind === SyntaxKind.ExportAssignment) {
return true;
}
}
}
return false;
}
function setExportContextFlag(node: ModuleDeclaration | SourceFile) {
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
// declarations with export modifiers) is an export context in which declarations are implicitly exported.
if (isAmbientContext(node) && !hasExportDeclarations(node)) {
node.flags |= NodeFlags.ExportContext;
}
else {
node.flags &= ~NodeFlags.ExportContext;
}
}
function bindModuleDeclaration(node: ModuleDeclaration) {
setExportContextFlag(node);
if (node.name.kind === SyntaxKind.StringLiteral) {
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
}
@@ -508,15 +532,16 @@ module ts {
case SyntaxKind.ExportAssignment:
if ((<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
// An export default clause with an identifier exports all meanings of that identifier
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
}
else {
// An export default clause with an expression exports a value
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
}
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
break;
case SyntaxKind.SourceFile:
setExportContextFlag(<SourceFile>node);
if (isExternalModule(<SourceFile>node)) {
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).fileName) + '"', /*isBlockScopeContainer*/ true);
break;
+221 -114
View File
@@ -295,7 +295,6 @@ module ts {
if (symbol.flags & meaning) {
return symbol;
}
if (symbol.flags & SymbolFlags.Alias) {
let target = resolveAlias(symbol);
// Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors
@@ -304,7 +303,6 @@ module ts {
}
}
}
// return undefined if we can't find a symbol.
}
@@ -346,7 +344,7 @@ module ts {
if (!isExternalModule(<SourceFile>location)) break;
case SyntaxKind.ModuleDeclaration:
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.ModuleMember)) {
if (!(result.flags & SymbolFlags.Alias && getDeclarationOfAliasSymbol(result).kind === SyntaxKind.ExportSpecifier)) {
if (result.flags & meaning || !(result.flags & SymbolFlags.Alias && getDeclarationOfAliasSymbol(result).kind === SyntaxKind.ExportSpecifier)) {
break loop;
}
result = undefined;
@@ -540,29 +538,13 @@ module ts {
return false;
}
// An alias symbol is created by one of the following declarations:
// import <symbol> = ...
// import <symbol> from ...
// import * as <symbol> from ...
// import { x as <symbol> } from ...
// export { x as <symbol> } from ...
// export default ...
function isAliasSymbolDeclaration(node: Node): boolean {
return node.kind === SyntaxKind.ImportEqualsDeclaration ||
node.kind === SyntaxKind.ImportClause && !!(<ImportClause>node).name ||
node.kind === SyntaxKind.NamespaceImport ||
node.kind === SyntaxKind.ImportSpecifier ||
node.kind === SyntaxKind.ExportSpecifier ||
node.kind === SyntaxKind.ExportAssignment;
}
function getAnyImportSyntax(node: Node): AnyImportSyntax {
if (isAliasSymbolDeclaration(node)) {
if (node.kind === SyntaxKind.ImportEqualsDeclaration) {
return <ImportEqualsDeclaration>node;
}
while (node.kind !== SyntaxKind.ImportDeclaration) {
while (node && node.kind !== SyntaxKind.ImportDeclaration) {
node = node.parent;
}
return <ImportDeclaration>node;
@@ -575,9 +557,7 @@ module ts {
function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration): Symbol {
if (node.moduleReference.kind === SyntaxKind.ExternalModuleReference) {
let moduleSymbol = resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node));
let exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol);
return exportAssignmentSymbol || moduleSymbol;
return resolveExternalModuleSymbol(resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(<EntityName>node.moduleReference, node);
}
@@ -585,29 +565,92 @@ module ts {
function getTargetOfImportClause(node: ImportClause): Symbol {
let moduleSymbol = resolveExternalModuleName(node, (<ImportDeclaration>node.parent).moduleSpecifier);
if (moduleSymbol) {
let exportAssignmentSymbol = getResolvedExportAssignmentSymbol(moduleSymbol);
if (!exportAssignmentSymbol) {
error(node.name, Diagnostics.External_module_0_has_no_default_export_or_export_assignment, symbolToString(moduleSymbol));
let exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]);
if (!exportDefaultSymbol) {
error(node.name, Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol));
}
return exportAssignmentSymbol;
return exportDefaultSymbol;
}
}
function getTargetOfNamespaceImport(node: NamespaceImport): Symbol {
return resolveExternalModuleName(node, (<ImportDeclaration>node.parent.parent).moduleSpecifier);
var moduleSpecifier = (<ImportDeclaration>node.parent.parent).moduleSpecifier;
return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier);
}
function getMemberOfModuleVariable(moduleSymbol: Symbol, name: string): Symbol {
if (moduleSymbol.flags & SymbolFlags.Variable) {
let typeAnnotation = (<VariableDeclaration>moduleSymbol.valueDeclaration).type;
if (typeAnnotation) {
return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name);
}
}
}
// This function creates a synthetic symbol that combines the value side of one symbol with the
// type/namespace side of another symbol. Consider this example:
//
// declare module graphics {
// interface Point {
// x: number;
// y: number;
// }
// }
// declare var graphics: {
// Point: new (x: number, y: number) => graphics.Point;
// }
// declare module "graphics" {
// export = graphics;
// }
//
// An 'import { Point } from "graphics"' needs to create a symbol that combines the value side 'Point'
// property with the type/namespace side interface 'Point'.
function combineValueAndTypeSymbols(valueSymbol: Symbol, typeSymbol: Symbol): Symbol {
if (valueSymbol.flags & (SymbolFlags.Type | SymbolFlags.Namespace)) {
return valueSymbol;
}
let result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.name);
result.declarations = concatenate(valueSymbol.declarations, typeSymbol.declarations);
result.parent = valueSymbol.parent || typeSymbol.parent;
if (valueSymbol.valueDeclaration) result.valueDeclaration = valueSymbol.valueDeclaration;
if (typeSymbol.members) result.members = typeSymbol.members;
if (valueSymbol.exports) result.exports = valueSymbol.exports;
return result;
}
function getExportOfModule(symbol: Symbol, name: string): Symbol {
if (symbol.flags & SymbolFlags.Module) {
let exports = getExportsOfSymbol(symbol);
if (hasProperty(exports, name)) {
return resolveSymbol(exports[name]);
}
}
}
function getPropertyOfVariable(symbol: Symbol, name: string): Symbol {
if (symbol.flags & SymbolFlags.Variable) {
var typeAnnotation = (<VariableDeclaration>symbol.valueDeclaration).type;
if (typeAnnotation) {
return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));
}
}
}
function getExternalModuleMember(node: ImportDeclaration | ExportDeclaration, specifier: ImportOrExportSpecifier): Symbol {
let moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
if (moduleSymbol) {
let targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
let name = specifier.propertyName || specifier.name;
if (name.text) {
let symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
let symbolFromModule = getExportOfModule(targetSymbol, name.text);
let symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text);
let symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
error(name, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), declarationNameToString(name));
return;
}
return symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace) ? symbol : resolveAlias(symbol);
return symbol;
}
}
}
@@ -626,7 +669,7 @@ module ts {
return node.expression && resolveEntityName(<Identifier>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
}
function getTargetOfImportDeclaration(node: Declaration): Symbol {
function getTargetOfAliasDeclaration(node: Declaration): Symbol {
switch (node.kind) {
case SyntaxKind.ImportEqualsDeclaration:
return getTargetOfImportEqualsDeclaration(<ImportEqualsDeclaration>node);
@@ -643,13 +686,17 @@ module ts {
}
}
function resolveSymbol(symbol: Symbol): Symbol {
return symbol && symbol.flags & SymbolFlags.Alias && !(symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace)) ? resolveAlias(symbol) : symbol;
}
function resolveAlias(symbol: Symbol): Symbol {
Debug.assert((symbol.flags & SymbolFlags.Alias) !== 0, "Should only get Alias here.");
let links = getSymbolLinks(symbol);
if (!links.target) {
links.target = resolvingSymbol;
let node = getDeclarationOfAliasSymbol(symbol);
let target = getTargetOfImportDeclaration(node);
let target = getTargetOfAliasDeclaration(node);
if (links.target === resolvingSymbol) {
links.target = target || unknownSymbol;
}
@@ -780,7 +827,6 @@ module ts {
return symbol;
}
}
let sourceFile: SourceFile;
while (true) {
let fileName = normalizePath(combinePaths(searchPath, moduleName));
@@ -788,12 +834,10 @@ module ts {
if (sourceFile || isRelative) {
break;
}
let parentPath = getDirectoryPath(searchPath);
if (parentPath === searchPath) {
break;
}
searchPath = parentPath;
}
if (sourceFile) {
@@ -806,24 +850,30 @@ module ts {
error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName);
}
function getExportAssignmentSymbol(moduleSymbol: Symbol): Symbol {
return moduleSymbol.exports["default"];
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
// and an external module with no 'export =' declaration resolves to the module itself.
function resolveExternalModuleSymbol(moduleSymbol: Symbol): Symbol {
return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol;
}
function getResolvedExportAssignmentSymbol(moduleSymbol: Symbol): Symbol {
let symbol = getExportAssignmentSymbol(moduleSymbol);
if (symbol) {
if (symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace)) {
return symbol;
}
if (symbol.flags & SymbolFlags.Alias) {
return resolveAlias(symbol);
}
// An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export ='
// references a symbol that is at least declared as a module or a variable. The target of the 'export =' may
// combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable).
function resolveESModuleSymbol(moduleSymbol: Symbol, moduleReferenceExpression: Expression): Symbol {
let symbol = resolveExternalModuleSymbol(moduleSymbol);
if (symbol && !(symbol.flags & (SymbolFlags.Module | SymbolFlags.Variable))) {
error(moduleReferenceExpression, Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));
symbol = undefined;
}
return symbol;
}
function getExportAssignmentSymbol(moduleSymbol: Symbol): Symbol {
return moduleSymbol.exports["export="];
}
function getExportsOfSymbol(symbol: Symbol): SymbolTable {
return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports;
return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
}
function getExportsOfModule(moduleSymbol: Symbol): SymbolTable {
@@ -840,15 +890,6 @@ module ts {
}
function getExportsForModule(moduleSymbol: Symbol): SymbolTable {
if (languageVersion < ScriptTarget.ES6) {
// A default export hides all other exports in CommonJS and AMD modules
let defaultSymbol = getExportAssignmentSymbol(moduleSymbol);
if (defaultSymbol) {
return {
"default": defaultSymbol
};
}
}
let result: SymbolTable;
let visitedSymbols: Symbol[] = [];
visit(moduleSymbol);
@@ -857,7 +898,7 @@ module ts {
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
function visit(symbol: Symbol) {
if (!contains(visitedSymbols, symbol)) {
if (symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol)) {
visitedSymbols.push(symbol);
if (symbol !== moduleSymbol) {
if (!result) {
@@ -868,9 +909,9 @@ module ts {
// All export * declarations are collected in an __export symbol by the binder
let exportStars = symbol.exports["__export"];
if (exportStars) {
forEach(exportStars.declarations, node => {
for (let node of exportStars.declarations) {
visit(resolveExternalModuleName(node, (<ExportDeclaration>node).moduleSpecifier));
});
}
}
}
}
@@ -2950,17 +2991,25 @@ module ts {
return result;
}
function getExportsOfExternalModule(node: ImportDeclaration): Symbol[]{
function symbolsToArray(symbols: SymbolTable): Symbol[] {
let result: Symbol[] = [];
for (let id in symbols) {
if (!isReservedMemberName(id)) {
result.push(symbols[id]);
}
}
return result;
}
function getExportsOfExternalModule(node: ImportDeclaration): Symbol[] {
if (!node.moduleSpecifier) {
return emptyArray;
}
let module = resolveExternalModuleName(node, node.moduleSpecifier);
if (!module || !module.exports) {
if (!module) {
return emptyArray;
}
return mapToArray(getExportsOfModule(module))
return symbolsToArray(getExportsOfModule(module));
}
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
@@ -4536,7 +4585,7 @@ module ts {
* Check if a Type was written as a tuple type literal.
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
*/
function isTupleType(type: Type) : boolean {
function isTupleType(type: Type): boolean {
return (type.flags & TypeFlags.Tuple) && !!(<TupleType>type).elementTypes;
}
@@ -7675,7 +7724,7 @@ module ts {
if (!checkForDisallowedESSymbolOperand(operator)) {
return booleanType;
}
// Fall through
// Fall through
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
@@ -9762,7 +9811,7 @@ module ts {
if (derived) {
let baseDeclarationFlags = getDeclarationFlagsFromSymbol(base);
let derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived);
if ((baseDeclarationFlags & NodeFlags.Private) || (derivedDeclarationFlags & NodeFlags.Private)) {
if ((baseDeclarationFlags & NodeFlags.Private) || (derivedDeclarationFlags & NodeFlags.Private)) {
// either base or derived property is private - not override, skip it
continue;
}
@@ -9893,7 +9942,7 @@ module ts {
// run subsequent checks only if first set succeeded
if (checkInheritedPropertiesAreIdentical(type, node.name)) {
forEach(type.baseTypes, baseType => {
checkTypeAssignableTo(type, baseType, node.name , Diagnostics.Interface_0_incorrectly_extends_interface_1);
checkTypeAssignableTo(type, baseType, node.name, Diagnostics.Interface_0_incorrectly_extends_interface_1);
});
checkIndexConstraints(type);
}
@@ -10310,7 +10359,21 @@ module ts {
}
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
if (node.exportClause) {
// export { x, y }
// export { x, y } from "foo"
forEach(node.exportClause.elements, checkExportSpecifier);
let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
error(node, Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module);
}
}
else {
// export * from "foo"
let moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
if (moduleSymbol && moduleSymbol.exports["export="]) {
error(node.moduleSpecifier, Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
}
}
}
}
@@ -10366,39 +10429,22 @@ module ts {
}
function hasExportedMembers(moduleSymbol: Symbol) {
let declarations = moduleSymbol.declarations;
for (let current of declarations) {
let statements = getModuleStatements(current);
for (let node of statements) {
if (node.kind === SyntaxKind.ExportDeclaration) {
let exportClause = (<ExportDeclaration>node).exportClause;
if (!exportClause) {
return true;
}
let specifiers = exportClause.elements;
for (let specifier of specifiers) {
if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) {
return true;
}
}
}
else if (node.kind !== SyntaxKind.ExportAssignment && node.flags & NodeFlags.Export && !(node.flags & NodeFlags.Default)) {
return true;
}
for (var id in moduleSymbol.exports) {
if (id !== "export=") {
return true;
}
}
return false;
}
function checkExternalModuleExports(node: SourceFile | ModuleDeclaration) {
let moduleSymbol = getSymbolOfNode(node);
let links = getSymbolLinks(moduleSymbol);
if (!links.exportsChecked) {
let defaultSymbol = getExportAssignmentSymbol(moduleSymbol);
if (defaultSymbol) {
if (languageVersion < ScriptTarget.ES6 && hasExportedMembers(moduleSymbol)) {
let declaration = getDeclarationOfAliasSymbol(defaultSymbol) || defaultSymbol.valueDeclaration;
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
let exportEqualsSymbol = moduleSymbol.exports["export="];
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
let declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
links.exportsChecked = true;
}
@@ -10690,7 +10736,7 @@ module ts {
populateSymbols();
return mapToArray(symbols);
return symbolsToArray(symbols);
function populateSymbols() {
while (location) {
@@ -10748,6 +10794,42 @@ module ts {
}
}
}
if (isInsideWithStatementBody(location)) {
// We cannot answer semantic questions within a with block, do not proceed any further
return [];
}
while (location) {
if (location.locals && !isGlobalSourceFile(location)) {
copySymbols(location.locals, meaning);
}
switch (location.kind) {
case SyntaxKind.SourceFile:
if (!isExternalModule(<SourceFile>location)) break;
case SyntaxKind.ModuleDeclaration:
copySymbols(getSymbolOfNode(location).exports, meaning & SymbolFlags.ModuleMember);
break;
case SyntaxKind.EnumDeclaration:
copySymbols(getSymbolOfNode(location).exports, meaning & SymbolFlags.EnumMember);
break;
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
if (!(memberFlags & NodeFlags.Static)) {
copySymbols(getSymbolOfNode(location).members, meaning & SymbolFlags.Type);
}
break;
case SyntaxKind.FunctionExpression:
if ((<FunctionExpression>location).name) {
copySymbol(location.symbol, meaning);
}
break;
}
memberFlags = location.flags;
location = location.parent;
}
copySymbols(globals, meaning);
return symbolsToArray(symbols);
}
function isTypeDeclarationName(name: Node): boolean {
@@ -11099,26 +11181,34 @@ module ts {
return symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length === 1 && symbol.declarations[0].kind === SyntaxKind.SourceFile;
}
function getAliasNameSubstitution(symbol: Symbol, getGeneratedNameForNode: (Node: Node) => string): string {
let declaration = getDeclarationOfAliasSymbol(symbol);
if (declaration && declaration.kind === SyntaxKind.ImportSpecifier) {
let moduleName = getGeneratedNameForNode(<ImportDeclaration>declaration.parent.parent.parent);
let propertyName = (<ImportSpecifier>declaration).propertyName || (<ImportSpecifier>declaration).name;
return moduleName + "." + unescapeIdentifier(propertyName.text);
function getAliasNameSubstitution(symbol: Symbol, getGeneratedNameForNode: (node: Node) => string): string {
// If this is es6 or higher, just use the name of the export
// no need to qualify it.
if (languageVersion >= ScriptTarget.ES6) {
return undefined;
}
let node = getDeclarationOfAliasSymbol(symbol);
if (node) {
if (node.kind === SyntaxKind.ImportClause) {
return getGeneratedNameForNode(<ImportDeclaration>node.parent) + ".default";
}
if (node.kind === SyntaxKind.ImportSpecifier) {
let moduleName = getGeneratedNameForNode(<ImportDeclaration>node.parent.parent.parent);
let propertyName = (<ImportSpecifier>node).propertyName || (<ImportSpecifier>node).name;
return moduleName + "." + unescapeIdentifier(propertyName.text);
}
}
}
function getExportNameSubstitution(symbol: Symbol, location: Node, getGeneratedNameForNode: (Node: Node) => string): string {
if (isExternalModuleSymbol(symbol.parent)) {
var symbolName = unescapeIdentifier(symbol.name);
// If this is es6 or higher, just use the name of the export
// no need to qualify it.
if (languageVersion >= ScriptTarget.ES6) {
return symbolName;
}
else {
return "exports." + symbolName;
return undefined;
}
return "exports." + unescapeIdentifier(symbol.name);
}
let node = location;
let containerSymbol = getParentOfSymbol(symbol);
@@ -11131,7 +11221,7 @@ module ts {
}
function getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (Node: Node) => string): string {
let symbol = getNodeLinks(node).resolvedSymbol;
let symbol = getNodeLinks(node).resolvedSymbol || (isDeclarationName(node) ? getSymbolOfNode(node.parent) : undefined);
if (symbol) {
// Whan an identifier resolves to a parented symbol, it references an exported entity from
// another declaration of the same internal module.
@@ -11146,15 +11236,27 @@ module ts {
return getExportNameSubstitution(exportSymbol, node.parent, getGeneratedNameForNode);
}
// Named imports from ES6 import declarations are rewritten
if (symbol.flags & SymbolFlags.Alias && languageVersion < ScriptTarget.ES6) {
if (symbol.flags & SymbolFlags.Alias) {
return getAliasNameSubstitution(symbol, getGeneratedNameForNode);
}
}
}
function hasExportDefaultValue(node: SourceFile): boolean {
let symbol = getResolvedExportAssignmentSymbol(getSymbolOfNode(node));
return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol);
function isValueAliasDeclaration(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportClause:
case SyntaxKind.NamespaceImport:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ExportSpecifier:
return isAliasResolvedToValue(getSymbolOfNode(node));
case SyntaxKind.ExportDeclaration:
let exportClause = (<ExportDeclaration>node).exportClause;
return exportClause && forEach(exportClause.elements, isValueAliasDeclaration);
case SyntaxKind.ExportAssignment:
return (<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier ? isAliasResolvedToValue(getSymbolOfNode(node)) : true;
}
return false;
}
function isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean {
@@ -11175,13 +11277,18 @@ module ts {
return isConstEnumSymbol(s) || s.constEnumOnlyModule;
}
function isReferencedAliasDeclaration(node: Node): boolean {
function isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean {
if (isAliasSymbolDeclaration(node)) {
let symbol = getSymbolOfNode(node);
if (getSymbolLinks(symbol).referenced) {
return true;
}
}
if (checkChildren) {
return forEachChild(node, node => isReferencedAliasDeclaration(node, checkChildren));
}
return false;
}
function isImplementationOfOverload(node: FunctionLikeDeclaration) {
@@ -11301,8 +11408,8 @@ module ts {
function createResolver(): EmitResolver {
return {
getExpressionNameSubstitution,
isValueAliasDeclaration,
hasGlobalName,
hasExportDefaultValue,
isReferencedAliasDeclaration,
getNodeCheckFlags,
isTopLevelValueImportEqualsWithEntityName,
-10
View File
@@ -255,16 +255,6 @@ module ts {
return hasProperty(map, key) ? map[key] : undefined;
}
export function mapToArray<T>(map: Map<T>): T[] {
let result: T[] = [];
for (let id in map) {
result.push(map[id]);
}
return result;
}
export function copyMap<T>(source: Map<T>, target: Map<T>): void {
for (let p in source) {
target[p] = source[p];
@@ -149,7 +149,7 @@ module ts {
The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." },
The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." },
An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." },
External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." },
External_module_0_has_no_default_export: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export." },
An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." },
Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." },
Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." },
@@ -349,6 +349,8 @@ module ts {
Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." },
Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
+9 -1
View File
@@ -587,7 +587,7 @@
"category": "Error",
"code": 1191
},
"External module '{0}' has no default export or export assignment.": {
"External module '{0}' has no default export.": {
"category": "Error",
"code": 1192
},
@@ -1388,6 +1388,14 @@
"category": "Error",
"code": 2496
},
"External module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
"category": "Error",
"code": 2497
},
"External module '{0}' uses 'export =' and cannot be used with 'export *'.": {
"category": "Error",
"code": 2498
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
+335 -357
View File
File diff suppressed because it is too large Load Diff
+16 -15
View File
@@ -4968,29 +4968,30 @@ module ts {
function parseImportOrExportSpecifier(kind: SyntaxKind): ImportOrExportSpecifier {
let node = <ImportSpecifier>createNode(kind);
// ImportSpecifier:
// ImportedBinding
// IdentifierName as ImportedBinding
let isFirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier();
let start = scanner.getTokenPos();
// BindingIdentifier
// IdentifierName as BindingIdentifier
// ExportSpecififer:
// IdentifierName
// IdentifierName as IdentifierName
let checkIdentifierIsKeyword = isKeyword(token) && !isIdentifier();
let checkIdentifierStart = scanner.getTokenPos();
let checkIdentifierEnd = scanner.getTextPos();
let identifierName = parseIdentifierName();
if (token === SyntaxKind.AsKeyword) {
node.propertyName = identifierName;
parseExpected(SyntaxKind.AsKeyword);
if (isIdentifier()) {
node.name = parseIdentifierName();
}
else {
parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
}
checkIdentifierIsKeyword = isKeyword(token) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
node.name = parseIdentifierName();
}
else {
node.name = identifierName;
if (isFirstIdentifierNameNotAnIdentifier) {
// Report error identifier expected
parseErrorAtPosition(start, identifierName.end - start, Diagnostics.Identifier_expected);
}
}
if (kind === SyntaxKind.ImportSpecifier && checkIdentifierIsKeyword) {
// Report error identifier expected
parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, Diagnostics.Identifier_expected);
}
return finishNode(node);
}
+3 -2
View File
@@ -310,6 +310,7 @@ module ts {
Let = 0x00001000, // Variable declaration
Const = 0x00002000, // Variable declaration
OctalLiteral = 0x00004000,
ExportContext = 0x00008000, // Export context (initialized by binding)
Modifier = Export | Ambient | Public | Private | Protected | Static | Default,
AccessibilityModifier = Public | Private | Protected,
@@ -1219,8 +1220,8 @@ module ts {
export interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
+17
View File
@@ -925,6 +925,23 @@ module ts {
return false;
}
// An alias symbol is created by one of the following declarations:
// import <symbol> = ...
// import <symbol> from ...
// import * as <symbol> from ...
// import { x as <symbol> } from ...
// export { x as <symbol> } from ...
// export = ...
// export default ...
export function isAliasSymbolDeclaration(node: Node): boolean {
return node.kind === SyntaxKind.ImportEqualsDeclaration ||
node.kind === SyntaxKind.ImportClause && !!(<ImportClause>node).name ||
node.kind === SyntaxKind.NamespaceImport ||
node.kind === SyntaxKind.ImportSpecifier ||
node.kind === SyntaxKind.ExportSpecifier ||
node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier;
}
export function getClassBaseTypeNode(node: ClassDeclaration) {
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
@@ -324,6 +324,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -948,8 +949,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -987,6 +987,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -3040,16 +3043,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -355,6 +355,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -979,8 +980,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1133,6 +1133,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -3186,16 +3189,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -356,6 +356,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -980,8 +981,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1083,6 +1083,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -3136,16 +3139,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -393,6 +393,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -1017,8 +1018,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1256,6 +1256,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -3309,16 +3312,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -11,23 +11,23 @@ var c = new A();
=== tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration_0.ts ===
declare module 'M' {
module C {
>C : typeof X
>C : typeof C
export var f: number;
>f : number
}
class C {
>C : X
>C : C
foo(): void;
>foo : () => void
}
import X = C;
>X : typeof X
>C : X
>X : typeof C
>C : C
export = X;
>X : X
>X : C
}
@@ -42,23 +42,23 @@ module m2 {
}
var m2: {
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
(): m2.connectExport;
>m2 : unknown
>connectExport : default.connectExport
>connectExport : export=.connectExport
test1: m2.connectModule;
>test1 : default.connectModule
>test1 : export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
test2(): m2.connectModule;
>test2 : () => default.connectModule
>test2 : () => export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
};
export = m2;
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
@@ -7,7 +7,7 @@ declare module "express" {
function express(): express.ExpressServer;
>express : typeof express
>express : unknown
>ExpressServer : default.ExpressServer
>ExpressServer : export=.ExpressServer
module express {
>express : typeof express
@@ -27,24 +27,24 @@ module m2 {
}
var m2: {
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
(): m2.connectExport;
>m2 : unknown
>connectExport : default.connectExport
>connectExport : export=.connectExport
test1: m2.connectModule;
>test1 : default.connectModule
>test1 : export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
test2(): m2.connectModule;
>test2 : () => default.connectModule
>test2 : () => export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
};
export = m2;
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
@@ -28,24 +28,24 @@ module m2 {
var x = 10, m2: {
>x : number
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
(): m2.connectExport;
>m2 : unknown
>connectExport : default.connectExport
>connectExport : export=.connectExport
test1: m2.connectModule;
>test1 : default.connectModule
>test1 : export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
test2(): m2.connectModule;
>test2 : () => default.connectModule
>test2 : () => export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
};
export = m2;
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
@@ -1,10 +1,10 @@
//// [decoratorOnArrowFunction.ts]
//// [decoratorOnArrowFunction.ts]
declare function dec<T>(target: T): T;
var F = @dec () => {
}
//// [decoratorOnArrowFunction.js]
var F = ;
{
}
}
//// [decoratorOnArrowFunction.js]
var F = ;
{
}
@@ -1,14 +1,14 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass1.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec
>dec : unknown
class C {
>C : C
}
=== tests/cases/conformance/decorators/class/decoratorOnClass1.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec
>dec : unknown
class C {
>C : C
}
@@ -1,14 +1,14 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass2.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec
>dec : unknown
export class C {
>C : C
}
=== tests/cases/conformance/decorators/class/decoratorOnClass2.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec
>dec : unknown
export class C {
>C : C
}
@@ -1,12 +1,12 @@
tests/cases/conformance/decorators/class/decoratorOnClass3.ts(3,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/class/decoratorOnClass3.ts (1 errors) ====
declare function dec<T>(target: T): T;
export
~~~~~~
!!! error TS1128: Declaration or statement expected.
@dec
class C {
tests/cases/conformance/decorators/class/decoratorOnClass3.ts(3,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/class/decoratorOnClass3.ts (1 errors) ====
declare function dec<T>(target: T): T;
export
~~~~~~
!!! error TS1128: Declaration or statement expected.
@dec
class C {
}
@@ -1,15 +1,15 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass4.ts ===
declare function dec(): <T>(target: T) => T;
>dec : () => <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec()
>dec() : <T>(target: T) => T
>dec : () => <T>(target: T) => T
class C {
>C : C
}
=== tests/cases/conformance/decorators/class/decoratorOnClass4.ts ===
declare function dec(): <T>(target: T) => T;
>dec : () => <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec()
>dec() : <T>(target: T) => T
>dec : () => <T>(target: T) => T
class C {
>C : C
}
@@ -1,15 +1,15 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass5.ts ===
declare function dec(): <T>(target: T) => T;
>dec : () => <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec()
>dec() : <T>(target: T) => T
>dec : () => <T>(target: T) => T
class C {
>C : C
}
=== tests/cases/conformance/decorators/class/decoratorOnClass5.ts ===
declare function dec(): <T>(target: T) => T;
>dec : () => <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec()
>dec() : <T>(target: T) => T
>dec : () => <T>(target: T) => T
class C {
>C : C
}
@@ -1,19 +1,19 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor1.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec get accessor() { return 1; }
>dec : unknown
>accessor : number
}
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor1.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec get accessor() { return 1; }
>dec : unknown
>accessor : number
}
@@ -1,19 +1,19 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor2.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public get accessor() { return 1; }
>dec : unknown
>accessor : number
}
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor2.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public get accessor() { return 1; }
>dec : unknown
>accessor : number
}
@@ -1,19 +1,19 @@
//// [decoratorOnClassAccessor3.ts]
//// [decoratorOnClassAccessor3.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec get accessor() { return 1; }
}
//// [decoratorOnClassAccessor3.js]
var C = (function () {
function C() {
}
return C;
})();
public;
get;
accessor();
{
return 1;
}
}
//// [decoratorOnClassAccessor3.js]
var C = (function () {
function C() {
}
return C;
})();
public;
get;
accessor();
{
return 1;
}
@@ -1,20 +1,20 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor4.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec set accessor(value: number) { }
>dec : unknown
>accessor : number
>value : number
}
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor4.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec set accessor(value: number) { }
>dec : unknown
>accessor : number
>value : number
}
@@ -1,20 +1,20 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor5.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public set accessor(value: number) { }
>dec : unknown
>accessor : number
>value : number
}
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor5.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public set accessor(value: number) { }
>dec : unknown
>accessor : number
>value : number
}
@@ -1,18 +1,18 @@
//// [decoratorOnClassAccessor6.ts]
//// [decoratorOnClassAccessor6.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec set accessor(value: number) { }
}
//// [decoratorOnClassAccessor6.js]
var C = (function () {
function C() {
}
return C;
})();
public;
set;
accessor(value, number);
{
}
}
//// [decoratorOnClassAccessor6.js]
var C = (function () {
function C() {
}
return C;
})();
public;
set;
accessor(value, number);
{
}
@@ -1,13 +1,13 @@
//// [decoratorOnClassConstructor1.ts]
//// [decoratorOnClassConstructor1.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec constructor() {}
}
//// [decoratorOnClassConstructor1.js]
var C = (function () {
function C() {
}
return C;
})();
}
//// [decoratorOnClassConstructor1.js]
var C = (function () {
function C() {
}
return C;
})();
@@ -1,19 +1,19 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod1.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec method() {}
>dec : unknown
>method : () => void
}
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod1.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec method() {}
>dec : unknown
>method : () => void
}
@@ -1,19 +1,19 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod2.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public method() {}
>dec : unknown
>method : () => void
}
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod2.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public method() {}
>dec : unknown
>method : () => void
}
@@ -1,17 +1,17 @@
//// [decoratorOnClassMethod3.ts]
//// [decoratorOnClassMethod3.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec method() {}
}
//// [decoratorOnClassMethod3.js]
var C = (function () {
function C() {
}
return C;
})();
public;
method();
{
}
}
//// [decoratorOnClassMethod3.js]
var C = (function () {
function C() {
}
return C;
})();
public;
method();
{
}
@@ -1,18 +1,18 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod4.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : unknown
}
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod4.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : unknown
}
@@ -1,19 +1,19 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod5.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec() ["method"]() {}
>dec() : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod5.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec() ["method"]() {}
>dec() : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}
@@ -1,18 +1,18 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : unknown
}
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : unknown
}
@@ -1,18 +1,18 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod7.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public ["method"]() {}
>dec : unknown
}
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod7.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public ["method"]() {}
>dec : unknown
}
@@ -1,15 +1,15 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
class C {
>C : C
@dec method() {}
>dec : unknown
>method : () => void
}
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
class C {
>C : C
@dec method() {}
>dec : unknown
>method : () => void
}
@@ -1,13 +1,13 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
declare function dec(target: Function): void;
>dec : (target: Function) => void
>target : Function
>Function : Function
class C {
>C : C
@dec prop;
>dec : unknown
>prop : any
}
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
declare function dec(target: Function): void;
>dec : (target: Function) => void
>target : Function
>Function : Function
class C {
>C : C
@dec prop;
>dec : unknown
>prop : any
}
+7 -7
View File
@@ -1,11 +1,11 @@
//// [decoratorOnEnum.ts]
//// [decoratorOnEnum.ts]
declare function dec<T>(target: T): T;
@dec
enum E {
}
//// [decoratorOnEnum.js]
var E;
(function (E) {
})(E || (E = {}));
}
//// [decoratorOnEnum.js]
var E;
(function (E) {
})(E || (E = {}));
@@ -1,12 +1,12 @@
//// [decoratorOnEnum2.ts]
//// [decoratorOnEnum2.ts]
declare function dec<T>(target: T): T;
enum E {
@dec A
}
//// [decoratorOnEnum2.js]
var E;
(function (E) {
})(E || (E = {}));
A;
}
//// [decoratorOnEnum2.js]
var E;
(function (E) {
})(E || (E = {}));
A;
@@ -1,10 +1,10 @@
//// [decoratorOnFunctionDeclaration.ts]
//// [decoratorOnFunctionDeclaration.ts]
declare function dec<T>(target: T): T;
@dec
function F() {
}
//// [decoratorOnFunctionDeclaration.js]
function F() {
}
}
//// [decoratorOnFunctionDeclaration.js]
function F() {
}
@@ -1,13 +1,13 @@
tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,9): error TS1109: Expression expected.
tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,23): error TS1003: Identifier expected.
==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts (2 errors) ====
declare function dec<T>(target: T): T;
var F = @dec function () {
~
!!! error TS1109: Expression expected.
~
!!! error TS1003: Identifier expected.
tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,9): error TS1109: Expression expected.
tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,23): error TS1003: Identifier expected.
==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts (2 errors) ====
declare function dec<T>(target: T): T;
var F = @dec function () {
~
!!! error TS1109: Expression expected.
~
!!! error TS1003: Identifier expected.
}
@@ -1,10 +1,10 @@
//// [decoratorOnFunctionExpression.ts]
//// [decoratorOnFunctionExpression.ts]
declare function dec<T>(target: T): T;
var F = @dec function () {
}
//// [decoratorOnFunctionExpression.js]
var F = ;
function () {
}
}
//// [decoratorOnFunctionExpression.js]
var F = ;
function () {
}
@@ -1,4 +1,4 @@
//// [decoratorOnImportEquals1.ts]
//// [decoratorOnImportEquals1.ts]
declare function dec<T>(target: T): T;
module M1 {
@@ -8,10 +8,10 @@ module M1 {
module M2 {
@dec
import X = M1.X;
}
//// [decoratorOnImportEquals1.js]
var M1;
(function (M1) {
M1.X;
})(M1 || (M1 = {}));
}
//// [decoratorOnImportEquals1.js]
var M1;
(function (M1) {
M1.X;
})(M1 || (M1 = {}));
@@ -1,14 +1,14 @@
//// [tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2.ts] ////
//// [decoratorOnImportEquals2_0.ts]
//// [tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2.ts] ////
//// [decoratorOnImportEquals2_0.ts]
export var X;
//// [decoratorOnImportEquals2_1.ts]
//// [decoratorOnImportEquals2_1.ts]
@dec
import lib = require('./decoratorOnImportEquals2_0');
declare function dec<T>(target: T): T;
//// [decoratorOnImportEquals2_0.js]
exports.X;
//// [decoratorOnImportEquals2_1.js]
declare function dec<T>(target: T): T;
//// [decoratorOnImportEquals2_0.js]
exports.X;
//// [decoratorOnImportEquals2_1.js]
@@ -1,8 +1,8 @@
//// [decoratorOnInterface.ts]
//// [decoratorOnInterface.ts]
declare function dec<T>(target: T): T;
@dec
interface I {
}
//// [decoratorOnInterface.js]
}
//// [decoratorOnInterface.js]
@@ -1,9 +1,9 @@
//// [decoratorOnInternalModule.ts]
//// [decoratorOnInternalModule.ts]
declare function dec<T>(target: T): T;
@dec
module M {
}
//// [decoratorOnInternalModule.js]
}
//// [decoratorOnInternalModule.js]
@@ -1,7 +1,7 @@
//// [decoratorOnTypeAlias.ts]
//// [decoratorOnTypeAlias.ts]
declare function dec<T>(target: T): T;
@dec
type T = number;
//// [decoratorOnTypeAlias.js]
type T = number;
//// [decoratorOnTypeAlias.js]
+5 -5
View File
@@ -1,8 +1,8 @@
//// [decoratorOnVar.ts]
//// [decoratorOnVar.ts]
declare function dec<T>(target: T): T;
@dec
var x: number;
//// [decoratorOnVar.js]
var x;
var x: number;
//// [decoratorOnVar.js]
var x;
@@ -1,15 +1,15 @@
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo2.ts(4,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo3.ts(7,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo3.ts(8,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo4.ts(1,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo4.ts(8,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo5.ts(4,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo5.ts(5,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate identifier 'default'.
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo2.ts(4,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo3.ts(7,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo3.ts(8,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo4.ts(1,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo4.ts(8,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo5.ts(4,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo5.ts(5,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate identifier 'export='.
==== tests/cases/conformance/externalModules/foo1.ts (3 errors) ====
@@ -19,20 +19,20 @@ tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate id
~~~~~~~~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
export = y;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
==== tests/cases/conformance/externalModules/foo2.ts (2 errors) ====
var x = 10;
class y {};
export = x;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
export = y;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
==== tests/cases/conformance/externalModules/foo3.ts (2 errors) ====
module x {
@@ -43,15 +43,15 @@ tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate id
}
export = x;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
export = y;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
==== tests/cases/conformance/externalModules/foo4.ts (2 errors) ====
export = x;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
function x(){
return 42;
}
@@ -60,7 +60,7 @@ tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate id
}
export = y;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
==== tests/cases/conformance/externalModules/foo5.ts (3 errors) ====
var x = 5;
@@ -68,11 +68,11 @@ tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate id
var z = {};
export = x;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
export = y;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
export = z;
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'default'.
!!! error TS2300: Duplicate identifier 'export='.
@@ -13,7 +13,7 @@ var C = (function () {
};
return C;
})();
module.exports = C;
exports.C = C;
//// [es5ExportDefaultClassDeclaration.d.ts]
@@ -13,7 +13,7 @@ var default_1 = (function () {
};
return default_1;
})();
module.exports = default_1;
exports.default = default_1;
//// [es5ExportDefaultClassDeclaration2.d.ts]
@@ -4,7 +4,7 @@ export default (1 + 2);
//// [es5ExportDefaultExpression.js]
module.exports = (1 + 2);
exports.default = (1 + 2);
//// [es5ExportDefaultExpression.d.ts]
@@ -6,7 +6,7 @@ export default function f() { }
//// [es5ExportDefaultFunctionDeclaration.js]
function f() {
}
module.exports = f;
exports.f = f;
//// [es5ExportDefaultFunctionDeclaration.d.ts]
@@ -6,7 +6,7 @@ export default function () { }
//// [es5ExportDefaultFunctionDeclaration2.js]
function () {
}
module.exports = default_1;
exports.default = default_1;
//// [es5ExportDefaultFunctionDeclaration2.d.ts]
@@ -1,11 +0,0 @@
tests/cases/compiler/es5ExportDefaultIdentifier.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
==== tests/cases/compiler/es5ExportDefaultIdentifier.ts (1 errors) ====
export function f() { }
export default f;
~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
@@ -9,7 +9,7 @@ export default f;
function f() {
}
exports.f = f;
module.exports = f;
exports.default = f;
//// [es5ExportDefaultIdentifier.d.ts]
@@ -0,0 +1,8 @@
=== tests/cases/compiler/es5ExportDefaultIdentifier.ts ===
export function f() { }
>f : () => void
export default f;
>f : () => void
@@ -0,0 +1,59 @@
tests/cases/compiler/es5ModuleInternalNamedImports.ts(23,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(24,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(25,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(26,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(27,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(28,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(29,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(30,5): error TS1194: Export declarations are not permitted in an internal module.
==== tests/cases/compiler/es5ModuleInternalNamedImports.ts (8 errors) ====
export module M {
// variable
export var M_V = 0;
// interface
export interface M_I { }
//calss
export class M_C { }
// instantiated module
export module M_M { var x; }
// uninstantiated module
export module M_MU { }
// function
export function M_F() { }
// enum
export enum M_E { }
// type
export type M_T = number;
// alias
export import M_A = M_M;
// Reexports
export {M_V as v};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
export {M_I as i};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
export {M_C as c};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
export {M_M as m};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
export {M_MU as mu};
~~~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
export {M_F as f};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
export {M_E as e};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
export {M_A as a};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
}
@@ -61,13 +61,5 @@ define(["require", "exports"], function (require, exports) {
// alias
M.M_A = M_M;
// Reexports
M.v = M.M_V;
M.i = M_I;
M.c = M_C;
M.m = M_M;
M.mu = M_MU;
M.f = M_F;
M.e = M_E;
M.a = M.M_A;
})(M = exports.M || (exports.M = {}));
});
+1 -2
View File
@@ -19,11 +19,10 @@ export * from "server";
//// [server.js]
export class c {
}
var m;
export var m;
(function (m) {
m.x = 10;
})(m || (m = {}));
export { m };
export var x = 10;
//// [client.js]
export * from "server";
@@ -29,8 +29,10 @@ var m;
})(m = exports.m || (exports.m = {}));
exports.x = 10;
//// [client.js]
var server_1 = require("server");
for (var _a in server_1) if (!exports.hasOwnProperty(_a)) exports[_a] = server_1[_a];
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("server"));
//// [server.d.ts]
@@ -5,4 +5,3 @@ export = a;
//// [es6ExportAssignment.js]
var a = 10;
export default a;
+1 -2
View File
@@ -26,8 +26,7 @@ var m;
var x = 10;
export { c };
export { c as c2 };
export { i, m as instantiatedModule };
export { uninstantiated };
export { m as instantiatedModule };
export { x };
@@ -31,12 +31,6 @@ var m;
exports.instantiatedModule = m;
var x = 10;
exports.x = x;
exports.c = c;
exports.c2 = c;
exports.i = i;
exports.instantiatedModule = m;
exports.uninstantiated = uninstantiated;
exports.x = x;
//// [es6ExportClauseInEs5.d.ts]
@@ -23,17 +23,15 @@ export { x } from "server";
//// [server.js]
export class c {
}
var m;
export var m;
(function (m) {
m.x = 10;
})(m || (m = {}));
export { m };
export var x = 10;
//// [client.js]
export { c } from "server";
export { c as c2 } from "server";
export { i, m as instantiatedModule } from "server";
export { uninstantiated } from "server";
export { m as instantiatedModule } from "server";
export { x } from "server";
@@ -38,12 +38,9 @@ exports.c = server_1.c;
var server_2 = require("server");
exports.c2 = server_2.c;
var server_3 = require("server");
exports.i = server_3.i;
exports.instantiatedModule = server_3.m;
var server_4 = require("server");
exports.uninstantiated = server_4.uninstantiated;
var server_5 = require("server");
exports.x = server_5.x;
exports.x = server_4.x;
//// [server.d.ts]
@@ -1,11 +1,14 @@
tests/cases/compiler/es6ExportEquals.ts(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
tests/cases/compiler/es6ExportEquals.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
==== tests/cases/compiler/es6ExportEquals.ts (1 errors) ====
==== tests/cases/compiler/es6ExportEquals.ts (2 errors) ====
export function f() { }
export = f;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
@@ -8,7 +8,6 @@ export = f;
//// [es6ExportEquals.js]
export function f() {
}
export default f;
//// [es6ExportEquals.d.ts]
@@ -0,0 +1,304 @@
tests/cases/compiler/main.ts(15,1): error TS2304: Cannot find name 'z1'.
tests/cases/compiler/main.ts(21,4): error TS2339: Property 'a' does not exist on type '() => any'.
tests/cases/compiler/main.ts(23,4): error TS2339: Property 'a' does not exist on type 'typeof Foo'.
tests/cases/compiler/main.ts(27,8): error TS1192: External module '"interface"' has no default export.
tests/cases/compiler/main.ts(28,8): error TS1192: External module '"variable"' has no default export.
tests/cases/compiler/main.ts(29,8): error TS1192: External module '"interface-variable"' has no default export.
tests/cases/compiler/main.ts(30,8): error TS1192: External module '"module"' has no default export.
tests/cases/compiler/main.ts(31,8): error TS1192: External module '"interface-module"' has no default export.
tests/cases/compiler/main.ts(32,8): error TS1192: External module '"variable-module"' has no default export.
tests/cases/compiler/main.ts(33,8): error TS1192: External module '"function"' has no default export.
tests/cases/compiler/main.ts(34,8): error TS1192: External module '"function-module"' has no default export.
tests/cases/compiler/main.ts(35,8): error TS1192: External module '"class"' has no default export.
tests/cases/compiler/main.ts(36,8): error TS1192: External module '"class-module"' has no default export.
tests/cases/compiler/main.ts(39,21): error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(45,21): error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(47,21): error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(62,25): error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(68,25): error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(70,25): error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(85,25): error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(91,25): error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(93,25): error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(97,15): error TS2498: External module '"interface"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(98,15): error TS2498: External module '"variable"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(99,15): error TS2498: External module '"interface-variable"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(100,15): error TS2498: External module '"module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(101,15): error TS2498: External module '"interface-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(102,15): error TS2498: External module '"variable-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(103,15): error TS2498: External module '"function"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(104,15): error TS2498: External module '"function-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(105,15): error TS2498: External module '"class"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-module"' uses 'export =' and cannot be used with 'export *'.
==== tests/cases/compiler/main.ts (32 errors) ====
/// <reference path="modules.d.ts"/>
// import-equals
import z1 = require("interface");
import z2 = require("variable");
import z3 = require("interface-variable");
import z4 = require("module");
import z5 = require("interface-module");
import z6 = require("variable-module");
import z7 = require("function");
import z8 = require("function-module");
import z9 = require("class");
import z0 = require("class-module");
z1.a;
~~
!!! error TS2304: Cannot find name 'z1'.
z2.a;
z3.a;
z4.a;
z5.a;
z6.a;
z7.a;
~
!!! error TS2339: Property 'a' does not exist on type '() => any'.
z8.a;
z9.a;
~
!!! error TS2339: Property 'a' does not exist on type 'typeof Foo'.
z0.a;
// default import
import x1 from "interface";
~~
!!! error TS1192: External module '"interface"' has no default export.
import x2 from "variable";
~~
!!! error TS1192: External module '"variable"' has no default export.
import x3 from "interface-variable";
~~
!!! error TS1192: External module '"interface-variable"' has no default export.
import x4 from "module";
~~
!!! error TS1192: External module '"module"' has no default export.
import x5 from "interface-module";
~~
!!! error TS1192: External module '"interface-module"' has no default export.
import x6 from "variable-module";
~~
!!! error TS1192: External module '"variable-module"' has no default export.
import x7 from "function";
~~
!!! error TS1192: External module '"function"' has no default export.
import x8 from "function-module";
~~
!!! error TS1192: External module '"function-module"' has no default export.
import x9 from "class";
~~
!!! error TS1192: External module '"class"' has no default export.
import x0 from "class-module";
~~
!!! error TS1192: External module '"class-module"' has no default export.
// namespace import
import * as y1 from "interface";
~~~~~~~~~~~
!!! error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
import * as y2 from "variable";
import * as y3 from "interface-variable";
import * as y4 from "module";
import * as y5 from "interface-module";
import * as y6 from "variable-module";
import * as y7 from "function";
~~~~~~~~~~
!!! error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
import * as y8 from "function-module";
import * as y9 from "class";
~~~~~~~
!!! error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
import * as y0 from "class-module";
y1.a;
y2.a;
y3.a;
y4.a;
y5.a;
y6.a;
y7.a;
y8.a;
y9.a;
y0.a;
// named import
import { a as a1 } from "interface";
~~~~~~~~~~~
!!! error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
import { a as a2 } from "variable";
import { a as a3 } from "interface-variable";
import { a as a4 } from "module";
import { a as a5 } from "interface-module";
import { a as a6 } from "variable-module";
import { a as a7 } from "function";
~~~~~~~~~~
!!! error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
import { a as a8 } from "function-module";
import { a as a9 } from "class";
~~~~~~~
!!! error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
import { a as a0 } from "class-module";
a1;
a2;
a3;
a4;
a5;
a6;
a7;
a8;
a9;
a0;
// named export
export { a as a1 } from "interface";
~~~~~~~~~~~
!!! error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
export { a as a2 } from "variable";
export { a as a3 } from "interface-variable";
export { a as a4 } from "module";
export { a as a5 } from "interface-module";
export { a as a6 } from "variable-module";
export { a as a7 } from "function";
~~~~~~~~~~
!!! error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
export { a as a8 } from "function-module";
export { a as a9 } from "class";
~~~~~~~
!!! error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
export { a as a0 } from "class-module";
// export-star
export * from "interface";
~~~~~~~~~~~
!!! error TS2498: External module '"interface"' uses 'export =' and cannot be used with 'export *'.
export * from "variable";
~~~~~~~~~~
!!! error TS2498: External module '"variable"' uses 'export =' and cannot be used with 'export *'.
export * from "interface-variable";
~~~~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"interface-variable"' uses 'export =' and cannot be used with 'export *'.
export * from "module";
~~~~~~~~
!!! error TS2498: External module '"module"' uses 'export =' and cannot be used with 'export *'.
export * from "interface-module";
~~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"interface-module"' uses 'export =' and cannot be used with 'export *'.
export * from "variable-module";
~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"variable-module"' uses 'export =' and cannot be used with 'export *'.
export * from "function";
~~~~~~~~~~
!!! error TS2498: External module '"function"' uses 'export =' and cannot be used with 'export *'.
export * from "function-module";
~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"function-module"' uses 'export =' and cannot be used with 'export *'.
export * from "class";
~~~~~~~
!!! error TS2498: External module '"class"' uses 'export =' and cannot be used with 'export *'.
export * from "class-module";
~~~~~~~~~~~~~~
!!! error TS2498: External module '"class-module"' uses 'export =' and cannot be used with 'export *'.
==== tests/cases/compiler/modules.d.ts (0 errors) ====
declare module "interface" {
interface Foo {
x: number;
y: number;
}
export = Foo;
}
declare module "variable" {
var Foo: {
a: number;
b: number;
}
export = Foo;
}
declare module "interface-variable" {
interface Foo {
x: number;
y: number;
}
var Foo: {
a: number;
b: number;
}
export = Foo;
}
declare module "module" {
module Foo {
export var a: number;
export var b: number;
}
export = Foo;
}
declare module "interface-module" {
interface Foo {
x: number;
y: number;
}
module Foo {
export var a: number;
export var b: number;
}
export = Foo;
}
declare module "variable-module" {
module Foo {
interface Bar {
x: number;
y: number;
}
}
var Foo: {
a: number;
b: number;
}
export = Foo;
}
declare module "function" {
function foo();
export = foo;
}
declare module "function-module" {
function foo();
module foo {
export var a: number;
export var b: number;
}
export = foo;
}
declare module "class" {
class Foo {
x: number;
y: number;
}
export = Foo;
}
declare module "class-module" {
class Foo {
x: number;
y: number;
}
module Foo {
export var a: number;
export var b: number;
}
export = Foo;
}
@@ -0,0 +1,301 @@
//// [tests/cases/compiler/es6ExportEqualsInterop.ts] ////
//// [modules.d.ts]
declare module "interface" {
interface Foo {
x: number;
y: number;
}
export = Foo;
}
declare module "variable" {
var Foo: {
a: number;
b: number;
}
export = Foo;
}
declare module "interface-variable" {
interface Foo {
x: number;
y: number;
}
var Foo: {
a: number;
b: number;
}
export = Foo;
}
declare module "module" {
module Foo {
export var a: number;
export var b: number;
}
export = Foo;
}
declare module "interface-module" {
interface Foo {
x: number;
y: number;
}
module Foo {
export var a: number;
export var b: number;
}
export = Foo;
}
declare module "variable-module" {
module Foo {
interface Bar {
x: number;
y: number;
}
}
var Foo: {
a: number;
b: number;
}
export = Foo;
}
declare module "function" {
function foo();
export = foo;
}
declare module "function-module" {
function foo();
module foo {
export var a: number;
export var b: number;
}
export = foo;
}
declare module "class" {
class Foo {
x: number;
y: number;
}
export = Foo;
}
declare module "class-module" {
class Foo {
x: number;
y: number;
}
module Foo {
export var a: number;
export var b: number;
}
export = Foo;
}
//// [main.ts]
/// <reference path="modules.d.ts"/>
// import-equals
import z1 = require("interface");
import z2 = require("variable");
import z3 = require("interface-variable");
import z4 = require("module");
import z5 = require("interface-module");
import z6 = require("variable-module");
import z7 = require("function");
import z8 = require("function-module");
import z9 = require("class");
import z0 = require("class-module");
z1.a;
z2.a;
z3.a;
z4.a;
z5.a;
z6.a;
z7.a;
z8.a;
z9.a;
z0.a;
// default import
import x1 from "interface";
import x2 from "variable";
import x3 from "interface-variable";
import x4 from "module";
import x5 from "interface-module";
import x6 from "variable-module";
import x7 from "function";
import x8 from "function-module";
import x9 from "class";
import x0 from "class-module";
// namespace import
import * as y1 from "interface";
import * as y2 from "variable";
import * as y3 from "interface-variable";
import * as y4 from "module";
import * as y5 from "interface-module";
import * as y6 from "variable-module";
import * as y7 from "function";
import * as y8 from "function-module";
import * as y9 from "class";
import * as y0 from "class-module";
y1.a;
y2.a;
y3.a;
y4.a;
y5.a;
y6.a;
y7.a;
y8.a;
y9.a;
y0.a;
// named import
import { a as a1 } from "interface";
import { a as a2 } from "variable";
import { a as a3 } from "interface-variable";
import { a as a4 } from "module";
import { a as a5 } from "interface-module";
import { a as a6 } from "variable-module";
import { a as a7 } from "function";
import { a as a8 } from "function-module";
import { a as a9 } from "class";
import { a as a0 } from "class-module";
a1;
a2;
a3;
a4;
a5;
a6;
a7;
a8;
a9;
a0;
// named export
export { a as a1 } from "interface";
export { a as a2 } from "variable";
export { a as a3 } from "interface-variable";
export { a as a4 } from "module";
export { a as a5 } from "interface-module";
export { a as a6 } from "variable-module";
export { a as a7 } from "function";
export { a as a8 } from "function-module";
export { a as a9 } from "class";
export { a as a0 } from "class-module";
// export-star
export * from "interface";
export * from "variable";
export * from "interface-variable";
export * from "module";
export * from "interface-module";
export * from "variable-module";
export * from "function";
export * from "function-module";
export * from "class";
export * from "class-module";
//// [main.js]
/// <reference path="modules.d.ts"/>
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var z2 = require("variable");
var z3 = require("interface-variable");
var z4 = require("module");
var z5 = require("interface-module");
var z6 = require("variable-module");
var z7 = require("function");
var z8 = require("function-module");
var z9 = require("class");
var z0 = require("class-module");
z1.a;
z2.a;
z3.a;
z4.a;
z5.a;
z6.a;
z7.a;
z8.a;
z9.a;
z0.a;
// namespace import
var y1 = require("interface");
var y2 = require("variable");
var y3 = require("interface-variable");
var y4 = require("module");
var y5 = require("interface-module");
var y6 = require("variable-module");
var y7 = require("function");
var y8 = require("function-module");
var y9 = require("class");
var y0 = require("class-module");
y1.a;
y2.a;
y3.a;
y4.a;
y5.a;
y6.a;
y7.a;
y8.a;
y9.a;
y0.a;
// named import
var interface_1 = require("interface");
var variable_1 = require("variable");
var interface_variable_1 = require("interface-variable");
var module_1 = require("module");
var interface_module_1 = require("interface-module");
var variable_module_1 = require("variable-module");
var function_1 = require("function");
var function_module_1 = require("function-module");
var class_1 = require("class");
var class_module_1 = require("class-module");
interface_1.a;
variable_1.a;
interface_variable_1.a;
module_1.a;
interface_module_1.a;
variable_module_1.a;
function_1.a;
function_module_1.a;
class_1.a;
class_module_1.a;
// named export
var variable_2 = require("variable");
exports.a2 = variable_2.a;
var interface_variable_2 = require("interface-variable");
exports.a3 = interface_variable_2.a;
var module_2 = require("module");
exports.a4 = module_2.a;
var interface_module_2 = require("interface-module");
exports.a5 = interface_module_2.a;
var variable_module_2 = require("variable-module");
exports.a6 = variable_module_2.a;
var function_module_2 = require("function-module");
exports.a8 = function_module_2.a;
var class_module_2 = require("class-module");
exports.a0 = class_module_2.a;
// export-star
__export(require("interface"));
__export(require("variable"));
__export(require("interface-variable"));
__export(require("module"));
__export(require("interface-module"));
__export(require("variable-module"));
__export(require("function"));
__export(require("function-module"));
__export(require("class"));
__export(require("class-module"));
@@ -1,15 +0,0 @@
tests/cases/compiler/es6ImportDefaultBinding_0.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
==== tests/cases/compiler/es6ImportDefaultBinding_0.ts (1 errors) ====
var a = 10;
export = a;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
==== tests/cases/compiler/es6ImportDefaultBinding_1.ts (0 errors) ====
import defaultBinding from "es6ImportDefaultBinding_0";
var x = defaultBinding;
import defaultBinding2 from "es6ImportDefaultBinding_0"; // elide this import since defaultBinding2 is not used
@@ -3,7 +3,7 @@
//// [es6ImportDefaultBinding_0.ts]
var a = 10;
export = a;
export default a;
//// [es6ImportDefaultBinding_1.ts]
import defaultBinding from "es6ImportDefaultBinding_0";
@@ -21,5 +21,5 @@ var x = defaultBinding;
//// [es6ImportDefaultBinding_0.d.ts]
declare var a: number;
export = a;
export default a;
//// [es6ImportDefaultBinding_1.d.ts]
@@ -0,0 +1,19 @@
=== tests/cases/compiler/es6ImportDefaultBinding_0.ts ===
var a = 10;
>a : number
export default a;
>a : number
=== tests/cases/compiler/es6ImportDefaultBinding_1.ts ===
import defaultBinding from "es6ImportDefaultBinding_0";
>defaultBinding : number
var x = defaultBinding;
>x : number
>defaultBinding : number
import defaultBinding2 from "es6ImportDefaultBinding_0"; // elide this import since defaultBinding2 is not used
>defaultBinding2 : number
@@ -3,7 +3,7 @@
//// [es6ImportDefaultBindingAmd_0.ts]
var a = 10;
export = a;
export default a;
//// [es6ImportDefaultBindingAmd_1.ts]
import defaultBinding from "es6ImportDefaultBindingAmd_0";
@@ -14,15 +14,15 @@ import defaultBinding2 from "es6ImportDefaultBindingAmd_0"; // elide this import
//// [es6ImportDefaultBindingAmd_0.js]
define(["require", "exports"], function (require, exports) {
var a = 10;
return a;
exports.default = a;
});
//// [es6ImportDefaultBindingAmd_1.js]
define(["require", "exports", "es6ImportDefaultBindingAmd_0"], function (require, exports, defaultBinding) {
var x = defaultBinding;
define(["require", "exports", "es6ImportDefaultBindingAmd_0"], function (require, exports, es6ImportDefaultBindingAmd_0_1) {
var x = es6ImportDefaultBindingAmd_0_1.default;
});
//// [es6ImportDefaultBindingAmd_0.d.ts]
declare var a: number;
export = a;
export default a;
//// [es6ImportDefaultBindingAmd_1.d.ts]
@@ -3,7 +3,7 @@
var a = 10;
>a : number
export = a;
export default a;
>a : number
=== tests/cases/compiler/es6ImportDefaultBindingAmd_1.ts ===
@@ -3,7 +3,7 @@
//// [server.ts]
class c { }
export = c;
export default c;
//// [client.ts]
import defaultBinding from "server";
@@ -17,16 +17,16 @@ var c = (function () {
}
return c;
})();
module.exports = c;
exports.default = c;
//// [client.js]
var defaultBinding = require("server");
exports.x = new defaultBinding();
var server_1 = require("server");
exports.x = new server_1.default();
//// [server.d.ts]
declare class c {
}
export = c;
export default c;
//// [client.d.ts]
import defaultBinding from "server";
export declare var x: defaultBinding;
@@ -3,7 +3,7 @@
class c { }
>c : c
export = c;
export default c;
>c : c
=== tests/cases/compiler/client.ts ===
@@ -1,10 +1,4 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(9,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(11,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
@@ -13,30 +7,19 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(11,8):
export var a = 10;
export var x = a;
export var m = a;
export default {};
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (6 errors) ====
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (0 errors) ====
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
var x1: number = a;
import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
var x1: number = b;
import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
var x1: number = x;
var x1: number = y;
import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
var x1: number = z;
import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
var x1: number = m;
@@ -5,6 +5,7 @@
export var a = 10;
export var x = a;
export var m = a;
export default {};
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.ts]
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
@@ -25,6 +26,7 @@ var x1: number = m;
export var a = 10;
export var x = a;
export var m = a;
export default {};
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js]
import { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1 = a;
@@ -43,4 +45,5 @@ var x1 = m;
export declare var a: number;
export declare var x: number;
export declare var m: number;
export default : {};
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.d.ts]
@@ -1,4 +1,3 @@
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(3,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(5,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(7,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'.
@@ -7,12 +6,10 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(9,27):
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(11,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'm'.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0.ts (1 errors) ====
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0.ts (0 errors) ====
var a = 10;
export = a;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
export default a;
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts (6 errors) ====
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1_0";
@@ -3,7 +3,7 @@
//// [es6ImportDefaultBindingFollowedWithNamedImport1_0.ts]
var a = 10;
export = a;
export default a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1_1.ts]
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1_0";
@@ -40,5 +40,5 @@ var x1 = defaultBinding6;
//// [es6ImportDefaultBindingFollowedWithNamedImport1_0.d.ts]
declare var a: number;
export = a;
export default a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1_1.d.ts]
@@ -9,7 +9,7 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(1
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.ts (0 errors) ====
var a = 10;
export = a;
export default a;
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts (6 errors) ====
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
@@ -3,7 +3,7 @@
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.ts]
var a = 10;
export = a;
export default a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts]
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
@@ -22,23 +22,23 @@ var x: number = defaultBinding6;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.js]
var a = 10;
module.exports = a;
exports.default = a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.js]
var defaultBinding1 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = defaultBinding1;
var defaultBinding2 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = defaultBinding2;
var defaultBinding3 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = defaultBinding3;
var defaultBinding4 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = defaultBinding4;
var defaultBinding5 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = defaultBinding5;
var defaultBinding6 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = defaultBinding6;
var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1.default;
var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2.default;
var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3.default;
var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4.default;
var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5.default;
var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6.default;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.d.ts]
declare var a: number;
export = a;
export default a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.d.ts]
@@ -15,7 +15,7 @@ tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compil
==== tests/cases/compiler/server.ts (0 errors) ====
var a = 10;
export = a;
export default a;
==== tests/cases/compiler/client.ts (12 errors) ====
export import defaultBinding1, { } from "server";
@@ -3,7 +3,7 @@
//// [server.ts]
var a = 10;
export = a;
export default a;
//// [client.ts]
export import defaultBinding1, { } from "server";
@@ -22,25 +22,25 @@ export var x1: number = defaultBinding6;
//// [server.js]
var a = 10;
module.exports = a;
exports.default = a;
//// [client.js]
var defaultBinding1 = require("server");
exports.x1 = defaultBinding1;
var defaultBinding2 = require("server");
exports.x1 = defaultBinding2;
var defaultBinding3 = require("server");
exports.x1 = defaultBinding3;
var defaultBinding4 = require("server");
exports.x1 = defaultBinding4;
var defaultBinding5 = require("server");
exports.x1 = defaultBinding5;
var defaultBinding6 = require("server");
exports.x1 = defaultBinding6;
var server_1 = require("server");
exports.x1 = server_1.default;
var server_2 = require("server");
exports.x1 = server_2.default;
var server_3 = require("server");
exports.x1 = server_3.default;
var server_4 = require("server");
exports.x1 = server_4.default;
var server_5 = require("server");
exports.x1 = server_5.default;
var server_6 = require("server");
exports.x1 = server_6.default;
//// [server.d.ts]
declare var a: number;
export = a;
export default a;
//// [client.d.ts]
export declare var x1: number;
export declare var x1: number;
@@ -1,9 +1,9 @@
tests/cases/compiler/client.ts(1,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(2,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(4,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(6,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(9,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(11,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(1,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(2,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(4,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(6,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(9,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(11,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
==== tests/cases/compiler/server.ts (0 errors) ====
@@ -18,26 +18,26 @@ tests/cases/compiler/client.ts(11,8): error TS1192: External module '"tests/case
==== tests/cases/compiler/client.ts (6 errors) ====
import defaultBinding1, { } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
import defaultBinding2, { a } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
export var x1 = new a();
import defaultBinding3, { a11 as b } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
export var x2 = new b();
import defaultBinding4, { x, a12 as y } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
export var x4 = new x();
export var x5 = new y();
import defaultBinding5, { x11 as z, } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
export var x3 = new z();
import defaultBinding6, { m, } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
export var x6 = new m();
@@ -9,7 +9,7 @@ tests/cases/compiler/client.ts(11,27): error TS2305: Module '"tests/cases/compil
==== tests/cases/compiler/server.ts (0 errors) ====
class a { }
export = a;
export default a;
==== tests/cases/compiler/client.ts (6 errors) ====
import defaultBinding1, { } from "server";
@@ -3,7 +3,7 @@
//// [server.ts]
class a { }
export = a;
export default a;
//// [client.ts]
import defaultBinding1, { } from "server";
@@ -25,26 +25,26 @@ var a = (function () {
}
return a;
})();
module.exports = a;
exports.default = a;
//// [client.js]
var defaultBinding1 = require("server");
exports.x1 = new defaultBinding1();
var defaultBinding2 = require("server");
exports.x2 = new defaultBinding2();
var defaultBinding3 = require("server");
exports.x3 = new defaultBinding3();
var defaultBinding4 = require("server");
exports.x4 = new defaultBinding4();
var defaultBinding5 = require("server");
exports.x5 = new defaultBinding5();
var defaultBinding6 = require("server");
exports.x6 = new defaultBinding6();
var server_1 = require("server");
exports.x1 = new server_1.default();
var server_2 = require("server");
exports.x2 = new server_2.default();
var server_3 = require("server");
exports.x3 = new server_3.default();
var server_4 = require("server");
exports.x4 = new server_4.default();
var server_5 = require("server");
exports.x5 = new server_5.default();
var server_6 = require("server");
exports.x6 = new server_6.default();
//// [server.d.ts]
declare class a {
}
export = a;
export default a;
//// [client.d.ts]
import defaultBinding1 from "server";
export declare var x1: defaultBinding1;
@@ -1,9 +1,9 @@
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(9,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(11,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(9,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(11,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.ts (0 errors) ====
@@ -15,26 +15,26 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(11
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts (6 errors) ====
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = a;
import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = b;
import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = x;
var x1: number = y;
import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = z;
import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = m;
@@ -1,15 +1,9 @@
tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(1,15): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(2,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(2,15): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(4,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(4,15): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(6,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(6,15): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(9,15): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(11,15): error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
==== tests/cases/compiler/server.ts (0 errors) ====
@@ -17,42 +11,31 @@ tests/cases/compiler/client.ts(11,15): error TS1192: External module '"tests/cas
export var a = 10;
export var x = a;
export var m = a;
export default {};
==== tests/cases/compiler/client.ts (12 errors) ====
==== tests/cases/compiler/client.ts (6 errors) ====
export import defaultBinding1, { } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
export import defaultBinding2, { a } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
export var x1: number = a;
export import defaultBinding3, { a as b } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
export var x1: number = b;
export import defaultBinding4, { x, a as y } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
export var x1: number = x;
export var x1: number = y;
export import defaultBinding5, { x as z, } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
export var x1: number = z;
export import defaultBinding6, { m, } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
export var x1: number = m;
@@ -5,6 +5,7 @@
export var a = 10;
export var x = a;
export var m = a;
export default {};
//// [client.ts]
export import defaultBinding1, { } from "server";
@@ -26,6 +27,7 @@ define(["require", "exports"], function (require, exports) {
exports.a = 10;
exports.x = exports.a;
exports.m = exports.a;
exports.default = {};
});
//// [client.js]
define(["require", "exports", "server", "server", "server", "server", "server"], function (require, exports, server_1, server_2, server_3, server_4, server_5) {
@@ -42,6 +44,7 @@ define(["require", "exports", "server", "server", "server", "server", "server"],
export declare var a: number;
export declare var x: number;
export declare var m: number;
export default : {};
//// [client.d.ts]
export declare var x1: number;
export declare var x1: number;
@@ -1,4 +1,4 @@
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts (0 errors) ====
@@ -8,5 +8,5 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts (1 errors) ====
import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBinding_0";
~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment.
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export.
var x: number = nameSpaceBinding.a;
@@ -1,13 +0,0 @@
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts (1 errors) ====
var a = 10;
export = a;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts (0 errors) ====
import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBinding_0";
var x: number = defaultBinding;

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