mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #2139 from Microsoft/DtsExports_all
Exports + .d.ts emit
This commit is contained in:
+78
-12
@@ -512,6 +512,19 @@ module ts {
|
||||
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) {
|
||||
node = node.parent;
|
||||
}
|
||||
return <ImportDeclaration>node;
|
||||
}
|
||||
}
|
||||
|
||||
function getDeclarationOfAliasSymbol(symbol: Symbol): Declaration {
|
||||
return forEach(symbol.declarations, d => isAliasSymbolDeclaration(d) ? d : undefined);
|
||||
}
|
||||
@@ -1122,7 +1135,7 @@ module ts {
|
||||
}
|
||||
|
||||
function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult {
|
||||
let aliasesToMakeVisible: ImportEqualsDeclaration[];
|
||||
let aliasesToMakeVisible: AnyImportSyntax[];
|
||||
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -1132,17 +1145,19 @@ module ts {
|
||||
if (!isDeclarationVisible(declaration)) {
|
||||
// Mark the unexported alias as visible if its parent is visible
|
||||
// because these kind of aliases can be used to name types in declaration file
|
||||
if (declaration.kind === SyntaxKind.ImportEqualsDeclaration &&
|
||||
!(declaration.flags & NodeFlags.Export) &&
|
||||
isDeclarationVisible(<Declaration>declaration.parent)) {
|
||||
|
||||
var anyImportSyntax = getAnyImportSyntax(declaration);
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & NodeFlags.Export) && // import clause without export
|
||||
isDeclarationVisible(<Declaration>anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!contains(aliasesToMakeVisible, declaration)) {
|
||||
aliasesToMakeVisible.push(<ImportEqualsDeclaration>declaration);
|
||||
if (!contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [<ImportEqualsDeclaration>declaration];
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1766,8 +1781,15 @@ module ts {
|
||||
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
return isDeclarationVisible(<Declaration>node.parent.parent);
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
if (isBindingPattern(node.name) &&
|
||||
!(<BindingPattern>node.name).elements.length) {
|
||||
// If the binding pattern is empty, this variable declaration is not visible
|
||||
return false;
|
||||
}
|
||||
// Otherwise fall through
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
@@ -1779,7 +1801,7 @@ module ts {
|
||||
// If the node is not exported or it is not ambient module element (except import declaration)
|
||||
if (!(getCombinedNodeFlags(node) & NodeFlags.Export) &&
|
||||
!(node.kind !== SyntaxKind.ImportEqualsDeclaration && parent.kind !== SyntaxKind.SourceFile && isInAmbientContext(parent))) {
|
||||
return isGlobalSourceFile(parent) || isUsedInExportAssignment(node);
|
||||
return isGlobalSourceFile(parent);
|
||||
}
|
||||
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
|
||||
return isDeclarationVisible(<Declaration>parent);
|
||||
@@ -1812,6 +1834,8 @@ module ts {
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return isDeclarationVisible(<Declaration>node.parent);
|
||||
|
||||
// Default binding, import specifier and namespace import is visible
|
||||
// only on demand so by default it is not visible
|
||||
case SyntaxKind.ImportClause:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
@@ -1837,6 +1861,40 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function collectLinkedAliases(node: Identifier): Node[]{
|
||||
var exportSymbol: Symbol;
|
||||
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
exportSymbol = getTargetOfExportSpecifier(<ExportSpecifier>node.parent);
|
||||
}
|
||||
var result: Node[] = [];
|
||||
if (exportSymbol) {
|
||||
buildVisibleNodeList(exportSymbol.declarations);
|
||||
}
|
||||
return result;
|
||||
|
||||
function buildVisibleNodeList(declarations: Declaration[]) {
|
||||
forEach(declarations, declaration => {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
var resultNode = getAnyImportSyntax(declaration) || declaration;
|
||||
if (!contains(result, resultNode)) {
|
||||
result.push(resultNode);
|
||||
}
|
||||
|
||||
if (isInternalModuleImportEqualsDeclaration(declaration)) {
|
||||
// Add the referenced top container visible
|
||||
var internalModuleReference = <Identifier | QualifiedName>(<ImportEqualsDeclaration>declaration).moduleReference;
|
||||
var firstIdentifier = getFirstIdentifier(internalModuleReference);
|
||||
var importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace,
|
||||
Diagnostics.Cannot_find_name_0, firstIdentifier);
|
||||
buildVisibleNodeList(importSymbol.declarations);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getRootDeclaration(node: Node): Node {
|
||||
while (node.kind === SyntaxKind.BindingElement) {
|
||||
node = node.parent.parent;
|
||||
@@ -11157,6 +11215,11 @@ module ts {
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
|
||||
}
|
||||
|
||||
function writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) {
|
||||
var type = getTypeOfExpression(expr);
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
|
||||
}
|
||||
|
||||
function isUnknownIdentifier(location: Node, name: string): boolean {
|
||||
Debug.assert(!nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location");
|
||||
return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined) &&
|
||||
@@ -11200,10 +11263,12 @@ module ts {
|
||||
isImplementationOfOverload,
|
||||
writeTypeOfDeclaration,
|
||||
writeReturnTypeOfSignatureDeclaration,
|
||||
writeTypeOfExpression,
|
||||
isSymbolAccessible,
|
||||
isEntityNameVisible,
|
||||
getConstantValue,
|
||||
isUnknownIdentifier,
|
||||
collectLinkedAliases,
|
||||
getBlockScopedVariableId,
|
||||
};
|
||||
}
|
||||
@@ -12141,8 +12206,8 @@ module ts {
|
||||
}
|
||||
|
||||
function checkGrammarTopLevelElementForRequiredDeclareModifier(node: Node): boolean {
|
||||
// A declare modifier is required for any top level .d.ts declaration except export=, interfaces and imports:
|
||||
// categories:
|
||||
// A declare modifier is required for any top level .d.ts declaration except export=, export default,
|
||||
// interfaces and imports categories:
|
||||
//
|
||||
// DeclarationElement:
|
||||
// ExportAssignment
|
||||
@@ -12156,7 +12221,8 @@ module ts {
|
||||
node.kind === SyntaxKind.ImportEqualsDeclaration ||
|
||||
node.kind === SyntaxKind.ExportDeclaration ||
|
||||
node.kind === SyntaxKind.ExportAssignment ||
|
||||
(node.flags & NodeFlags.Ambient)) {
|
||||
(node.flags & NodeFlags.Ambient) ||
|
||||
(node.flags & (NodeFlags.Export | NodeFlags.Default))) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -415,6 +415,7 @@ module ts {
|
||||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
|
||||
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." },
|
||||
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: DiagnosticCategory.Error, key: "Default export of the module has or is using private name '{0}'." },
|
||||
Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: DiagnosticCategory.Error, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." },
|
||||
The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." },
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
|
||||
|
||||
@@ -1653,6 +1653,10 @@
|
||||
"category": "Error",
|
||||
"code": 4081
|
||||
},
|
||||
"Default export of the module has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 4082
|
||||
},
|
||||
"Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.": {
|
||||
"category": "Error",
|
||||
"code": 4091
|
||||
|
||||
+448
-201
@@ -40,16 +40,18 @@ module ts {
|
||||
getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic;
|
||||
}
|
||||
|
||||
interface AliasDeclarationEmitInfo {
|
||||
declaration: ImportEqualsDeclaration;
|
||||
interface ModuleElementDeclarationEmitInfo {
|
||||
node: Node;
|
||||
outputPos: number;
|
||||
indent: number;
|
||||
asynchronousOutput?: string; // If the output for alias was written asynchronously, the corresponding output
|
||||
subModuleElementDeclarationEmitInfo?: ModuleElementDeclarationEmitInfo[];
|
||||
isVisible?: boolean;
|
||||
}
|
||||
|
||||
interface DeclarationEmit {
|
||||
reportedDeclarationError: boolean;
|
||||
aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[];
|
||||
moduleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[];
|
||||
synchronousDeclarationOutput: string;
|
||||
referencePathsOutput: string;
|
||||
}
|
||||
@@ -374,7 +376,8 @@ module ts {
|
||||
let emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments;
|
||||
let emit = compilerOptions.stripInternal ? stripInternal : emitNode;
|
||||
|
||||
let aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = [];
|
||||
let moduleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[] = [];
|
||||
let asynchronousSubModuleDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[];
|
||||
|
||||
// Contains the reference paths that needs to go in the declaration file.
|
||||
// Collecting this separately because reference paths need to be first thing in the declaration file
|
||||
@@ -402,6 +405,21 @@ module ts {
|
||||
}
|
||||
|
||||
emitSourceFile(root);
|
||||
|
||||
// create asynchronous output for the importDeclarations
|
||||
if (moduleElementDeclarationEmitInfo.length) {
|
||||
let oldWriter = writer;
|
||||
forEach(moduleElementDeclarationEmitInfo, aliasEmitInfo => {
|
||||
if (aliasEmitInfo.isVisible) {
|
||||
Debug.assert(aliasEmitInfo.node.kind === SyntaxKind.ImportDeclaration);
|
||||
createAndSetNewTextWriterWithSymbolWriter();
|
||||
Debug.assert(aliasEmitInfo.indent === 0);
|
||||
writeImportDeclaration(<ImportDeclaration>aliasEmitInfo.node);
|
||||
aliasEmitInfo.asynchronousOutput = writer.getText();
|
||||
}
|
||||
});
|
||||
setWriter(oldWriter);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Emit references corresponding to this file
|
||||
@@ -430,7 +448,7 @@ module ts {
|
||||
|
||||
return {
|
||||
reportedDeclarationError,
|
||||
aliasDeclarationEmitInfo,
|
||||
moduleElementDeclarationEmitInfo,
|
||||
synchronousDeclarationOutput: writer.getText(),
|
||||
referencePathsOutput,
|
||||
}
|
||||
@@ -475,10 +493,23 @@ module ts {
|
||||
decreaseIndent = newWriter.decreaseIndent;
|
||||
}
|
||||
|
||||
function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations: ImportEqualsDeclaration[]) {
|
||||
function writeAsynchronousModuleElements(nodes: Node[]) {
|
||||
let oldWriter = writer;
|
||||
forEach(importEqualsDeclarations, aliasToWrite => {
|
||||
let aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined);
|
||||
forEach(nodes, declaration => {
|
||||
let nodeToCheck: Node;
|
||||
if (declaration.kind === SyntaxKind.VariableDeclaration) {
|
||||
nodeToCheck = declaration.parent.parent;
|
||||
} else if (declaration.kind === SyntaxKind.NamedImports || declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ImportClause) {
|
||||
Debug.fail("We should be getting ImportDeclaration instead to write");
|
||||
} else {
|
||||
nodeToCheck = declaration;
|
||||
}
|
||||
|
||||
let moduleElementEmitInfo = forEach(moduleElementDeclarationEmitInfo, declEmitInfo => declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined);
|
||||
if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) {
|
||||
moduleElementEmitInfo = forEach(asynchronousSubModuleDeclarationEmitInfo, declEmitInfo => declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined);
|
||||
}
|
||||
|
||||
// If the alias was marked as not visible when we saw its declaration, we would have saved the aliasEmitInfo, but if we haven't yet visited the alias declaration
|
||||
// then we don't need to write it at this point. We will write it when we actually see its declaration
|
||||
// Eg.
|
||||
@@ -486,13 +517,29 @@ module ts {
|
||||
// import foo = require("foo");
|
||||
// Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing,
|
||||
// we would write alias foo declaration when we visit it since it would now be marked as visible
|
||||
if (aliasEmitInfo) {
|
||||
createAndSetNewTextWriterWithSymbolWriter();
|
||||
for (let declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) {
|
||||
increaseIndent();
|
||||
if (moduleElementEmitInfo) {
|
||||
if (moduleElementEmitInfo.node.kind === SyntaxKind.ImportDeclaration) {
|
||||
// we have to create asynchronous output only after we have collected complete information
|
||||
// because it is possible to enable multiple bindings as asynchronously visible
|
||||
moduleElementEmitInfo.isVisible = true;
|
||||
}
|
||||
else {
|
||||
createAndSetNewTextWriterWithSymbolWriter();
|
||||
for (let declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) {
|
||||
increaseIndent();
|
||||
}
|
||||
|
||||
if (nodeToCheck.kind === SyntaxKind.ModuleDeclaration) {
|
||||
Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined);
|
||||
asynchronousSubModuleDeclarationEmitInfo = [];
|
||||
}
|
||||
writeModuleElement(nodeToCheck);
|
||||
if (nodeToCheck.kind === SyntaxKind.ModuleDeclaration) {
|
||||
moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo;
|
||||
asynchronousSubModuleDeclarationEmitInfo = undefined;
|
||||
}
|
||||
moduleElementEmitInfo.asynchronousOutput = writer.getText();
|
||||
}
|
||||
writeImportEqualsDeclaration(aliasToWrite);
|
||||
aliasEmitInfo.asynchronousOutput = writer.getText();
|
||||
}
|
||||
});
|
||||
setWriter(oldWriter);
|
||||
@@ -502,7 +549,7 @@ module ts {
|
||||
if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
|
||||
// write the aliases
|
||||
if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) {
|
||||
writeAsychronousImportEqualsDeclarations(symbolAccesibilityResult.aliasesToMakeVisible);
|
||||
writeAsynchronousModuleElements(symbolAccesibilityResult.aliasesToMakeVisible);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -561,19 +608,21 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitSeparatedList(nodes: Node[], separator: string, eachNodeEmitFn: (node: Node) => void) {
|
||||
function emitSeparatedList(nodes: Node[], separator: string, eachNodeEmitFn: (node: Node) => void, canEmitFn?: (node: Node) => boolean) {
|
||||
let currentWriterPos = writer.getTextPos();
|
||||
for (let node of nodes) {
|
||||
if (currentWriterPos !== writer.getTextPos()) {
|
||||
write(separator);
|
||||
if (!canEmitFn || canEmitFn(node)) {
|
||||
if (currentWriterPos !== writer.getTextPos()) {
|
||||
write(separator);
|
||||
}
|
||||
currentWriterPos = writer.getTextPos();
|
||||
eachNodeEmitFn(node);
|
||||
}
|
||||
currentWriterPos = writer.getTextPos();
|
||||
eachNodeEmitFn(node);
|
||||
}
|
||||
}
|
||||
|
||||
function emitCommaList(nodes: Node[], eachNodeEmitFn: (node: Node) => void) {
|
||||
emitSeparatedList(nodes, ", ", eachNodeEmitFn);
|
||||
function emitCommaList(nodes: Node[], eachNodeEmitFn: (node: Node) => void, canEmitFn?: (node: Node) => boolean) {
|
||||
emitSeparatedList(nodes, ", ", eachNodeEmitFn, canEmitFn);
|
||||
}
|
||||
|
||||
function writeJsDocComments(declaration: Node) {
|
||||
@@ -702,9 +751,100 @@ module ts {
|
||||
|
||||
function emitExportAssignment(node: ExportAssignment) {
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
writeTextOfNode(currentSourceFile, node.expression);
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
writeTextOfNode(currentSourceFile, node.expression);
|
||||
}
|
||||
else {
|
||||
write(": ");
|
||||
if (node.type) {
|
||||
emitType(node.type);
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
|
||||
// Make all the declarations visible for the export name
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
let nodes = resolver.collectLinkedAliases(<Identifier>node.expression);
|
||||
|
||||
// write each of these declarations asynchronously
|
||||
writeAsynchronousModuleElements(nodes);
|
||||
}
|
||||
|
||||
function getDefaultExportAccessibilityDiagnostic(diagnostic: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
return {
|
||||
diagnosticMessage: Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
|
||||
errorNode: node
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function isModuleElementVisible(node: Declaration) {
|
||||
return resolver.isDeclarationVisible(node);
|
||||
}
|
||||
|
||||
function emitModuleElement(node: Node, isModuleElementVisible: boolean) {
|
||||
if (isModuleElementVisible) {
|
||||
writeModuleElement(node);
|
||||
}
|
||||
// Import equals declaration in internal module can become visible as part of any emit so lets make sure we add these irrespective
|
||||
else if (node.kind === SyntaxKind.ImportEqualsDeclaration ||
|
||||
(node.parent.kind === SyntaxKind.SourceFile && isExternalModule(currentSourceFile))) {
|
||||
let isVisible: boolean;
|
||||
if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== SyntaxKind.SourceFile) {
|
||||
// Import declaration of another module that is visited async so lets put it in right spot
|
||||
asynchronousSubModuleDeclarationEmitInfo.push({
|
||||
node,
|
||||
outputPos: writer.getTextPos(),
|
||||
indent: writer.getIndent(),
|
||||
isVisible
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (node.kind === SyntaxKind.ImportDeclaration) {
|
||||
let importDeclaration = <ImportDeclaration>node;
|
||||
if (importDeclaration.importClause) {
|
||||
isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) ||
|
||||
isVisibleNamedBinding(importDeclaration.importClause.namedBindings);
|
||||
}
|
||||
}
|
||||
moduleElementDeclarationEmitInfo.push({
|
||||
node,
|
||||
outputPos: writer.getTextPos(),
|
||||
indent: writer.getIndent(),
|
||||
isVisible
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeModuleElement(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return writeFunctionDeclaration(<FunctionLikeDeclaration>node);
|
||||
case SyntaxKind.VariableStatement:
|
||||
return writeVariableStatement(<VariableStatement>node);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return writeInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return writeClassDeclaration(<ClassDeclaration>node);
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return writeTypeAliasDeclaration(<TypeAliasDeclaration>node);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return writeEnumDeclaration(<EnumDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return writeModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
return writeImportEqualsDeclaration(<ImportEqualsDeclaration>node);
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
return writeImportDeclaration(<ImportDeclaration>node);
|
||||
default:
|
||||
Debug.fail("Unknown symbol kind");
|
||||
}
|
||||
}
|
||||
|
||||
function emitModuleElementDeclarationFlags(node: Node) {
|
||||
@@ -715,7 +855,10 @@ module ts {
|
||||
write("export ");
|
||||
}
|
||||
|
||||
if (node.kind !== SyntaxKind.InterfaceDeclaration) {
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
write("default ");
|
||||
}
|
||||
else if (node.kind !== SyntaxKind.InterfaceDeclaration) {
|
||||
write("declare ");
|
||||
}
|
||||
}
|
||||
@@ -734,19 +877,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitImportEqualsDeclaration(node: ImportEqualsDeclaration) {
|
||||
let nodeEmitInfo = {
|
||||
declaration: node,
|
||||
outputPos: writer.getTextPos(),
|
||||
indent: writer.getIndent(),
|
||||
hasWritten: resolver.isDeclarationVisible(node)
|
||||
};
|
||||
aliasDeclarationEmitInfo.push(nodeEmitInfo);
|
||||
if (nodeEmitInfo.hasWritten) {
|
||||
writeImportEqualsDeclaration(node);
|
||||
}
|
||||
}
|
||||
|
||||
function writeImportEqualsDeclaration(node: ImportEqualsDeclaration) {
|
||||
// note usage of writer. methods instead of aliases created, just to make sure we are using
|
||||
// correct writer especially to handle asynchronous alias writing
|
||||
@@ -777,41 +907,123 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("module ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
while (node.body.kind !== SyntaxKind.ModuleBlock) {
|
||||
node = <ModuleDeclaration>node.body;
|
||||
write(".");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
function isVisibleNamedBinding(namedBindings: NamespaceImport | NamedImports): boolean {
|
||||
if (namedBindings) {
|
||||
if (namedBindings.kind === SyntaxKind.NamespaceImport) {
|
||||
return resolver.isDeclarationVisible(<NamespaceImport>namedBindings);
|
||||
}
|
||||
else {
|
||||
return forEach((<NamedImports>namedBindings).elements, namedImport => resolver.isDeclarationVisible(namedImport));
|
||||
}
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines((<ModuleBlock>node.body).statements);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
}
|
||||
}
|
||||
|
||||
function emitTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("type ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
write(" = ");
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);
|
||||
write(";");
|
||||
writeLine();
|
||||
function writeImportDeclaration(node: ImportDeclaration) {
|
||||
if (!node.importClause && !(node.flags & NodeFlags.Export)) {
|
||||
// do not write non-exported import declarations that don't have import clauses
|
||||
return;
|
||||
}
|
||||
emitJsDocComments(node);
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
write("export ");
|
||||
}
|
||||
write("import ");
|
||||
if (node.importClause) {
|
||||
let currentWriterPos = writer.getTextPos();
|
||||
if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) {
|
||||
writeTextOfNode(currentSourceFile, node.importClause.name);
|
||||
}
|
||||
if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) {
|
||||
if (currentWriterPos !== writer.getTextPos()) {
|
||||
// If the default binding was emitted, write the separated
|
||||
write(", ");
|
||||
}
|
||||
if (node.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
|
||||
write("* as ");
|
||||
writeTextOfNode(currentSourceFile, (<NamespaceImport>node.importClause.namedBindings).name);
|
||||
}
|
||||
else {
|
||||
write("{ ");
|
||||
emitCommaList((<NamedImports>node.importClause.namedBindings).elements, emitImportOrExportSpecifier, resolver.isDeclarationVisible);
|
||||
write(" }");
|
||||
}
|
||||
}
|
||||
write(" from ");
|
||||
}
|
||||
writeTextOfNode(currentSourceFile, node.moduleSpecifier);
|
||||
write(";");
|
||||
writer.writeLine();
|
||||
}
|
||||
|
||||
function emitImportOrExportSpecifier(node: ImportOrExportSpecifier) {
|
||||
if (node.propertyName) {
|
||||
writeTextOfNode(currentSourceFile, node.propertyName);
|
||||
write(" as ");
|
||||
}
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
}
|
||||
|
||||
function emitExportSpecifier(node: ExportSpecifier) {
|
||||
emitImportOrExportSpecifier(node);
|
||||
|
||||
// Make all the declarations visible for the export name
|
||||
let nodes = resolver.collectLinkedAliases(node.propertyName || node.name);
|
||||
|
||||
// write each of these declarations asynchronously
|
||||
writeAsynchronousModuleElements(nodes);
|
||||
}
|
||||
|
||||
function emitExportDeclaration(node: ExportDeclaration) {
|
||||
emitJsDocComments(node);
|
||||
write("export ");
|
||||
if (node.exportClause) {
|
||||
write("{ ");
|
||||
emitCommaList(node.exportClause.elements, emitExportSpecifier);
|
||||
write(" }");
|
||||
}
|
||||
else {
|
||||
write("*");
|
||||
}
|
||||
if (node.moduleSpecifier) {
|
||||
write(" from ");
|
||||
writeTextOfNode(currentSourceFile, node.moduleSpecifier);
|
||||
}
|
||||
write(";");
|
||||
writer.writeLine();
|
||||
}
|
||||
|
||||
function writeModuleDeclaration(node: ModuleDeclaration) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("module ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
while (node.body.kind !== SyntaxKind.ModuleBlock) {
|
||||
node = <ModuleDeclaration>node.body;
|
||||
write(".");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
}
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines((<ModuleBlock>node.body).statements);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
}
|
||||
|
||||
function writeTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("type ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
write(" = ");
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);
|
||||
write(";");
|
||||
writeLine();
|
||||
|
||||
function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
return {
|
||||
diagnosticMessage: Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,
|
||||
@@ -821,23 +1033,21 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
if (isConst(node)) {
|
||||
write("const ")
|
||||
}
|
||||
write("enum ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
function writeEnumDeclaration(node: EnumDeclaration) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
if (isConst(node)) {
|
||||
write("const ")
|
||||
}
|
||||
write("enum ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function emitEnumMemberDeclaration(node: EnumMember) {
|
||||
@@ -969,7 +1179,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassDeclaration(node: ClassDeclaration) {
|
||||
function writeClassDeclaration(node: ClassDeclaration) {
|
||||
function emitParameterProperties(constructorDeclaration: ConstructorDeclaration) {
|
||||
if (constructorDeclaration) {
|
||||
forEach(constructorDeclaration.parameters, param => {
|
||||
@@ -980,50 +1190,46 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("class ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitTypeParameters(node.typeParameters);
|
||||
let baseTypeNode = getClassBaseTypeNode(node);
|
||||
if (baseTypeNode) {
|
||||
emitHeritageClause([baseTypeNode], /*isImplementsList*/ false);
|
||||
}
|
||||
emitHeritageClause(getClassImplementedTypeNodes(node), /*isImplementsList*/ true);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitParameterProperties(getFirstConstructorWithBody(node));
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("class ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitTypeParameters(node.typeParameters);
|
||||
let baseTypeNode = getClassBaseTypeNode(node);
|
||||
if (baseTypeNode) {
|
||||
emitHeritageClause([baseTypeNode], /*isImplementsList*/ false);
|
||||
}
|
||||
emitHeritageClause(getClassImplementedTypeNodes(node), /*isImplementsList*/ true);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitParameterProperties(getFirstConstructorWithBody(node));
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
}
|
||||
|
||||
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("interface ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitTypeParameters(node.typeParameters);
|
||||
emitHeritageClause(getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
}
|
||||
function writeInterfaceDeclaration(node: InterfaceDeclaration) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("interface ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitTypeParameters(node.typeParameters);
|
||||
emitHeritageClause(getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
}
|
||||
|
||||
function emitPropertyDeclaration(node: Declaration) {
|
||||
@@ -1042,62 +1248,94 @@ module ts {
|
||||
// If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted
|
||||
// so there is no check needed to see if declaration is visible
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
|
||||
// If this node is a computed name, it can only be a symbol, because we've already skipped
|
||||
// it if it's not a well known symbol. In that case, the text of the name will be exactly
|
||||
// what we want, namely the name expression enclosed in brackets.
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
// If optional property emit ?
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) {
|
||||
write("?");
|
||||
if (isBindingPattern(node.name)) {
|
||||
emitBindingPattern(<BindingPattern>node.name);
|
||||
}
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
emitTypeOfVariableDeclarationFromTypeLiteral(node);
|
||||
}
|
||||
else if (!(node.flags & NodeFlags.Private)) {
|
||||
writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError);
|
||||
else {
|
||||
// If this node is a computed name, it can only be a symbol, because we've already skipped
|
||||
// it if it's not a well known symbol. In that case, the text of the name will be exactly
|
||||
// what we want, namely the name expression enclosed in brackets.
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
// If optional property emit ?
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
emitTypeOfVariableDeclarationFromTypeLiteral(node);
|
||||
}
|
||||
else if (!(node.flags & NodeFlags.Private)) {
|
||||
writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
let diagnosticMessage: DiagnosticMessage;
|
||||
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
if (node.kind === SyntaxKind.VariableDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
|
||||
else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) {
|
||||
// TODO(jfreeman): Deal with computed properties in error reporting.
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
let diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
|
||||
return diagnosticMessage !== undefined ? {
|
||||
diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: node.name
|
||||
} : undefined;
|
||||
}
|
||||
|
||||
function emitBindingPattern(bindingPattern: BindingPattern) {
|
||||
emitCommaList(bindingPattern.elements, emitBindingElement);
|
||||
}
|
||||
|
||||
function emitBindingElement(bindingElement: BindingElement) {
|
||||
function getBindingElementTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
let diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
|
||||
return diagnosticMessage !== undefined ? {
|
||||
diagnosticMessage,
|
||||
errorNode: bindingElement,
|
||||
typeName: bindingElement.name
|
||||
} : undefined;
|
||||
}
|
||||
|
||||
if (bindingElement.name) {
|
||||
if (isBindingPattern(bindingElement.name)) {
|
||||
emitBindingPattern(<BindingPattern>bindingElement.name);
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentSourceFile, bindingElement.name);
|
||||
writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitTypeOfVariableDeclarationFromTypeLiteral(node: VariableLikeDeclaration) {
|
||||
@@ -1110,24 +1348,25 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
let hasDeclarationWithEmit = forEach(node.declarationList.declarations, varDeclaration => resolver.isDeclarationVisible(varDeclaration));
|
||||
if (hasDeclarationWithEmit) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
if (isLet(node.declarationList)) {
|
||||
write("let ");
|
||||
}
|
||||
else if (isConst(node.declarationList)) {
|
||||
write("const ");
|
||||
}
|
||||
else {
|
||||
write("var ");
|
||||
}
|
||||
emitCommaList(node.declarationList.declarations, emitVariableDeclaration);
|
||||
write(";");
|
||||
writeLine();
|
||||
function isVariableStatementVisible(node: VariableStatement) {
|
||||
return forEach(node.declarationList.declarations, varDeclaration => resolver.isDeclarationVisible(varDeclaration));
|
||||
}
|
||||
|
||||
function writeVariableStatement(node: VariableStatement) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
if (isLet(node.declarationList)) {
|
||||
write("let ");
|
||||
}
|
||||
else if (isConst(node.declarationList)) {
|
||||
write("const ");
|
||||
}
|
||||
else {
|
||||
write("var ");
|
||||
}
|
||||
emitCommaList(node.declarationList.declarations, emitVariableDeclaration, resolver.isDeclarationVisible);
|
||||
write(";");
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function emitAccessorDeclaration(node: AccessorDeclaration) {
|
||||
@@ -1215,15 +1454,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
function writeFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
if (hasDynamicName(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting
|
||||
// so no need to verify if the declaration is visible
|
||||
if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) &&
|
||||
!resolver.isImplementationOfOverload(node)) {
|
||||
if (!resolver.isImplementationOfOverload(node)) {
|
||||
emitJsDocComments(node);
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration) {
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
@@ -1463,11 +1701,25 @@ module ts {
|
||||
|
||||
function emitNode(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return emitModuleElement(node, isModuleElementVisible(<Declaration>node));
|
||||
case SyntaxKind.VariableStatement:
|
||||
return emitModuleElement(node, isVariableStatementVisible(<VariableStatement>node));
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
// Import declaration without import clause is visible, otherwise it is not visible
|
||||
return emitModuleElement(node, /*isModuleElementVisible*/!(<ImportDeclaration>node).importClause);
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
return emitExportDeclaration(<ExportDeclaration>node);
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return emitFunctionDeclaration(<FunctionLikeDeclaration>node);
|
||||
return writeFunctionDeclaration(<FunctionLikeDeclaration>node);
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
@@ -1475,25 +1727,11 @@ module ts {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return emitAccessorDeclaration(<AccessorDeclaration>node);
|
||||
case SyntaxKind.VariableStatement:
|
||||
return emitVariableStatement(<VariableStatement>node);
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return emitPropertyDeclaration(<PropertyDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return emitInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return emitClassDeclaration(<ClassDeclaration>node);
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return emitTypeAliasDeclaration(<TypeAliasDeclaration>node);
|
||||
case SyntaxKind.EnumMember:
|
||||
return emitEnumMemberDeclaration(<EnumMember>node);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return emitEnumDeclaration(<EnumDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return emitModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
return emitImportEqualsDeclaration(<ImportEqualsDeclaration>node);
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return emitExportAssignment(<ExportAssignment>node);
|
||||
case SyntaxKind.SourceFile:
|
||||
@@ -4138,7 +4376,10 @@ module ts {
|
||||
}
|
||||
|
||||
function emitExportVariableAssignments(node: VariableDeclaration | BindingElement) {
|
||||
let name = (<VariableLikeDeclaration>node).name;
|
||||
if (node.kind === SyntaxKind.OmittedExpression) {
|
||||
return;
|
||||
}
|
||||
let name = node.name;
|
||||
if (name.kind === SyntaxKind.Identifier) {
|
||||
emitExportMemberAssignments(<Identifier>name);
|
||||
}
|
||||
@@ -6061,18 +6302,24 @@ module ts {
|
||||
// TODO(shkamat): Should we not write any declaration file if any of them can produce error,
|
||||
// or should we just not write this file like we are doing now
|
||||
if (!emitDeclarationResult.reportedDeclarationError) {
|
||||
let declarationOutput = emitDeclarationResult.referencePathsOutput;
|
||||
// apply additions
|
||||
let declarationOutput = emitDeclarationResult.referencePathsOutput
|
||||
+ getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);
|
||||
writeFile(host, diagnostics, removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM);
|
||||
}
|
||||
|
||||
function getDeclarationOutput(synchronousDeclarationOutput: string, moduleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[]) {
|
||||
let appliedSyncOutputPos = 0;
|
||||
forEach(emitDeclarationResult.aliasDeclarationEmitInfo, aliasEmitInfo => {
|
||||
let declarationOutput = "";
|
||||
// apply asynchronous additions to the synchronous output
|
||||
forEach(moduleElementDeclarationEmitInfo, aliasEmitInfo => {
|
||||
if (aliasEmitInfo.asynchronousOutput) {
|
||||
declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);
|
||||
declarationOutput += aliasEmitInfo.asynchronousOutput;
|
||||
declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);
|
||||
declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo);
|
||||
appliedSyncOutputPos = aliasEmitInfo.outputPos;
|
||||
}
|
||||
});
|
||||
declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos);
|
||||
writeFile(host, diagnostics, removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM);
|
||||
declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);
|
||||
return declarationOutput;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1189,9 +1189,11 @@ module ts {
|
||||
CannotBeNamed
|
||||
}
|
||||
|
||||
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
|
||||
export interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[]; // aliases that need to have this symbol visible
|
||||
aliasesToMakeVisible?: AnyImportSyntax[]; // aliases that need to have this symbol visible
|
||||
errorSymbolName?: string; // Optional symbol name that results in error
|
||||
errorNode?: Node; // optional node that results in error
|
||||
}
|
||||
@@ -1208,9 +1210,11 @@ module ts {
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
|
||||
@@ -927,9 +927,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -944,9 +945,11 @@ declare module "typescript" {
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
|
||||
@@ -2970,6 +2970,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -2977,9 +2982,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -3034,6 +3039,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3060,6 +3071,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
|
||||
@@ -958,9 +958,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -975,9 +976,11 @@ declare module "typescript" {
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
|
||||
@@ -3116,6 +3116,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -3123,9 +3128,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -3180,6 +3185,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3206,6 +3217,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
|
||||
@@ -959,9 +959,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -976,9 +977,11 @@ declare module "typescript" {
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
|
||||
@@ -3066,6 +3066,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -3073,9 +3078,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -3130,6 +3135,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3156,6 +3167,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
|
||||
@@ -996,9 +996,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -1013,9 +1014,11 @@ declare module "typescript" {
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
|
||||
@@ -3239,6 +3239,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -3246,9 +3251,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -3303,6 +3308,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3329,6 +3340,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [declarationEmitDefaultExport1.ts]
|
||||
export default class C {
|
||||
}
|
||||
|
||||
//// [declarationEmitDefaultExport1.js]
|
||||
export default class C {
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport1.d.ts]
|
||||
export default class C {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmitDefaultExport1.ts ===
|
||||
export default class C {
|
||||
>C : C
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [declarationEmitDefaultExport2.ts]
|
||||
export default class {
|
||||
}
|
||||
|
||||
//// [declarationEmitDefaultExport2.js]
|
||||
export default class {
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport2.d.ts]
|
||||
export default class {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmitDefaultExport2.ts ===
|
||||
export default class {
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [declarationEmitDefaultExport3.ts]
|
||||
export default function foo() {
|
||||
return ""
|
||||
}
|
||||
|
||||
//// [declarationEmitDefaultExport3.js]
|
||||
export default function foo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport3.d.ts]
|
||||
export default function foo(): string;
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/declarationEmitDefaultExport3.ts ===
|
||||
export default function foo() {
|
||||
>foo : () => string
|
||||
|
||||
return ""
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [declarationEmitDefaultExport4.ts]
|
||||
export default function () {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//// [declarationEmitDefaultExport4.js]
|
||||
export default function () {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport4.d.ts]
|
||||
export default function (): number;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/declarationEmitDefaultExport4.ts ===
|
||||
export default function () {
|
||||
No type information for this code. return 1;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [declarationEmitDefaultExport5.ts]
|
||||
export default 1 + 2;
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport5.js]
|
||||
export default 1 + 2;
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport5.d.ts]
|
||||
export default : number;
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmitDefaultExport5.ts ===
|
||||
export default 1 + 2;
|
||||
>1 + 2 : number
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [declarationEmitDefaultExport6.ts]
|
||||
export class A {}
|
||||
export default new A();
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport6.js]
|
||||
export class A {
|
||||
}
|
||||
export default new A();
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport6.d.ts]
|
||||
export declare class A {
|
||||
}
|
||||
export default : A;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/declarationEmitDefaultExport6.ts ===
|
||||
export class A {}
|
||||
>A : A
|
||||
|
||||
export default new A();
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/compiler/declarationEmitDefaultExport7.ts(2,1): error TS4082: Default export of the module has or is using private name 'A'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDefaultExport7.ts (1 errors) ====
|
||||
class A {}
|
||||
export default new A();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS4082: Default export of the module has or is using private name 'A'.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [declarationEmitDefaultExport7.ts]
|
||||
class A {}
|
||||
export default new A();
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport7.js]
|
||||
class A {
|
||||
}
|
||||
export default new A();
|
||||
@@ -0,0 +1,44 @@
|
||||
//// [declarationEmitDestructuringArrayPattern1.ts]
|
||||
|
||||
var [] = [1, "hello"]; // Dont emit anything
|
||||
var [x] = [1, "hello"]; // emit x: number
|
||||
var [x1, y1] = [1, "hello"]; // emit x1: number, y1: string
|
||||
var [, , z1] = [0, 1, 2]; // emit z1: number
|
||||
|
||||
var a = [1, "hello"];
|
||||
var [x2] = a; // emit x2: number | string
|
||||
var [x3, y3, z3] = a; // emit x3, y3, z3
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern1.js]
|
||||
var _a = [
|
||||
1,
|
||||
"hello"
|
||||
]; // Dont emit anything
|
||||
var x = ([
|
||||
1,
|
||||
"hello"
|
||||
])[0]; // emit x: number
|
||||
var _b = [
|
||||
1,
|
||||
"hello"
|
||||
], x1 = _b[0], y1 = _b[1]; // emit x1: number, y1: string
|
||||
var _c = [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
], z1 = _c[2]; // emit z1: number
|
||||
var a = [
|
||||
1,
|
||||
"hello"
|
||||
];
|
||||
var x2 = a[0]; // emit x2: number | string
|
||||
var x3 = a[0], y3 = a[1], z3 = a[2]; // emit x3, y3, z3
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern1.d.ts]
|
||||
declare var x: number;
|
||||
declare var x1: number, y1: string;
|
||||
declare var z1: number;
|
||||
declare var a: (string | number)[];
|
||||
declare var x2: string | number;
|
||||
declare var x3: string | number, y3: string | number, z3: string | number;
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern1.ts ===
|
||||
|
||||
var [] = [1, "hello"]; // Dont emit anything
|
||||
>[1, "hello"] : (string | number)[]
|
||||
|
||||
var [x] = [1, "hello"]; // emit x: number
|
||||
>x : number
|
||||
>[1, "hello"] : [number, string]
|
||||
|
||||
var [x1, y1] = [1, "hello"]; // emit x1: number, y1: string
|
||||
>x1 : number
|
||||
>y1 : string
|
||||
>[1, "hello"] : [number, string]
|
||||
|
||||
var [, , z1] = [0, 1, 2]; // emit z1: number
|
||||
>z1 : number
|
||||
>[0, 1, 2] : [number, number, number]
|
||||
|
||||
var a = [1, "hello"];
|
||||
>a : (string | number)[]
|
||||
>[1, "hello"] : (string | number)[]
|
||||
|
||||
var [x2] = a; // emit x2: number | string
|
||||
>x2 : string | number
|
||||
>a : (string | number)[]
|
||||
|
||||
var [x3, y3, z3] = a; // emit x3, y3, z3
|
||||
>x3 : string | number
|
||||
>y3 : string | number
|
||||
>z3 : string | number
|
||||
>a : (string | number)[]
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
//// [declarationEmitDestructuringArrayPattern2.ts]
|
||||
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
|
||||
|
||||
var [x11 = 0, y11 = ""] = [1, "hello"];
|
||||
var [a11, b11, c11] = [];
|
||||
|
||||
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
|
||||
|
||||
var [x13, y13] = [1, "hello"];
|
||||
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern2.js]
|
||||
var _a = [
|
||||
1,
|
||||
[
|
||||
"hello",
|
||||
[
|
||||
true
|
||||
]
|
||||
]
|
||||
], x10 = _a[0], _b = _a[1], y10 = _b[0], z10 = _b[1][0];
|
||||
var _c = [
|
||||
1,
|
||||
"hello"
|
||||
], _d = _c[0], x11 = _d === void 0 ? 0 : _d, _e = _c[1], y11 = _e === void 0 ? "" : _e;
|
||||
var _f = [], a11 = _f[0], b11 = _f[1], c11 = _f[2];
|
||||
var _g = [
|
||||
1,
|
||||
[
|
||||
"hello",
|
||||
{
|
||||
x12: 5,
|
||||
y12: true
|
||||
}
|
||||
]
|
||||
], a2 = _g[0], _h = _g[1], _j = _h === void 0 ? [
|
||||
"abc",
|
||||
{
|
||||
x12: 10,
|
||||
y12: false
|
||||
}
|
||||
] : _h, b2 = _j[0], _k = _j[1], x12 = _k.x12, c2 = _k.y12;
|
||||
var _l = [
|
||||
1,
|
||||
"hello"
|
||||
], x13 = _l[0], y13 = _l[1];
|
||||
var _m = [
|
||||
[
|
||||
x13,
|
||||
y13
|
||||
],
|
||||
{
|
||||
x: x13,
|
||||
y: y13
|
||||
}
|
||||
], a3 = _m[0], b3 = _m[1];
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern2.d.ts]
|
||||
declare var x10: number, y10: string, z10: boolean;
|
||||
declare var x11: number, y11: string;
|
||||
declare var a11: any, b11: any, c11: any;
|
||||
declare var a2: number, b2: string, x12: number, c2: boolean;
|
||||
declare var x13: number, y13: string;
|
||||
declare var a3: (string | number)[], b3: {
|
||||
x: number;
|
||||
y: string;
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts ===
|
||||
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
|
||||
>x10 : number
|
||||
>y10 : string
|
||||
>z10 : boolean
|
||||
>[1, ["hello", [true]]] : [number, [string, [boolean]]]
|
||||
>["hello", [true]] : [string, [boolean]]
|
||||
>[true] : [boolean]
|
||||
|
||||
var [x11 = 0, y11 = ""] = [1, "hello"];
|
||||
>x11 : number
|
||||
>y11 : string
|
||||
>[1, "hello"] : [number, string]
|
||||
|
||||
var [a11, b11, c11] = [];
|
||||
>a11 : any
|
||||
>b11 : any
|
||||
>c11 : any
|
||||
>[] : undefined[]
|
||||
|
||||
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
|
||||
>a2 : number
|
||||
>b2 : string
|
||||
>x12 : number
|
||||
>y12 : unknown
|
||||
>c2 : boolean
|
||||
>["abc", { x12: 10, y12: false }] : [string, { x12: number; y12: boolean; }]
|
||||
>{ x12: 10, y12: false } : { x12: number; y12: boolean; }
|
||||
>x12 : number
|
||||
>y12 : boolean
|
||||
>[1, ["hello", { x12: 5, y12: true }]] : [number, [string, { x12: number; y12: boolean; }]]
|
||||
>["hello", { x12: 5, y12: true }] : [string, { x12: number; y12: boolean; }]
|
||||
>{ x12: 5, y12: true } : { x12: number; y12: boolean; }
|
||||
>x12 : number
|
||||
>y12 : boolean
|
||||
|
||||
var [x13, y13] = [1, "hello"];
|
||||
>x13 : number
|
||||
>y13 : string
|
||||
>[1, "hello"] : [number, string]
|
||||
|
||||
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
|
||||
>a3 : (string | number)[]
|
||||
>b3 : { x: number; y: string; }
|
||||
>[[x13, y13], { x: x13, y: y13 }] : [(string | number)[], { x: number; y: string; }]
|
||||
>[x13, y13] : (string | number)[]
|
||||
>x13 : number
|
||||
>y13 : string
|
||||
>{ x: x13, y: y13 } : { x: number; y: string; }
|
||||
>x : number
|
||||
>x13 : number
|
||||
>y : string
|
||||
>y13 : string
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//// [declarationEmitDestructuringArrayPattern3.ts]
|
||||
module M {
|
||||
export var [a, b] = [1, 2];
|
||||
}
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern3.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
_a = [
|
||||
1,
|
||||
2
|
||||
], M.a = _a[0], M.b = _a[1];
|
||||
var _a;
|
||||
})(M || (M = {}));
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern3.d.ts]
|
||||
declare module M {
|
||||
var a: number, b: number;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern3.ts ===
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
export var [a, b] = [1, 2];
|
||||
>a : number
|
||||
>b : number
|
||||
>[1, 2] : [number, number]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
//// [declarationEmitDestructuringArrayPattern4.ts]
|
||||
var [...a5] = [1, 2, 3];
|
||||
var [x14, ...a6] = [1, 2, 3];
|
||||
var [x15, y15, ...a7] = [1, 2, 3];
|
||||
var [x16, y16, z16, ...a8] = [1, 2, 3];
|
||||
|
||||
var [...a9] = [1, "hello", true];
|
||||
var [x17, ...a10] = [1, "hello", true];
|
||||
var [x18, y18, ...a12] = [1, "hello", true];
|
||||
var [x19, y19, z19, ...a13] = [1, "hello", true];
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern4.js]
|
||||
var _a = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
], a5 = _a.slice(0);
|
||||
var _b = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
], x14 = _b[0], a6 = _b.slice(1);
|
||||
var _c = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
], x15 = _c[0], y15 = _c[1], a7 = _c.slice(2);
|
||||
var _d = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
], x16 = _d[0], y16 = _d[1], z16 = _d[2], a8 = _d.slice(3);
|
||||
var _e = [
|
||||
1,
|
||||
"hello",
|
||||
true
|
||||
], a9 = _e.slice(0);
|
||||
var _f = [
|
||||
1,
|
||||
"hello",
|
||||
true
|
||||
], x17 = _f[0], a10 = _f.slice(1);
|
||||
var _g = [
|
||||
1,
|
||||
"hello",
|
||||
true
|
||||
], x18 = _g[0], y18 = _g[1], a12 = _g.slice(2);
|
||||
var _h = [
|
||||
1,
|
||||
"hello",
|
||||
true
|
||||
], x19 = _h[0], y19 = _h[1], z19 = _h[2], a13 = _h.slice(3);
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringArrayPattern4.d.ts]
|
||||
declare var a5: number[];
|
||||
declare var x14: number, a6: number[];
|
||||
declare var x15: number, y15: number, a7: number[];
|
||||
declare var x16: number, y16: number, z16: number, a8: number[];
|
||||
declare var a9: (string | number | boolean)[];
|
||||
declare var x17: string | number | boolean, a10: (string | number | boolean)[];
|
||||
declare var x18: string | number | boolean, y18: string | number | boolean, a12: (string | number | boolean)[];
|
||||
declare var x19: string | number | boolean, y19: string | number | boolean, z19: string | number | boolean, a13: (string | number | boolean)[];
|
||||
@@ -0,0 +1,45 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern4.ts ===
|
||||
var [...a5] = [1, 2, 3];
|
||||
>a5 : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
|
||||
var [x14, ...a6] = [1, 2, 3];
|
||||
>x14 : number
|
||||
>a6 : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
|
||||
var [x15, y15, ...a7] = [1, 2, 3];
|
||||
>x15 : number
|
||||
>y15 : number
|
||||
>a7 : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
|
||||
var [x16, y16, z16, ...a8] = [1, 2, 3];
|
||||
>x16 : number
|
||||
>y16 : number
|
||||
>z16 : number
|
||||
>a8 : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
|
||||
var [...a9] = [1, "hello", true];
|
||||
>a9 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
|
||||
var [x17, ...a10] = [1, "hello", true];
|
||||
>x17 : string | number | boolean
|
||||
>a10 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
|
||||
var [x18, y18, ...a12] = [1, "hello", true];
|
||||
>x18 : string | number | boolean
|
||||
>y18 : string | number | boolean
|
||||
>a12 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
|
||||
var [x19, y19, z19, ...a13] = [1, "hello", true];
|
||||
>x19 : string | number | boolean
|
||||
>y19 : string | number | boolean
|
||||
>z19 : string | number | boolean
|
||||
>a13 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern.ts]
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
|
||||
function f15() {
|
||||
var a4 = "hello";
|
||||
var b4 = 1;
|
||||
var c4 = true;
|
||||
return { a4, b4, c4 };
|
||||
}
|
||||
var { a4, b4, c4 } = f15();
|
||||
|
||||
module m {
|
||||
export var { a4, b4, c4 } = f15();
|
||||
}
|
||||
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern.js]
|
||||
var _a = {
|
||||
x: 5,
|
||||
y: "hello"
|
||||
};
|
||||
var x4 = ({
|
||||
x4: 5,
|
||||
y4: "hello"
|
||||
}).x4;
|
||||
var y5 = ({
|
||||
x5: 5,
|
||||
y5: "hello"
|
||||
}).y5;
|
||||
var _b = {
|
||||
x6: 5,
|
||||
y6: "hello"
|
||||
}, x6 = _b.x6, y6 = _b.y6;
|
||||
var a1 = ({
|
||||
x7: 5,
|
||||
y7: "hello"
|
||||
}).x7;
|
||||
var b1 = ({
|
||||
x8: 5,
|
||||
y8: "hello"
|
||||
}).y8;
|
||||
var _c = {
|
||||
x9: 5,
|
||||
y9: "hello"
|
||||
}, a2 = _c.x9, b2 = _c.y9;
|
||||
var _d = {
|
||||
a: 1,
|
||||
b: {
|
||||
a: "hello",
|
||||
b: {
|
||||
a: true
|
||||
}
|
||||
}
|
||||
}, x11 = _d.a, _e = _d.b, y11 = _e.a, z11 = _e.b.a;
|
||||
function f15() {
|
||||
var a4 = "hello";
|
||||
var b4 = 1;
|
||||
var c4 = true;
|
||||
return {
|
||||
a4: a4,
|
||||
b4: b4,
|
||||
c4: c4
|
||||
};
|
||||
}
|
||||
var _f = f15(), a4 = _f.a4, b4 = _f.b4, c4 = _f.c4;
|
||||
var m;
|
||||
(function (m) {
|
||||
_g = f15(), m.a4 = _g.a4, m.b4 = _g.b4, m.c4 = _g.c4;
|
||||
var _g;
|
||||
})(m || (m = {}));
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern.d.ts]
|
||||
declare var x4: number;
|
||||
declare var y5: string;
|
||||
declare var x6: number, y6: string;
|
||||
declare var a1: number;
|
||||
declare var b1: string;
|
||||
declare var a2: number, b2: string;
|
||||
declare var x11: number, y11: string, z11: boolean;
|
||||
declare function f15(): {
|
||||
a4: string;
|
||||
b4: number;
|
||||
c4: boolean;
|
||||
};
|
||||
declare var a4: string, b4: number, c4: boolean;
|
||||
declare module m {
|
||||
var a4: string, b4: number, c4: boolean;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts ===
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
>{ x: 5, y: "hello" } : { x: number; y: string; }
|
||||
>x : number
|
||||
>y : string
|
||||
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
>x4 : number
|
||||
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
|
||||
>x4 : number
|
||||
>y4 : string
|
||||
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
>y5 : string
|
||||
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
|
||||
>x5 : number
|
||||
>y5 : string
|
||||
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>x6 : number
|
||||
>y6 : string
|
||||
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
|
||||
>x6 : number
|
||||
>y6 : string
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : unknown
|
||||
>a1 : number
|
||||
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
|
||||
>x7 : number
|
||||
>y7 : string
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : unknown
|
||||
>b1 : string
|
||||
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
|
||||
>x8 : number
|
||||
>y8 : string
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : unknown
|
||||
>a2 : number
|
||||
>y9 : unknown
|
||||
>b2 : string
|
||||
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
|
||||
>x9 : number
|
||||
>y9 : string
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
>a : unknown
|
||||
>x11 : number
|
||||
>b : unknown
|
||||
>a : unknown
|
||||
>y11 : string
|
||||
>b : unknown
|
||||
>a : unknown
|
||||
>z11 : boolean
|
||||
>{ a: 1, b: { a: "hello", b: { a: true } } } : { a: number; b: { a: string; b: { a: boolean; }; }; }
|
||||
>a : number
|
||||
>b : { a: string; b: { a: boolean; }; }
|
||||
>{ a: "hello", b: { a: true } } : { a: string; b: { a: boolean; }; }
|
||||
>a : string
|
||||
>b : { a: boolean; }
|
||||
>{ a: true } : { a: boolean; }
|
||||
>a : boolean
|
||||
|
||||
function f15() {
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
|
||||
var a4 = "hello";
|
||||
>a4 : string
|
||||
|
||||
var b4 = 1;
|
||||
>b4 : number
|
||||
|
||||
var c4 = true;
|
||||
>c4 : boolean
|
||||
|
||||
return { a4, b4, c4 };
|
||||
>{ a4, b4, c4 } : { a4: string; b4: number; c4: boolean; }
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
}
|
||||
var { a4, b4, c4 } = f15();
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
>f15() : { a4: string; b4: number; c4: boolean; }
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
|
||||
module m {
|
||||
>m : typeof m
|
||||
|
||||
export var { a4, b4, c4 } = f15();
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
>f15() : { a4: string; b4: number; c4: boolean; }
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern1.ts]
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern1.js]
|
||||
var _a = {
|
||||
x: 5,
|
||||
y: "hello"
|
||||
};
|
||||
var x4 = ({
|
||||
x4: 5,
|
||||
y4: "hello"
|
||||
}).x4;
|
||||
var y5 = ({
|
||||
x5: 5,
|
||||
y5: "hello"
|
||||
}).y5;
|
||||
var _b = {
|
||||
x6: 5,
|
||||
y6: "hello"
|
||||
}, x6 = _b.x6, y6 = _b.y6;
|
||||
var a1 = ({
|
||||
x7: 5,
|
||||
y7: "hello"
|
||||
}).x7;
|
||||
var b1 = ({
|
||||
x8: 5,
|
||||
y8: "hello"
|
||||
}).y8;
|
||||
var _c = {
|
||||
x9: 5,
|
||||
y9: "hello"
|
||||
}, a2 = _c.x9, b2 = _c.y9;
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern1.d.ts]
|
||||
declare var x4: number;
|
||||
declare var y5: string;
|
||||
declare var x6: number, y6: string;
|
||||
declare var a1: number;
|
||||
declare var b1: string;
|
||||
declare var a2: number, b2: string;
|
||||
@@ -0,0 +1,49 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts ===
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
>{ x: 5, y: "hello" } : { x: number; y: string; }
|
||||
>x : number
|
||||
>y : string
|
||||
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
>x4 : number
|
||||
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
|
||||
>x4 : number
|
||||
>y4 : string
|
||||
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
>y5 : string
|
||||
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
|
||||
>x5 : number
|
||||
>y5 : string
|
||||
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>x6 : number
|
||||
>y6 : string
|
||||
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
|
||||
>x6 : number
|
||||
>y6 : string
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : unknown
|
||||
>a1 : number
|
||||
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
|
||||
>x7 : number
|
||||
>y7 : string
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : unknown
|
||||
>b1 : string
|
||||
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
|
||||
>x8 : number
|
||||
>y8 : string
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : unknown
|
||||
>a2 : number
|
||||
>y9 : unknown
|
||||
>b2 : string
|
||||
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
|
||||
>x9 : number
|
||||
>y9 : string
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern2.ts]
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
|
||||
function f15() {
|
||||
var a4 = "hello";
|
||||
var b4 = 1;
|
||||
var c4 = true;
|
||||
return { a4, b4, c4 };
|
||||
}
|
||||
var { a4, b4, c4 } = f15();
|
||||
|
||||
module m {
|
||||
export var { a4, b4, c4 } = f15();
|
||||
}
|
||||
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern2.js]
|
||||
var _a = {
|
||||
a: 1,
|
||||
b: {
|
||||
a: "hello",
|
||||
b: {
|
||||
a: true
|
||||
}
|
||||
}
|
||||
}, x11 = _a.a, _b = _a.b, y11 = _b.a, z11 = _b.b.a;
|
||||
function f15() {
|
||||
var a4 = "hello";
|
||||
var b4 = 1;
|
||||
var c4 = true;
|
||||
return {
|
||||
a4: a4,
|
||||
b4: b4,
|
||||
c4: c4
|
||||
};
|
||||
}
|
||||
var _c = f15(), a4 = _c.a4, b4 = _c.b4, c4 = _c.c4;
|
||||
var m;
|
||||
(function (m) {
|
||||
_d = f15(), m.a4 = _d.a4, m.b4 = _d.b4, m.c4 = _d.c4;
|
||||
var _d;
|
||||
})(m || (m = {}));
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringObjectLiteralPattern2.d.ts]
|
||||
declare var x11: number, y11: string, z11: boolean;
|
||||
declare function f15(): {
|
||||
a4: string;
|
||||
b4: number;
|
||||
c4: boolean;
|
||||
};
|
||||
declare var a4: string, b4: number, c4: boolean;
|
||||
declare module m {
|
||||
var a4: string, b4: number, c4: boolean;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern2.ts ===
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
>a : unknown
|
||||
>x11 : number
|
||||
>b : unknown
|
||||
>a : unknown
|
||||
>y11 : string
|
||||
>b : unknown
|
||||
>a : unknown
|
||||
>z11 : boolean
|
||||
>{ a: 1, b: { a: "hello", b: { a: true } } } : { a: number; b: { a: string; b: { a: boolean; }; }; }
|
||||
>a : number
|
||||
>b : { a: string; b: { a: boolean; }; }
|
||||
>{ a: "hello", b: { a: true } } : { a: string; b: { a: boolean; }; }
|
||||
>a : string
|
||||
>b : { a: boolean; }
|
||||
>{ a: true } : { a: boolean; }
|
||||
>a : boolean
|
||||
|
||||
function f15() {
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
|
||||
var a4 = "hello";
|
||||
>a4 : string
|
||||
|
||||
var b4 = 1;
|
||||
>b4 : number
|
||||
|
||||
var c4 = true;
|
||||
>c4 : boolean
|
||||
|
||||
return { a4, b4, c4 };
|
||||
>{ a4, b4, c4 } : { a4: string; b4: number; c4: boolean; }
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
}
|
||||
var { a4, b4, c4 } = f15();
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
>f15() : { a4: string; b4: number; c4: boolean; }
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
|
||||
module m {
|
||||
>m : typeof m
|
||||
|
||||
export var { a4, b4, c4 } = f15();
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
>f15() : { a4: string; b4: number; c4: boolean; }
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
//// [declarationEmitDestructuringOptionalBindingParametersInOverloads.ts]
|
||||
|
||||
function foo([x, y, z] ?: [string, number, boolean]);
|
||||
function foo(...rest: any[]) {
|
||||
}
|
||||
|
||||
function foo2( { x, y, z }?: { x: string; y: number; z: boolean });
|
||||
function foo2(...rest: any[]) {
|
||||
|
||||
}
|
||||
|
||||
//// [declarationEmitDestructuringOptionalBindingParametersInOverloads.js]
|
||||
function foo() {
|
||||
var rest = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
rest[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
function foo2() {
|
||||
var rest = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
rest[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringOptionalBindingParametersInOverloads.d.ts]
|
||||
declare function foo(_0?: [string, number, boolean]): any;
|
||||
declare function foo2(_0?: {
|
||||
x: string;
|
||||
y: number;
|
||||
z: boolean;
|
||||
}): any;
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringOptionalBindingParametersInOverloads.ts ===
|
||||
|
||||
function foo([x, y, z] ?: [string, number, boolean]);
|
||||
>foo : ([x, y, z]?: [string, number, boolean]) => any
|
||||
>x : string
|
||||
>y : number
|
||||
>z : boolean
|
||||
|
||||
function foo(...rest: any[]) {
|
||||
>foo : ([x, y, z]?: [string, number, boolean]) => any
|
||||
>rest : any[]
|
||||
}
|
||||
|
||||
function foo2( { x, y, z }?: { x: string; y: number; z: boolean });
|
||||
>foo2 : ({ x, y, z }?: { x: string; y: number; z: boolean; }) => any
|
||||
>x : string
|
||||
>y : number
|
||||
>z : boolean
|
||||
>x : string
|
||||
>y : number
|
||||
>z : boolean
|
||||
|
||||
function foo2(...rest: any[]) {
|
||||
>foo2 : ({ x, y, z }?: { x: string; y: number; z: boolean; }) => any
|
||||
>rest : any[]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
tests/cases/compiler/declarationEmitDestructuringParameterProperties.ts(2,17): error TS1187: A parameter property may not be a binding pattern.
|
||||
tests/cases/compiler/declarationEmitDestructuringParameterProperties.ts(8,17): error TS1187: A parameter property may not be a binding pattern.
|
||||
tests/cases/compiler/declarationEmitDestructuringParameterProperties.ts(14,17): error TS1187: A parameter property may not be a binding pattern.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuringParameterProperties.ts (3 errors) ====
|
||||
class C1 {
|
||||
constructor(public [x, y, z]: string[]) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1187: A parameter property may not be a binding pattern.
|
||||
}
|
||||
}
|
||||
|
||||
type TupleType1 =[string, number, boolean];
|
||||
class C2 {
|
||||
constructor(public [x, y, z]: TupleType1) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1187: A parameter property may not be a binding pattern.
|
||||
}
|
||||
}
|
||||
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
class C3 {
|
||||
constructor(public { x, y, z }: ObjType1) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1187: A parameter property may not be a binding pattern.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//// [declarationEmitDestructuringParameterProperties.ts]
|
||||
class C1 {
|
||||
constructor(public [x, y, z]: string[]) {
|
||||
}
|
||||
}
|
||||
|
||||
type TupleType1 =[string, number, boolean];
|
||||
class C2 {
|
||||
constructor(public [x, y, z]: TupleType1) {
|
||||
}
|
||||
}
|
||||
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
class C3 {
|
||||
constructor(public { x, y, z }: ObjType1) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [declarationEmitDestructuringParameterProperties.js]
|
||||
var C1 = (function () {
|
||||
function C1(_a) {
|
||||
var x = _a[0], y = _a[1], z = _a[2];
|
||||
this.[x, y, z] = [x, y, z];
|
||||
}
|
||||
return C1;
|
||||
})();
|
||||
var C2 = (function () {
|
||||
function C2(_a) {
|
||||
var x = _a[0], y = _a[1], z = _a[2];
|
||||
this.[x, y, z] = [x, y, z];
|
||||
}
|
||||
return C2;
|
||||
})();
|
||||
var C3 = (function () {
|
||||
function C3(_a) {
|
||||
var x = _a.x, y = _a.y, z = _a.z;
|
||||
this.{ x, y, z } = { x, y, z };
|
||||
}
|
||||
return C3;
|
||||
})();
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringParameterProperties.d.ts]
|
||||
declare class C1 {
|
||||
x: string, y: string, z: string;
|
||||
constructor(_0: string[]);
|
||||
}
|
||||
declare type TupleType1 = [string, number, boolean];
|
||||
declare class C2 {
|
||||
x: string, y: number, z: boolean;
|
||||
constructor(_0: TupleType1);
|
||||
}
|
||||
declare type ObjType1 = {
|
||||
x: number;
|
||||
y: string;
|
||||
z: boolean;
|
||||
};
|
||||
declare class C3 {
|
||||
x: number, y: string, z: boolean;
|
||||
constructor(_0: ObjType1);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/declarationEmitDestructuringPrivacyError.ts(4,20): error TS4025: Exported variable 'y' has or is using private name 'c'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuringPrivacyError.ts (1 errors) ====
|
||||
module m {
|
||||
class c {
|
||||
}
|
||||
export var [x, y, z] = [10, new c(), 30];
|
||||
~
|
||||
!!! error TS4025: Exported variable 'y' has or is using private name 'c'.
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [declarationEmitDestructuringPrivacyError.ts]
|
||||
module m {
|
||||
class c {
|
||||
}
|
||||
export var [x, y, z] = [10, new c(), 30];
|
||||
}
|
||||
|
||||
//// [declarationEmitDestructuringPrivacyError.js]
|
||||
var m;
|
||||
(function (m) {
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
})();
|
||||
_a = [
|
||||
10,
|
||||
new c(),
|
||||
30
|
||||
], m.x = _a[0], m.y = _a[1], m.z = _a[2];
|
||||
var _a;
|
||||
})(m || (m = {}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/declarationEmitDestructuringWithOptionalBindingParameters.ts(1,14): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
|
||||
tests/cases/compiler/declarationEmitDestructuringWithOptionalBindingParameters.ts(3,16): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuringWithOptionalBindingParameters.ts (2 errors) ====
|
||||
function foo([x,y,z]?: [string, number, boolean]) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
|
||||
}
|
||||
function foo1( { x, y, z }?: { x: string; y: number; z: boolean }) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
//// [declarationEmitDestructuringWithOptionalBindingParameters.ts]
|
||||
function foo([x,y,z]?: [string, number, boolean]) {
|
||||
}
|
||||
function foo1( { x, y, z }?: { x: string; y: number; z: boolean }) {
|
||||
}
|
||||
|
||||
//// [declarationEmitDestructuringWithOptionalBindingParameters.js]
|
||||
function foo(_a) {
|
||||
var x = _a[0], y = _a[1], z = _a[2];
|
||||
}
|
||||
function foo1(_a) {
|
||||
var x = _a.x, y = _a.y, z = _a.z;
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitDestructuringWithOptionalBindingParameters.d.ts]
|
||||
declare function foo(_0?: [string, number, boolean]): void;
|
||||
declare function foo1(_0?: {
|
||||
x: string;
|
||||
y: number;
|
||||
z: boolean;
|
||||
}): void;
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [declarationEmitImportInExportAssignmentModule.ts]
|
||||
|
||||
module m {
|
||||
export module c {
|
||||
export class c {
|
||||
}
|
||||
}
|
||||
import x = c;
|
||||
export var a: typeof x;
|
||||
}
|
||||
export = m;
|
||||
|
||||
//// [declarationEmitImportInExportAssignmentModule.js]
|
||||
var m;
|
||||
(function (m) {
|
||||
var c;
|
||||
(function (_c) {
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
})();
|
||||
_c.c = c;
|
||||
})(c = m.c || (m.c = {}));
|
||||
m.a;
|
||||
})(m || (m = {}));
|
||||
module.exports = m;
|
||||
|
||||
|
||||
//// [declarationEmitImportInExportAssignmentModule.d.ts]
|
||||
declare module m {
|
||||
module c {
|
||||
class c {
|
||||
}
|
||||
}
|
||||
import x = c;
|
||||
var a: typeof x;
|
||||
}
|
||||
export = m;
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/declarationEmitImportInExportAssignmentModule.ts ===
|
||||
|
||||
module m {
|
||||
>m : typeof m
|
||||
|
||||
export module c {
|
||||
>c : typeof x
|
||||
|
||||
export class c {
|
||||
>c : c
|
||||
}
|
||||
}
|
||||
import x = c;
|
||||
>x : typeof x
|
||||
>c : typeof x
|
||||
|
||||
export var a: typeof x;
|
||||
>a : typeof x
|
||||
>x : typeof x
|
||||
}
|
||||
export = m;
|
||||
>m : typeof m
|
||||
|
||||
@@ -17,6 +17,6 @@ module.exports = C;
|
||||
|
||||
|
||||
//// [es5ExportDefaultClassDeclaration.d.ts]
|
||||
export declare class C {
|
||||
export default class C {
|
||||
method(): void;
|
||||
}
|
||||
|
||||
@@ -17,36 +17,6 @@ module.exports = _default;
|
||||
|
||||
|
||||
//// [es5ExportDefaultClassDeclaration2.d.ts]
|
||||
export declare class {
|
||||
export default class {
|
||||
method(): void;
|
||||
}
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
tests/cases/compiler/es5ExportDefaultClassDeclaration2.d.ts(1,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/es5ExportDefaultClassDeclaration2.d.ts(1,8): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/compiler/es5ExportDefaultClassDeclaration2.d.ts(1,16): error TS1005: ';' expected.
|
||||
tests/cases/compiler/es5ExportDefaultClassDeclaration2.d.ts(2,5): error TS2304: Cannot find name 'method'.
|
||||
tests/cases/compiler/es5ExportDefaultClassDeclaration2.d.ts(2,13): error TS1005: ';' expected.
|
||||
tests/cases/compiler/es5ExportDefaultClassDeclaration2.d.ts(2,19): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es5ExportDefaultClassDeclaration2.d.ts (6 errors) ====
|
||||
export declare class {
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
method(): void;
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ module.exports = (1 + 2);
|
||||
|
||||
|
||||
//// [es5ExportDefaultExpression.d.ts]
|
||||
export default (1 + 2);
|
||||
export default : number;
|
||||
|
||||
@@ -10,4 +10,4 @@ module.exports = f;
|
||||
|
||||
|
||||
//// [es5ExportDefaultFunctionDeclaration.d.ts]
|
||||
export declare function f(): void;
|
||||
export default function f(): void;
|
||||
|
||||
@@ -10,17 +10,4 @@ module.exports = _default;
|
||||
|
||||
|
||||
//// [es5ExportDefaultFunctionDeclaration2.d.ts]
|
||||
export declare function (): void;
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
tests/cases/compiler/es5ExportDefaultFunctionDeclaration2.d.ts(1,25): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es5ExportDefaultFunctionDeclaration2.d.ts (1 errors) ====
|
||||
export declare function (): void;
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
|
||||
export default function (): void;
|
||||
|
||||
@@ -41,3 +41,4 @@ export declare var x: number;
|
||||
export declare module uninstantiated {
|
||||
}
|
||||
//// [client.d.ts]
|
||||
export * from "server";
|
||||
|
||||
@@ -45,3 +45,4 @@ export declare var x: number;
|
||||
export declare module uninstantiated {
|
||||
}
|
||||
//// [client.d.ts]
|
||||
export * from "server";
|
||||
|
||||
@@ -32,3 +32,18 @@ export { x };
|
||||
|
||||
|
||||
//// [es6ExportClause.d.ts]
|
||||
declare class c {
|
||||
}
|
||||
interface i {
|
||||
}
|
||||
declare module m {
|
||||
var x: number;
|
||||
}
|
||||
declare var x: number;
|
||||
declare module uninstantiated {
|
||||
}
|
||||
export { c };
|
||||
export { c as c2 };
|
||||
export { i, m as instantiatedModule };
|
||||
export { uninstantiated };
|
||||
export { x };
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//// [es6ExportClauseInEs5.ts]
|
||||
|
||||
class c {
|
||||
}
|
||||
interface i {
|
||||
}
|
||||
module m {
|
||||
export var x = 10;
|
||||
}
|
||||
var x = 10;
|
||||
module uninstantiated {
|
||||
}
|
||||
export { c };
|
||||
export { c as c2 };
|
||||
export { i, m as instantiatedModule };
|
||||
export { uninstantiated };
|
||||
export { x };
|
||||
|
||||
//// [es6ExportClauseInEs5.js]
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
})();
|
||||
exports.c = c;
|
||||
exports.c2 = c;
|
||||
var m;
|
||||
(function (m) {
|
||||
m.x = 10;
|
||||
})(m || (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]
|
||||
declare class c {
|
||||
}
|
||||
interface i {
|
||||
}
|
||||
declare module m {
|
||||
var x: number;
|
||||
}
|
||||
declare var x: number;
|
||||
declare module uninstantiated {
|
||||
}
|
||||
export { c };
|
||||
export { c as c2 };
|
||||
export { i, m as instantiatedModule };
|
||||
export { uninstantiated };
|
||||
export { x };
|
||||
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/es6ExportClauseInEs5.ts ===
|
||||
|
||||
class c {
|
||||
>c : c
|
||||
}
|
||||
interface i {
|
||||
>i : i
|
||||
}
|
||||
module m {
|
||||
>m : typeof m
|
||||
|
||||
export var x = 10;
|
||||
>x : number
|
||||
}
|
||||
var x = 10;
|
||||
>x : number
|
||||
|
||||
module uninstantiated {
|
||||
>uninstantiated : unknown
|
||||
}
|
||||
export { c };
|
||||
>c : typeof c
|
||||
|
||||
export { c as c2 };
|
||||
>c : typeof c
|
||||
>c2 : typeof c
|
||||
|
||||
export { i, m as instantiatedModule };
|
||||
>i : unknown
|
||||
>m : typeof m
|
||||
>instantiatedModule : typeof m
|
||||
|
||||
export { uninstantiated };
|
||||
>uninstantiated : unknown
|
||||
|
||||
export { x };
|
||||
>x : number
|
||||
|
||||
@@ -49,3 +49,8 @@ export declare var x: number;
|
||||
export declare module uninstantiated {
|
||||
}
|
||||
//// [client.d.ts]
|
||||
export { c } from "server";
|
||||
export { c as c2 } from "server";
|
||||
export { i, m as instantiatedModule } from "server";
|
||||
export { uninstantiated } from "server";
|
||||
export { x } from "server";
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
//// [tests/cases/compiler/es6ExportClauseWithoutModuleSpecifierInEs5.ts] ////
|
||||
|
||||
//// [server.ts]
|
||||
|
||||
export class c {
|
||||
}
|
||||
export interface i {
|
||||
}
|
||||
export module m {
|
||||
export var x = 10;
|
||||
}
|
||||
export var x = 10;
|
||||
export module uninstantiated {
|
||||
}
|
||||
|
||||
//// [client.ts]
|
||||
export { c } from "server";
|
||||
export { c as c2 } from "server";
|
||||
export { i, m as instantiatedModule } from "server";
|
||||
export { uninstantiated } from "server";
|
||||
export { x } from "server";
|
||||
|
||||
//// [server.js]
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
})();
|
||||
exports.c = c;
|
||||
var m;
|
||||
(function (m) {
|
||||
m.x = 10;
|
||||
})(m = exports.m || (exports.m = {}));
|
||||
exports.x = 10;
|
||||
//// [client.js]
|
||||
var _server = require("server");
|
||||
exports.c = _server.c;
|
||||
var _server_1 = require("server");
|
||||
exports.c2 = _server_1.c;
|
||||
var _server_2 = require("server");
|
||||
exports.i = _server_2.i;
|
||||
exports.instantiatedModule = _server_2.m;
|
||||
var _server_3 = require("server");
|
||||
exports.uninstantiated = _server_3.uninstantiated;
|
||||
var _server_4 = require("server");
|
||||
exports.x = _server_4.x;
|
||||
|
||||
|
||||
//// [server.d.ts]
|
||||
export declare class c {
|
||||
}
|
||||
export interface i {
|
||||
}
|
||||
export declare module m {
|
||||
var x: number;
|
||||
}
|
||||
export declare var x: number;
|
||||
export declare module uninstantiated {
|
||||
}
|
||||
//// [client.d.ts]
|
||||
export { c } from "server";
|
||||
export { c as c2 } from "server";
|
||||
export { i, m as instantiatedModule } from "server";
|
||||
export { uninstantiated } from "server";
|
||||
export { x } from "server";
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/compiler/server.ts ===
|
||||
|
||||
export class c {
|
||||
>c : c
|
||||
}
|
||||
export interface i {
|
||||
>i : i
|
||||
}
|
||||
export module m {
|
||||
>m : typeof m
|
||||
|
||||
export var x = 10;
|
||||
>x : number
|
||||
}
|
||||
export var x = 10;
|
||||
>x : number
|
||||
|
||||
export module uninstantiated {
|
||||
>uninstantiated : unknown
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/client.ts ===
|
||||
export { c } from "server";
|
||||
>c : typeof c
|
||||
|
||||
export { c as c2 } from "server";
|
||||
>c : typeof c
|
||||
>c2 : typeof c
|
||||
|
||||
export { i, m as instantiatedModule } from "server";
|
||||
>i : unknown
|
||||
>m : typeof instantiatedModule
|
||||
>instantiatedModule : typeof instantiatedModule
|
||||
|
||||
export { uninstantiated } from "server";
|
||||
>uninstantiated : unknown
|
||||
|
||||
export { x } from "server";
|
||||
>x : number
|
||||
|
||||
@@ -13,6 +13,6 @@ export default class C {
|
||||
|
||||
|
||||
//// [es6ExportDefaultClassDeclaration.d.ts]
|
||||
export declare class C {
|
||||
export default class C {
|
||||
method(): void;
|
||||
}
|
||||
|
||||
@@ -13,36 +13,6 @@ export default class {
|
||||
|
||||
|
||||
//// [es6ExportDefaultClassDeclaration2.d.ts]
|
||||
export declare class {
|
||||
export default class {
|
||||
method(): void;
|
||||
}
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
tests/cases/compiler/es6ExportDefaultClassDeclaration2.d.ts(1,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/es6ExportDefaultClassDeclaration2.d.ts(1,8): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/compiler/es6ExportDefaultClassDeclaration2.d.ts(1,16): error TS1005: ';' expected.
|
||||
tests/cases/compiler/es6ExportDefaultClassDeclaration2.d.ts(2,5): error TS2304: Cannot find name 'method'.
|
||||
tests/cases/compiler/es6ExportDefaultClassDeclaration2.d.ts(2,13): error TS1005: ';' expected.
|
||||
tests/cases/compiler/es6ExportDefaultClassDeclaration2.d.ts(2,19): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6ExportDefaultClassDeclaration2.d.ts (6 errors) ====
|
||||
export declare class {
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
method(): void;
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ export default (1 + 2);
|
||||
|
||||
|
||||
//// [es6ExportDefaultExpression.d.ts]
|
||||
export default (1 + 2);
|
||||
export default : number;
|
||||
|
||||
@@ -9,4 +9,4 @@ export default function f() {
|
||||
|
||||
|
||||
//// [es6ExportDefaultFunctionDeclaration.d.ts]
|
||||
export declare function f(): void;
|
||||
export default function f(): void;
|
||||
|
||||
@@ -9,17 +9,4 @@ export default function () {
|
||||
|
||||
|
||||
//// [es6ExportDefaultFunctionDeclaration2.d.ts]
|
||||
export declare function (): void;
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
tests/cases/compiler/es6ExportDefaultFunctionDeclaration2.d.ts(1,25): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6ExportDefaultFunctionDeclaration2.d.ts (1 errors) ====
|
||||
export declare function (): void;
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
|
||||
export default function (): void;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
tests/cases/compiler/es6ImportDefaultBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment.
|
||||
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 (0 errors) ====
|
||||
==== tests/cases/compiler/es6ImportDefaultBinding_0.ts (1 errors) ====
|
||||
|
||||
export var a = 10;
|
||||
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 (1 errors) ====
|
||||
==== tests/cases/compiler/es6ImportDefaultBinding_1.ts (0 errors) ====
|
||||
import defaultBinding from "es6ImportDefaultBinding_0";
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment.
|
||||
var x = defaultBinding;
|
||||
import defaultBinding2 from "es6ImportDefaultBinding_0"; // elide this import since defaultBinding2 is not used
|
||||
|
||||
@@ -2,17 +2,24 @@
|
||||
|
||||
//// [es6ImportDefaultBinding_0.ts]
|
||||
|
||||
export var a = 10;
|
||||
var a = 10;
|
||||
export = a;
|
||||
|
||||
//// [es6ImportDefaultBinding_1.ts]
|
||||
import defaultBinding from "es6ImportDefaultBinding_0";
|
||||
var x = defaultBinding;
|
||||
import defaultBinding2 from "es6ImportDefaultBinding_0"; // elide this import since defaultBinding2 is not used
|
||||
|
||||
|
||||
//// [es6ImportDefaultBinding_0.js]
|
||||
export var a = 10;
|
||||
var a = 10;
|
||||
export default a;
|
||||
//// [es6ImportDefaultBinding_1.js]
|
||||
import defaultBinding from "es6ImportDefaultBinding_0";
|
||||
var x = defaultBinding;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBinding_0.d.ts]
|
||||
export declare var a: number;
|
||||
declare var a: number;
|
||||
export = a;
|
||||
//// [es6ImportDefaultBinding_1.d.ts]
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
tests/cases/compiler/client.ts(2,12): error TS4025: Exported variable 'x' has or is using private name 'defaultBinding'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/server.ts (0 errors) ====
|
||||
|
||||
class c { }
|
||||
export = c;
|
||||
|
||||
==== tests/cases/compiler/client.ts (1 errors) ====
|
||||
import defaultBinding from "server";
|
||||
export var x = new defaultBinding();
|
||||
~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'defaultBinding'.
|
||||
import defaultBinding2 from "server"; // elide this import since defaultBinding2 is not used
|
||||
|
||||
@@ -27,3 +27,6 @@ exports.x = new defaultBinding();
|
||||
declare class c {
|
||||
}
|
||||
export = c;
|
||||
//// [client.d.ts]
|
||||
import defaultBinding from "server";
|
||||
export declare var x: defaultBinding;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/server.ts ===
|
||||
|
||||
class c { }
|
||||
>c : c
|
||||
|
||||
export = c;
|
||||
>c : c
|
||||
|
||||
=== tests/cases/compiler/client.ts ===
|
||||
import defaultBinding from "server";
|
||||
>defaultBinding : typeof defaultBinding
|
||||
|
||||
export var x = new defaultBinding();
|
||||
>x : defaultBinding
|
||||
>new defaultBinding() : defaultBinding
|
||||
>defaultBinding : typeof defaultBinding
|
||||
|
||||
import defaultBinding2 from "server"; // elide this import since defaultBinding2 is not used
|
||||
>defaultBinding2 : typeof defaultBinding
|
||||
|
||||
+23
-33
@@ -1,52 +1,42 @@
|
||||
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(1,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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(2,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(3,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(3,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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(4,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(5,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(5,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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(6,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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.
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts (0 errors) ====
|
||||
|
||||
export var a = 10;
|
||||
export var x = a;
|
||||
export var m = a;
|
||||
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (12 errors) ====
|
||||
import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (6 errors) ====
|
||||
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~
|
||||
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
var x1: number = m;
|
||||
|
||||
@@ -7,12 +7,18 @@ export var x = a;
|
||||
export var m = a;
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.ts]
|
||||
import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1: number = a;
|
||||
import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1: number = b;
|
||||
import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1: number = x;
|
||||
var x1: number = y;
|
||||
import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1: number = z;
|
||||
import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1: number = m;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_0.js]
|
||||
@@ -20,6 +26,17 @@ export var a = 10;
|
||||
export var x = a;
|
||||
export var m = a;
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js]
|
||||
import { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1 = a;
|
||||
import { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1 = b;
|
||||
import { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1 = x;
|
||||
var x1 = y;
|
||||
import { x as z } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1 = z;
|
||||
import { m } from "es6ImportDefaultBindingFollowedWithNamedImport_0";
|
||||
var x1 = m;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_0.d.ts]
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(3,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(5,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(7,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(7,30): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(9,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(11,27): error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'm'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.ts (0 errors) ====
|
||||
|
||||
var a = 10;
|
||||
export = a;
|
||||
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts (6 errors) ====
|
||||
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
var x: number = defaultBinding1;
|
||||
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'.
|
||||
var x: number = defaultBinding2;
|
||||
import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'.
|
||||
var x: number = defaultBinding3;
|
||||
import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'.
|
||||
var x: number = defaultBinding4;
|
||||
import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'.
|
||||
var x: number = defaultBinding5;
|
||||
import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'm'.
|
||||
var x: number = defaultBinding6;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.ts] ////
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.ts]
|
||||
|
||||
var a = 10;
|
||||
export = a;
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts]
|
||||
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
var x: number = defaultBinding1;
|
||||
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
var x: number = defaultBinding2;
|
||||
import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
var x: number = defaultBinding3;
|
||||
import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
var x: number = defaultBinding4;
|
||||
import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
var x: number = defaultBinding5;
|
||||
import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0";
|
||||
var x: number = defaultBinding6;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.js]
|
||||
var a = 10;
|
||||
module.exports = 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;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.d.ts]
|
||||
declare var a: number;
|
||||
export = a;
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.d.ts]
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers.
|
||||
tests/cases/compiler/client.ts(3,1): error TS1191: An import declaration cannot have modifiers.
|
||||
tests/cases/compiler/client.ts(3,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
tests/cases/compiler/client.ts(5,1): error TS1191: An import declaration cannot have modifiers.
|
||||
tests/cases/compiler/client.ts(5,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
tests/cases/compiler/client.ts(7,1): error TS1191: An import declaration cannot have modifiers.
|
||||
tests/cases/compiler/client.ts(7,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
tests/cases/compiler/client.ts(7,37): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers.
|
||||
tests/cases/compiler/client.ts(9,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers.
|
||||
tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/server.ts (0 errors) ====
|
||||
|
||||
var a = 10;
|
||||
export = a;
|
||||
|
||||
==== tests/cases/compiler/client.ts (12 errors) ====
|
||||
export import defaultBinding1, { } from "server";
|
||||
~~~~~~
|
||||
!!! error TS1191: An import declaration cannot have modifiers.
|
||||
export var x1: number = defaultBinding1;
|
||||
export import defaultBinding2, { a } from "server";
|
||||
~~~~~~
|
||||
!!! error TS1191: An import declaration cannot have modifiers.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
export var x1: number = defaultBinding2;
|
||||
export import defaultBinding3, { a as b } from "server";
|
||||
~~~~~~
|
||||
!!! error TS1191: An import declaration cannot have modifiers.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
export var x1: number = defaultBinding3;
|
||||
export import defaultBinding4, { x, a as y } from "server";
|
||||
~~~~~~
|
||||
!!! error TS1191: An import declaration cannot have modifiers.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
export var x1: number = defaultBinding4;
|
||||
export import defaultBinding5, { x as z, } from "server";
|
||||
~~~~~~
|
||||
!!! error TS1191: An import declaration cannot have modifiers.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
export var x1: number = defaultBinding5;
|
||||
export import defaultBinding6, { m, } from "server";
|
||||
~~~~~~
|
||||
!!! error TS1191: An import declaration cannot have modifiers.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'.
|
||||
export var x1: number = defaultBinding6;
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.ts] ////
|
||||
|
||||
//// [server.ts]
|
||||
|
||||
var a = 10;
|
||||
export = a;
|
||||
|
||||
//// [client.ts]
|
||||
export import defaultBinding1, { } from "server";
|
||||
export var x1: number = defaultBinding1;
|
||||
export import defaultBinding2, { a } from "server";
|
||||
export var x1: number = defaultBinding2;
|
||||
export import defaultBinding3, { a as b } from "server";
|
||||
export var x1: number = defaultBinding3;
|
||||
export import defaultBinding4, { x, a as y } from "server";
|
||||
export var x1: number = defaultBinding4;
|
||||
export import defaultBinding5, { x as z, } from "server";
|
||||
export var x1: number = defaultBinding5;
|
||||
export import defaultBinding6, { m, } from "server";
|
||||
export var x1: number = defaultBinding6;
|
||||
|
||||
|
||||
//// [server.js]
|
||||
var a = 10;
|
||||
module.exports = 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;
|
||||
|
||||
|
||||
//// [server.d.ts]
|
||||
declare var a: number;
|
||||
export = a;
|
||||
//// [client.d.ts]
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
+1
-19
@@ -1,15 +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(3,12): error TS4025: Exported variable 'x1' has or is using private name 'a'.
|
||||
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(5,12): error TS4025: Exported variable 'x2' has or is using private name 'b'.
|
||||
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(7,12): error TS4025: Exported variable 'x4' has or is using private name 'x'.
|
||||
tests/cases/compiler/client.ts(8,12): error TS4025: Exported variable 'x5' has or is using private name 'y'.
|
||||
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(10,12): error TS4025: Exported variable 'x3' has or is using private name 'z'.
|
||||
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(12,12): error TS4025: Exported variable 'x6' has or is using private name 'm'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/server.ts (0 errors) ====
|
||||
@@ -21,7 +15,7 @@ tests/cases/compiler/client.ts(12,12): error TS4025: Exported variable 'x6' has
|
||||
export class a12 { }
|
||||
export class x11 { }
|
||||
|
||||
==== tests/cases/compiler/client.ts (12 errors) ====
|
||||
==== 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.
|
||||
@@ -29,33 +23,21 @@ tests/cases/compiler/client.ts(12,12): error TS4025: Exported variable 'x6' has
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
|
||||
export var x1 = new a();
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x1' has or is using private name 'a'.
|
||||
import defaultBinding3, { a11 as b } from "server";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
|
||||
export var x2 = new b();
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x2' has or is using private name 'b'.
|
||||
import defaultBinding4, { x, a12 as y } from "server";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
|
||||
export var x4 = new x();
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x4' has or is using private name 'x'.
|
||||
export var x5 = new y();
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x5' has or is using private name 'y'.
|
||||
import defaultBinding5, { x11 as z, } from "server";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
|
||||
export var x3 = new z();
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x3' has or is using private name 'z'.
|
||||
import defaultBinding6, { m, } from "server";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
|
||||
export var x6 = new m();
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x6' has or is using private name 'm'.
|
||||
|
||||
@@ -88,3 +88,15 @@ export declare class a12 {
|
||||
}
|
||||
export declare class x11 {
|
||||
}
|
||||
//// [client.d.ts]
|
||||
import { a } from "server";
|
||||
export declare var x1: a;
|
||||
import { a11 as b } from "server";
|
||||
export declare var x2: b;
|
||||
import { x, a12 as y } from "server";
|
||||
export declare var x4: x;
|
||||
export declare var x5: y;
|
||||
import { x11 as z } from "server";
|
||||
export declare var x3: z;
|
||||
import { m } from "server";
|
||||
export declare var x6: m;
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
tests/cases/compiler/client.ts(3,27): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
tests/cases/compiler/client.ts(5,27): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
tests/cases/compiler/client.ts(7,27): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
tests/cases/compiler/client.ts(7,30): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
tests/cases/compiler/client.ts(9,27): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
tests/cases/compiler/client.ts(11,27): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/server.ts (0 errors) ====
|
||||
|
||||
class a { }
|
||||
export = a;
|
||||
|
||||
==== tests/cases/compiler/client.ts (6 errors) ====
|
||||
import defaultBinding1, { } from "server";
|
||||
export var x1 = new defaultBinding1();
|
||||
import defaultBinding2, { a } from "server";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
export var x2 = new defaultBinding2();
|
||||
import defaultBinding3, { a as b } from "server";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
export var x3 = new defaultBinding3();
|
||||
import defaultBinding4, { x, a as y } from "server";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
|
||||
export var x4 = new defaultBinding4();
|
||||
import defaultBinding5, { x as z, } from "server";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
|
||||
export var x5 = new defaultBinding5();
|
||||
import defaultBinding6, { m, } from "server";
|
||||
~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'.
|
||||
export var x6 = new defaultBinding6();
|
||||
@@ -0,0 +1,55 @@
|
||||
//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.ts] ////
|
||||
|
||||
//// [server.ts]
|
||||
|
||||
class a { }
|
||||
export = a;
|
||||
|
||||
//// [client.ts]
|
||||
import defaultBinding1, { } from "server";
|
||||
export var x1 = new defaultBinding1();
|
||||
import defaultBinding2, { a } from "server";
|
||||
export var x2 = new defaultBinding2();
|
||||
import defaultBinding3, { a as b } from "server";
|
||||
export var x3 = new defaultBinding3();
|
||||
import defaultBinding4, { x, a as y } from "server";
|
||||
export var x4 = new defaultBinding4();
|
||||
import defaultBinding5, { x as z, } from "server";
|
||||
export var x5 = new defaultBinding5();
|
||||
import defaultBinding6, { m, } from "server";
|
||||
export var x6 = new defaultBinding6();
|
||||
|
||||
//// [server.js]
|
||||
var a = (function () {
|
||||
function a() {
|
||||
}
|
||||
return a;
|
||||
})();
|
||||
module.exports = 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();
|
||||
|
||||
|
||||
//// [server.d.ts]
|
||||
declare class a {
|
||||
}
|
||||
export = a;
|
||||
//// [client.d.ts]
|
||||
import defaultBinding1 from "server";
|
||||
export declare var x1: defaultBinding1;
|
||||
export declare var x2: defaultBinding1;
|
||||
export declare var x3: defaultBinding1;
|
||||
export declare var x4: defaultBinding1;
|
||||
export declare var x5: defaultBinding1;
|
||||
export declare var x6: defaultBinding1;
|
||||
+22
-33
@@ -1,15 +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(1,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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(2,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(3,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(3,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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(4,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(5,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
|
||||
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(5,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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(6,8): error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
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_0.ts (0 errors) ====
|
||||
@@ -18,34 +12,29 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,
|
||||
export var x = a;
|
||||
export var m = a;
|
||||
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts (12 errors) ====
|
||||
import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
==== 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 TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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 TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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 TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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 TS2300: Duplicate identifier 'defaultBinding'.
|
||||
import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
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 TS2300: Duplicate identifier 'defaultBinding'.
|
||||
var x1: number = m;
|
||||
|
||||
@@ -7,15 +7,40 @@ export var x = a;
|
||||
export var m = a;
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts]
|
||||
import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
var x1: number = a;
|
||||
import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
var x1: number = b;
|
||||
import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
var x1: number = x;
|
||||
var x1: number = y;
|
||||
import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
var x1: number = z;
|
||||
import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
|
||||
var x1: number = m;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.js]
|
||||
exports.a = 10;
|
||||
exports.x = exports.a;
|
||||
exports.m = exports.a;
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.js]
|
||||
var _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0");
|
||||
var x1 = _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1.a;
|
||||
var _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0");
|
||||
var x1 = _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2.a;
|
||||
var _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0");
|
||||
var x1 = _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3.x;
|
||||
var x1 = _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3.a;
|
||||
var _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0");
|
||||
var x1 = _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4.x;
|
||||
var _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0");
|
||||
var x1 = _es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5.m;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.d.ts]
|
||||
export declare var a: number;
|
||||
export declare var x: number;
|
||||
export declare var m: number;
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.d.ts]
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
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) ====
|
||||
|
||||
export var a = 10;
|
||||
export var x = a;
|
||||
export var m = a;
|
||||
|
||||
==== tests/cases/compiler/client.ts (12 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;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportWithExport.ts] ////
|
||||
|
||||
//// [server.ts]
|
||||
|
||||
export var a = 10;
|
||||
export var x = a;
|
||||
export var m = a;
|
||||
|
||||
//// [client.ts]
|
||||
export import defaultBinding1, { } from "server";
|
||||
export import defaultBinding2, { a } from "server";
|
||||
export var x1: number = a;
|
||||
export import defaultBinding3, { a as b } from "server";
|
||||
export var x1: number = b;
|
||||
export import defaultBinding4, { x, a as y } from "server";
|
||||
export var x1: number = x;
|
||||
export var x1: number = y;
|
||||
export import defaultBinding5, { x as z, } from "server";
|
||||
export var x1: number = z;
|
||||
export import defaultBinding6, { m, } from "server";
|
||||
export var x1: number = m;
|
||||
|
||||
|
||||
//// [server.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.a = 10;
|
||||
exports.x = exports.a;
|
||||
exports.m = exports.a;
|
||||
});
|
||||
//// [client.js]
|
||||
define(["require", "exports", "server", "server", "server", "server", "server"], function (require, exports, _server_1, _server_2, _server_3, _server_4, _server_5) {
|
||||
exports.x1 = _server_1.a;
|
||||
exports.x1 = _server_2.a;
|
||||
exports.x1 = _server_3.x;
|
||||
exports.x1 = _server_3.a;
|
||||
exports.x1 = _server_4.x;
|
||||
exports.x1 = _server_5.m;
|
||||
});
|
||||
|
||||
|
||||
//// [server.d.ts]
|
||||
export declare var a: number;
|
||||
export declare var x: number;
|
||||
export declare var m: number;
|
||||
//// [client.d.ts]
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers.
|
||||
|
||||
|
||||
==== tests/cases/compiler/server.ts (0 errors) ====
|
||||
|
||||
var a = 10;
|
||||
export = a;
|
||||
|
||||
==== tests/cases/compiler/client.ts (1 errors) ====
|
||||
export import defaultBinding, * as nameSpaceBinding from "server";
|
||||
~~~~~~
|
||||
!!! error TS1191: An import declaration cannot have modifiers.
|
||||
export var x: number = defaultBinding;
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1WithExport.ts] ////
|
||||
|
||||
//// [server.ts]
|
||||
|
||||
var a = 10;
|
||||
export = a;
|
||||
|
||||
//// [client.ts]
|
||||
export import defaultBinding, * as nameSpaceBinding from "server";
|
||||
export var x: number = defaultBinding;
|
||||
|
||||
//// [server.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
var a = 10;
|
||||
return a;
|
||||
});
|
||||
//// [client.js]
|
||||
define(["require", "exports", "server"], function (require, exports, defaultBinding) {
|
||||
exports.x = defaultBinding;
|
||||
});
|
||||
|
||||
|
||||
//// [server.d.ts]
|
||||
declare var a: number;
|
||||
export = a;
|
||||
//// [client.d.ts]
|
||||
export declare var x: number;
|
||||
+2
-5
@@ -1,15 +1,12 @@
|
||||
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,12): error TS4025: Exported variable 'x' has or is using private name 'nameSpaceBinding.a'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/server.ts (0 errors) ====
|
||||
|
||||
export class a { }
|
||||
|
||||
==== tests/cases/compiler/client.ts (2 errors) ====
|
||||
==== tests/cases/compiler/client.ts (1 errors) ====
|
||||
import defaultBinding, * as nameSpaceBinding from "server";
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export or export assignment.
|
||||
export var x = new nameSpaceBinding.a();
|
||||
~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'nameSpaceBinding.a'.
|
||||
export var x = new nameSpaceBinding.a();
|
||||
@@ -23,3 +23,6 @@ exports.x = new nameSpaceBinding.a();
|
||||
//// [server.d.ts]
|
||||
export declare class a {
|
||||
}
|
||||
//// [client.d.ts]
|
||||
import * as nameSpaceBinding from "server";
|
||||
export declare var x: nameSpaceBinding.a;
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
tests/cases/compiler/client.ts(2,12): error TS4025: Exported variable 'x' has or is using private name 'defaultBinding'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/server.ts (0 errors) ====
|
||||
|
||||
class a { }
|
||||
export = a;
|
||||
|
||||
==== tests/cases/compiler/client.ts (1 errors) ====
|
||||
import defaultBinding, * as nameSpaceBinding from "server";
|
||||
export var x = new defaultBinding();
|
||||
~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'defaultBinding'.
|
||||
@@ -28,3 +28,6 @@ define(["require", "exports", "server"], function (require, exports, defaultBind
|
||||
declare class a {
|
||||
}
|
||||
export = a;
|
||||
//// [client.d.ts]
|
||||
import defaultBinding from "server";
|
||||
export declare var x: defaultBinding;
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/server.ts ===
|
||||
|
||||
class a { }
|
||||
>a : a
|
||||
|
||||
export = a;
|
||||
>a : a
|
||||
|
||||
=== tests/cases/compiler/client.ts ===
|
||||
import defaultBinding, * as nameSpaceBinding from "server";
|
||||
>defaultBinding : typeof defaultBinding
|
||||
>nameSpaceBinding : typeof nameSpaceBinding
|
||||
|
||||
export var x = new defaultBinding();
|
||||
>x : defaultBinding
|
||||
>new defaultBinding() : defaultBinding
|
||||
>defaultBinding : typeof defaultBinding
|
||||
|
||||
+2
-1
@@ -8,4 +8,5 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts (1 errors) ====
|
||||
import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment.
|
||||
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment.
|
||||
var x: number = nameSpaceBinding.a;
|
||||
+9
-1
@@ -5,8 +5,16 @@
|
||||
export var a = 10;
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts]
|
||||
import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0";
|
||||
import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0";
|
||||
var x: number = nameSpaceBinding.a;
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.js]
|
||||
exports.a = 10;
|
||||
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.js]
|
||||
var nameSpaceBinding = require("es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0");
|
||||
var x = nameSpaceBinding.a;
|
||||
|
||||
|
||||
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.d.ts]
|
||||
export declare var a: number;
|
||||
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.d.ts]
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
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/server.ts (0 errors) ====
|
||||
|
||||
export var a = 10;
|
||||
|
||||
==== tests/cases/compiler/client.ts (2 errors) ====
|
||||
export import defaultBinding, * as nameSpaceBinding 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 x: number = nameSpaceBinding.a;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.ts] ////
|
||||
|
||||
//// [server.ts]
|
||||
|
||||
export var a = 10;
|
||||
|
||||
//// [client.ts]
|
||||
export import defaultBinding, * as nameSpaceBinding from "server";
|
||||
export var x: number = nameSpaceBinding.a;
|
||||
|
||||
//// [server.js]
|
||||
exports.a = 10;
|
||||
//// [client.js]
|
||||
var nameSpaceBinding = require("server");
|
||||
exports.x = nameSpaceBinding.a;
|
||||
|
||||
|
||||
//// [server.d.ts]
|
||||
export declare var a: number;
|
||||
//// [client.d.ts]
|
||||
export declare var x: number;
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingInEs5_0.ts (0 errors) ====
|
||||
|
||||
export var a = 10;
|
||||
|
||||
==== tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts (1 errors) ====
|
||||
import defaultBinding from "es6ImportDefaultBindingInEs5_0";
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user