This commit is contained in:
Paul van Brenk
2015-04-23 12:58:27 -07:00
81 changed files with 2133 additions and 120 deletions
+31 -49
View File
@@ -2516,10 +2516,11 @@ module ts {
}
}
function getDeclaredTypeOfClass(symbol: Symbol): InterfaceType {
function getDeclaredTypeOfClassOrInterface(symbol: Symbol): InterfaceType {
let links = getSymbolLinks(symbol);
if (!links.declaredType) {
let type = links.declaredType = <InterfaceType>createObjectType(TypeFlags.Class, symbol);
let kind = symbol.flags & SymbolFlags.Class ? TypeFlags.Class : TypeFlags.Interface;
let type = links.declaredType = <InterfaceType>createObjectType(kind, symbol);
let typeParameters = getTypeParametersOfClassOrInterface(symbol);
if (typeParameters) {
type.flags |= TypeFlags.Reference;
@@ -2529,35 +2530,6 @@ module ts {
(<GenericType>type).target = <GenericType>type;
(<GenericType>type).typeArguments = type.typeParameters;
}
type.declaredProperties = getNamedMembers(symbol.members);
type.declaredCallSignatures = emptyArray;
type.declaredConstructSignatures = emptyArray;
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
}
return <InterfaceType>links.declaredType;
}
function getDeclaredTypeOfInterface(symbol: Symbol): InterfaceType {
let links = getSymbolLinks(symbol);
if (!links.declaredType) {
let type = links.declaredType = <InterfaceType>createObjectType(TypeFlags.Interface, symbol);
let typeParameters = getTypeParametersOfClassOrInterface(symbol);
if (typeParameters) {
type.flags |= TypeFlags.Reference;
type.typeParameters = typeParameters;
(<GenericType>type).instantiations = {};
(<GenericType>type).instantiations[getTypeListId(type.typeParameters)] = <GenericType>type;
(<GenericType>type).target = <GenericType>type;
(<GenericType>type).typeArguments = type.typeParameters;
}
type.declaredProperties = getNamedMembers(symbol.members);
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
}
return <InterfaceType>links.declaredType;
}
@@ -2613,11 +2585,8 @@ module ts {
function getDeclaredTypeOfSymbol(symbol: Symbol): Type {
Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0);
if (symbol.flags & SymbolFlags.Class) {
return getDeclaredTypeOfClass(symbol);
}
if (symbol.flags & SymbolFlags.Interface) {
return getDeclaredTypeOfInterface(symbol);
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
return getDeclaredTypeOfClassOrInterface(symbol);
}
if (symbol.flags & SymbolFlags.TypeAlias) {
return getDeclaredTypeOfTypeAlias(symbol);
@@ -2666,15 +2635,28 @@ module ts {
}
}
function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers {
if (!(<InterfaceTypeWithDeclaredMembers>type).declaredProperties) {
var symbol = type.symbol;
(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(symbol.members);
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
(<InterfaceTypeWithDeclaredMembers>type).declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
(<InterfaceTypeWithDeclaredMembers>type).declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
}
return <InterfaceTypeWithDeclaredMembers>type;
}
function resolveClassOrInterfaceMembers(type: InterfaceType): void {
let members = type.symbol.members;
let callSignatures = type.declaredCallSignatures;
let constructSignatures = type.declaredConstructSignatures;
let stringIndexType = type.declaredStringIndexType;
let numberIndexType = type.declaredNumberIndexType;
let baseTypes = getBaseTypes(type);
let target = resolveDeclaredMembers(type);
let members = target.symbol.members;
let callSignatures = target.declaredCallSignatures;
let constructSignatures = target.declaredConstructSignatures;
let stringIndexType = target.declaredStringIndexType;
let numberIndexType = target.declaredNumberIndexType;
let baseTypes = getBaseTypes(target);
if (baseTypes.length) {
members = createSymbolTable(type.declaredProperties);
members = createSymbolTable(target.declaredProperties);
for (let baseType of baseTypes) {
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call));
@@ -2687,7 +2669,7 @@ module ts {
}
function resolveTypeReferenceMembers(type: TypeReference): void {
let target = type.target;
let target = resolveDeclaredMembers(type.target);
let mapper = createTypeMapper(target.typeParameters, type.typeArguments);
let members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
@@ -2843,7 +2825,7 @@ module ts {
callSignatures = getSignaturesOfSymbol(symbol);
}
if (symbol.flags & SymbolFlags.Class) {
let classType = getDeclaredTypeOfClass(symbol);
let classType = getDeclaredTypeOfClassOrInterface(symbol);
constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]);
if (!constructSignatures.length) {
constructSignatures = getDefaultConstructSignatures(classType);
@@ -2956,7 +2938,7 @@ module ts {
let type = getApparentType(current);
if (type !== unknownType) {
let prop = getPropertyOfType(type, name);
if (!prop) {
if (!prop || getDeclarationFlagsFromSymbol(prop) & (NodeFlags.Private | NodeFlags.Protected)) {
return undefined;
}
if (!props) {
@@ -3084,7 +3066,7 @@ module ts {
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
let links = getNodeLinks(declaration);
if (!links.resolvedSignature) {
let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClass((<ClassDeclaration>declaration.parent).symbol) : undefined;
let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClassOrInterface((<ClassDeclaration>declaration.parent).symbol) : undefined;
let typeParameters = classType ? classType.typeParameters :
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
let parameters: Symbol[] = [];
@@ -9367,7 +9349,7 @@ module ts {
}
if (node.condition) checkExpression(node.condition);
if (node.iterator) checkExpression(node.iterator);
if (node.incrementor) checkExpression(node.incrementor);
checkSourceElement(node.statement);
}
@@ -10152,7 +10134,7 @@ module ts {
}
let seen: Map<{ prop: Symbol; containingType: Type }> = {};
forEach(type.declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; });
forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; });
let ok = true;
for (let base of baseTypes) {
+5 -4
View File
@@ -50,11 +50,12 @@ module ts {
shortName: "m",
type: {
"commonjs": ModuleKind.CommonJS,
"amd": ModuleKind.AMD
"amd": ModuleKind.AMD,
"umd": ModuleKind.UMD
},
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd,
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd,
paramType: Diagnostics.KIND,
error: Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd
},
{
name: "noEmit",
@@ -150,7 +151,7 @@ module ts {
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES6 },
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
paramType: Diagnostics.VERSION,
error: Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
},
{
name: "version",
@@ -161,7 +161,7 @@ module ts {
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." },
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
@@ -463,7 +463,7 @@ module ts {
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." },
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." },
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." },
@@ -484,8 +484,8 @@ module ts {
Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." },
Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." },
Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." },
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
+4 -4
View File
@@ -631,7 +631,7 @@
"category": "Error",
"code": 1203
},
"Cannot compile external modules into amd or commonjs when targeting es6 or higher.": {
"Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.": {
"category": "Error",
"code": 1204
},
@@ -1840,7 +1840,7 @@
"category": "Message",
"code": 6015
},
"Specify module code generation: 'commonjs' or 'amd'": {
"Specify module code generation: 'commonjs', 'amd', or 'umd'.": {
"category": "Message",
"code": 6016
},
@@ -1924,11 +1924,11 @@
"category": "Error",
"code": 6045
},
"Argument for '--module' option must be 'commonjs' or 'amd'.": {
"Argument for '--module' option must be 'commonjs', 'amd', or 'umd'.": {
"category": "Error",
"code": 6046
},
"Argument for '--target' option must be 'es3', 'es5', or 'es6'.": {
"Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'.": {
"category": "Error",
"code": 6047
},
+51 -19
View File
@@ -2138,7 +2138,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
write(";");
emitOptional(" ", node.condition);
write(";");
emitOptional(" ", node.iterator);
emitOptional(" ", node.incrementor);
write(")");
emitEmbeddedStatement(node.statement);
}
@@ -4645,27 +4645,25 @@ var __param = this.__param || function(index, decorator) { return function (targ
}
}
function emitAMDModule(node: SourceFile, startIndex: number) {
collectExternalModuleInfo(node);
function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean) {
// An AMD define function has the following shape:
// define(id?, dependencies?, factory);
//
// This has the shape of
// define(name, ["module1", "module2"], function (module1Alias) {
// The location of the alias in the parameter list in the factory function needs to
// The location of the alias in the parameter list in the factory function needs to
// match the position of the module name in the dependency list.
//
// To ensure this is true in cases of modules with no aliases, e.g.:
// `import "module"` or `<amd-dependency path= "a.css" />`
// To ensure this is true in cases of modules with no aliases, e.g.:
// `import "module"` or `<amd-dependency path= "a.css" />`
// we need to add modules without alias names to the end of the dependencies list
let aliasedModuleNames: string[] = []; // names of modules with corresponding parameter in the
let aliasedModuleNames: string[] = []; // names of modules with corresponding parameter in the
// factory function.
let unaliasedModuleNames: string[] = []; // names of modules with no corresponding parameters in
// factory function.
let importAliasNames: string[] = []; // names of the parameters in the factory function; these
// paramters need to match the indexes of the corresponding
let importAliasNames: string[] = []; // names of the parameters in the factory function; these
// parameters need to match the indexes of the corresponding
// module names in aliasedModuleNames.
// Fill in amd-dependency tags
@@ -4687,7 +4685,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
externalModuleName = getLiteralText(<LiteralExpression>moduleName);
}
// Find the name of the module alais, if there is one
// Find the name of the module alias, if there is one
let importAliasName: string;
let namespaceDeclaration = getNamespaceDeclarationNode(importNode);
if (namespaceDeclaration && !isDefaultImport(importNode)) {
@@ -4697,7 +4695,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
importAliasName = getGeneratedNameForNode(<ImportDeclaration | ExportDeclaration>importNode);
}
if (importAliasName) {
if (includeNonAmdDependencies && importAliasName) {
aliasedModuleNames.push(externalModuleName);
importAliasNames.push(importAliasName);
}
@@ -4705,12 +4703,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
unaliasedModuleNames.push(externalModuleName);
}
}
writeLine();
write("define(");
if (node.amdModuleName) {
write("\"" + node.amdModuleName + "\", ");
}
write("[\"require\", \"exports\"");
if (aliasedModuleNames.length) {
write(", ");
@@ -4725,6 +4718,17 @@ var __param = this.__param || function(index, decorator) { return function (targ
write(", ");
write(importAliasNames.join(", "));
}
}
function emitAMDModule(node: SourceFile, startIndex: number) {
collectExternalModuleInfo(node);
writeLine();
write("define(");
if (node.amdModuleName) {
write("\"" + node.amdModuleName + "\", ");
}
emitAMDDependencies(node, /*includeNonAmdDependencies*/ true);
write(") {");
increaseIndent();
emitExportStarHelper();
@@ -4746,6 +4750,31 @@ var __param = this.__param || function(index, decorator) { return function (targ
emitExportEquals(/*emitAsReturn*/ false);
}
function emitUMDModule(node: SourceFile, startIndex: number) {
collectExternalModuleInfo(node);
// Module is detected first to support Browserify users that load into a browser with an AMD loader
writeLines(`(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
})(`);
emitAMDDependencies(node, false);
write(") {");
increaseIndent();
emitExportStarHelper();
emitCaptureThisForNodeIfNecessary(node);
emitLinesStartingAt(node.statements, startIndex);
emitTempDeclarations(/*newLine*/ true);
emitExportEquals(/*emitAsReturn*/ true);
decreaseIndent();
writeLine();
write("});");
}
function emitES6Module(node: SourceFile, startIndex: number) {
externalImports = undefined;
exportSpecifiers = undefined;
@@ -4830,6 +4859,9 @@ var __param = this.__param || function(index, decorator) { return function (targ
else if (compilerOptions.module === ModuleKind.AMD) {
emitAMDModule(node, startIndex);
}
else if (compilerOptions.module === ModuleKind.UMD) {
emitUMDModule(node, startIndex);
}
else {
emitCommonJSModule(node, startIndex);
}
+2 -2
View File
@@ -194,7 +194,7 @@ module ts {
case SyntaxKind.ForStatement:
return visitNode(cbNode, (<ForStatement>node).initializer) ||
visitNode(cbNode, (<ForStatement>node).condition) ||
visitNode(cbNode, (<ForStatement>node).iterator) ||
visitNode(cbNode, (<ForStatement>node).incrementor) ||
visitNode(cbNode, (<ForStatement>node).statement);
case SyntaxKind.ForInStatement:
return visitNode(cbNode, (<ForInStatement>node).initializer) ||
@@ -3497,7 +3497,7 @@ module ts {
}
parseExpected(SyntaxKind.SemicolonToken);
if (token !== SyntaxKind.CloseParenToken) {
forStatement.iterator = allowInAnd(parseExpression);
forStatement.incrementor = allowInAnd(parseExpression);
}
parseExpected(SyntaxKind.CloseParenToken);
forOrForInOrForOfStatement = forStatement;
+1 -1
View File
@@ -567,7 +567,7 @@ module ts {
// Cannot specify module gen target when in es6 or above
if (options.module && languageVersion >= ScriptTarget.ES6) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher));
}
// there has to be common source directory if user specified --outdir || --sourceRoot
+9 -5
View File
@@ -795,7 +795,7 @@ module ts {
export interface ForStatement extends IterationStatement {
initializer?: VariableDeclarationList | Expression;
condition?: Expression;
iterator?: Expression;
incrementor?: Expression;
}
export interface ForInStatement extends IterationStatement {
@@ -1489,6 +1489,13 @@ module ts {
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
export interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
}
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
baseTypes: ObjectType[];
}
export interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
declaredProperties: Symbol[]; // Declared members
declaredCallSignatures: Signature[]; // Declared call signatures
declaredConstructSignatures: Signature[]; // Declared construct signatures
@@ -1496,10 +1503,6 @@ module ts {
declaredNumberIndexType: Type; // Declared numeric index type
}
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
baseTypes: ObjectType[];
}
// Type references (TypeFlags.Reference)
export interface TypeReference extends ObjectType {
target: GenericType; // Type reference target
@@ -1675,6 +1678,7 @@ module ts {
None = 0,
CommonJS = 1,
AMD = 2,
UMD = 3,
}
export interface LineAndCharacter {
+1 -1
View File
@@ -775,7 +775,7 @@ module ts {
let forStatement = <ForStatement>parent;
return (forStatement.initializer === node && forStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) ||
forStatement.condition === node ||
forStatement.iterator === node;
forStatement.incrementor === node;
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
let forInStatement = <ForInStatement | ForOfStatement>parent;
+2
View File
@@ -957,6 +957,8 @@ module Harness {
if (typeof setting.value === 'string') {
if (setting.value.toLowerCase() === 'amd') {
options.module = ts.ModuleKind.AMD;
} else if (setting.value.toLowerCase() === 'umd') {
options.module = ts.ModuleKind.UMD;
} else if (setting.value.toLowerCase() === 'commonjs') {
options.module = ts.ModuleKind.CommonJS;
} else if (setting.value.toLowerCase() === 'unspecified') {
+1 -1
View File
@@ -546,7 +546,7 @@ interface Math {
*/
atan(x: number): number;
/**
* Returns the angle (in radians) from the X axis to a point (y,x).
* Returns the angle (in radians) from the X axis to a point.
* @param y A numeric expression representing the cartesian y-coordinate.
* @param x A numeric expression representing the cartesian x-coordinate.
*/
+1 -1
View File
@@ -442,7 +442,7 @@ interface IteratorResult<T> {
}
interface Iterator<T> {
next(): IteratorResult<T>;
next(value?: any): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}
+2 -2
View File
@@ -401,8 +401,8 @@ module ts.BreakpointResolver {
if (forStatement.condition) {
return textSpan(forStatement.condition);
}
if (forStatement.iterator) {
return textSpan(forStatement.iterator);
if (forStatement.incrementor) {
return textSpan(forStatement.incrementor);
}
}
+5 -3
View File
@@ -458,7 +458,11 @@ module ts.formatting {
case SyntaxKind.BinaryExpression:
case SyntaxKind.ConditionalExpression:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
case SyntaxKind.BindingElement:
// equals in type X = ...
case SyntaxKind.TypeAliasDeclaration:
// equal in import a = module('a');
case SyntaxKind.ImportEqualsDeclaration:
// equal in let a = 0;
@@ -475,8 +479,6 @@ module ts.formatting {
// Technically, "of" is not a binary operator, but format it the same way as "in"
case SyntaxKind.ForOfStatement:
return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword;
case SyntaxKind.BindingElement:
return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken;
}
return false;
}
@@ -0,0 +1,39 @@
//// [circularTypeAliasForUnionWithClass.ts]
var v0: T0;
type T0 = string | I0;
class I0 {
x: T0;
}
var v3: T3;
type T3 = string | I3;
class I3 {
[x: number]: T3;
}
var v4: T4;
type T4 = string | I4;
class I4 {
[x: string]: T4;
}
//// [circularTypeAliasForUnionWithClass.js]
var v0;
var I0 = (function () {
function I0() {
}
return I0;
})();
var v3;
var I3 = (function () {
function I3() {
}
return I3;
})();
var v4;
var I4 = (function () {
function I4() {
}
return I4;
})();
@@ -0,0 +1,49 @@
=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts ===
var v0: T0;
>v0 : Symbol(v0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 3))
>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 11))
type T0 = string | I0;
>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 11))
>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithClass.ts, 1, 22))
class I0 {
>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithClass.ts, 1, 22))
x: T0;
>x : Symbol(x, Decl(circularTypeAliasForUnionWithClass.ts, 2, 10))
>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 11))
}
var v3: T3;
>v3 : Symbol(v3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 3))
>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 11))
type T3 = string | I3;
>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 11))
>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithClass.ts, 7, 22))
class I3 {
>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithClass.ts, 7, 22))
[x: number]: T3;
>x : Symbol(x, Decl(circularTypeAliasForUnionWithClass.ts, 9, 5))
>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 11))
}
var v4: T4;
>v4 : Symbol(v4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 3))
>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 11))
type T4 = string | I4;
>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 11))
>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithClass.ts, 13, 22))
class I4 {
>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithClass.ts, 13, 22))
[x: string]: T4;
>x : Symbol(x, Decl(circularTypeAliasForUnionWithClass.ts, 15, 5))
>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 11))
}
@@ -0,0 +1,49 @@
=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts ===
var v0: T0;
>v0 : string | I0
>T0 : string | I0
type T0 = string | I0;
>T0 : string | I0
>I0 : I0
class I0 {
>I0 : I0
x: T0;
>x : string | I0
>T0 : string | I0
}
var v3: T3;
>v3 : string | I3
>T3 : string | I3
type T3 = string | I3;
>T3 : string | I3
>I3 : I3
class I3 {
>I3 : I3
[x: number]: T3;
>x : number
>T3 : string | I3
}
var v4: T4;
>v4 : string | I4
>T4 : string | I4
type T4 = string | I4;
>T4 : string | I4
>I4 : I4
class I4 {
>I4 : I4
[x: string]: T4;
>x : string
>T4 : string | I4
}
@@ -0,0 +1,38 @@
//// [circularTypeAliasForUnionWithInterface.ts]
var v0: T0;
type T0 = string | I0;
interface I0 {
x: T0;
}
var v1: T1;
type T1 = string | I1;
interface I1 {
(): T1;
}
var v2: T2;
type T2 = string | I2;
interface I2 {
new (): T2;
}
var v3: T3;
type T3 = string | I3;
interface I3 {
[x: number]: T3;
}
var v4: T4;
type T4 = string | I4;
interface I4 {
[x: string]: T4;
}
//// [circularTypeAliasForUnionWithInterface.js]
var v0;
var v1;
var v2;
var v3;
var v4;
@@ -0,0 +1,79 @@
=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts ===
var v0: T0;
>v0 : Symbol(v0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 3))
>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 11))
type T0 = string | I0;
>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 11))
>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithInterface.ts, 1, 22))
interface I0 {
>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithInterface.ts, 1, 22))
x: T0;
>x : Symbol(x, Decl(circularTypeAliasForUnionWithInterface.ts, 2, 14))
>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 11))
}
var v1: T1;
>v1 : Symbol(v1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 3))
>T1 : Symbol(T1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 11))
type T1 = string | I1;
>T1 : Symbol(T1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 11))
>I1 : Symbol(I1, Decl(circularTypeAliasForUnionWithInterface.ts, 7, 22))
interface I1 {
>I1 : Symbol(I1, Decl(circularTypeAliasForUnionWithInterface.ts, 7, 22))
(): T1;
>T1 : Symbol(T1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 11))
}
var v2: T2;
>v2 : Symbol(v2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 3))
>T2 : Symbol(T2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 11))
type T2 = string | I2;
>T2 : Symbol(T2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 11))
>I2 : Symbol(I2, Decl(circularTypeAliasForUnionWithInterface.ts, 13, 22))
interface I2 {
>I2 : Symbol(I2, Decl(circularTypeAliasForUnionWithInterface.ts, 13, 22))
new (): T2;
>T2 : Symbol(T2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 11))
}
var v3: T3;
>v3 : Symbol(v3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 3))
>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 11))
type T3 = string | I3;
>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 11))
>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithInterface.ts, 19, 22))
interface I3 {
>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithInterface.ts, 19, 22))
[x: number]: T3;
>x : Symbol(x, Decl(circularTypeAliasForUnionWithInterface.ts, 21, 5))
>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 11))
}
var v4: T4;
>v4 : Symbol(v4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 3))
>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 11))
type T4 = string | I4;
>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 11))
>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithInterface.ts, 25, 22))
interface I4 {
>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithInterface.ts, 25, 22))
[x: string]: T4;
>x : Symbol(x, Decl(circularTypeAliasForUnionWithInterface.ts, 27, 5))
>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 11))
}
@@ -0,0 +1,79 @@
=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts ===
var v0: T0;
>v0 : string | I0
>T0 : string | I0
type T0 = string | I0;
>T0 : string | I0
>I0 : I0
interface I0 {
>I0 : I0
x: T0;
>x : string | I0
>T0 : string | I0
}
var v1: T1;
>v1 : string | I1
>T1 : string | I1
type T1 = string | I1;
>T1 : string | I1
>I1 : I1
interface I1 {
>I1 : I1
(): T1;
>T1 : string | I1
}
var v2: T2;
>v2 : string | I2
>T2 : string | I2
type T2 = string | I2;
>T2 : string | I2
>I2 : I2
interface I2 {
>I2 : I2
new (): T2;
>T2 : string | I2
}
var v3: T3;
>v3 : string | I3
>T3 : string | I3
type T3 = string | I3;
>T3 : string | I3
>I3 : I3
interface I3 {
>I3 : I3
[x: number]: T3;
>x : number
>T3 : string | I3
}
var v4: T4;
>v4 : string | I4
>T4 : string | I4
type T4 = string | I4;
>T4 : string | I4
>I4 : I4
interface I4 {
>I4 : I4
[x: string]: T4;
>x : string
>T4 : string | I4
}
@@ -1,4 +1,4 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
tests/cases/compiler/constDeclarations_access_2.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead.
tests/cases/compiler/constDeclarations_access_2.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations_access_2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
@@ -20,7 +20,7 @@ tests/cases/compiler/constDeclarations_access_2.ts(22,3): error TS2449: The oper
tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/constDeclarations_access_2.ts (19 errors) ====
///<reference path='constDeclarations_access_1.ts'/>
import m = require('constDeclarations_access_1');
+32
View File
@@ -0,0 +1,32 @@
//// [es5-umd.ts]
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es5-umd.js]
var A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
//# sourceMappingURL=es5-umd.js.map
//// [es5-umd.d.ts]
declare class A {
constructor();
B(): number;
}
+2
View File
@@ -0,0 +1,2 @@
//// [es5-umd.js.map]
{"version":3,"file":"es5-umd.js","sourceRoot":"","sources":["es5-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
@@ -0,0 +1,115 @@
===================================================================
JsFile: es5-umd.js
mapUrl: es5-umd.js.map
sourceRoot:
sources: es5-umd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd.js
sourceFile:es5-umd.ts
-------------------------------------------------------------------
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=es5-umd.js.map
+17
View File
@@ -0,0 +1,17 @@
=== tests/cases/compiler/es5-umd.ts ===
class A
>A : Symbol(A, Decl(es5-umd.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es5-umd.ts, 6, 5))
{
return 42;
}
}
+18
View File
@@ -0,0 +1,18 @@
=== tests/cases/compiler/es5-umd.ts ===
class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}
+42
View File
@@ -0,0 +1,42 @@
//// [es5-umd2.ts]
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es5-umd2.js]
(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
})(["require", "exports"], function (require, exports) {
var A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
exports.A = A;
});
//# sourceMappingURL=es5-umd2.js.map
//// [es5-umd2.d.ts]
export declare class A {
constructor();
B(): number;
}
@@ -0,0 +1,2 @@
//// [es5-umd2.js.map]
{"version":3,"file":"es5-umd2.js","sourceRoot":"","sources":["es5-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXY,SAAC,IAWb,CAAA"}
@@ -0,0 +1,149 @@
===================================================================
JsFile: es5-umd2.js
mapUrl: es5-umd2.js.map
sourceRoot:
sources: es5-umd2.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd2.js
sourceFile:es5-umd2.ts
-------------------------------------------------------------------
>>>(function (deps, factory) {
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
>>> }
>>> else if (typeof define === 'function' && define.amd) {
>>> define(deps, factory);
>>> }
>>>})(["require", "exports"], function (require, exports) {
>>> var A = (function () {
1 >^^^^
2 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^^^^^
2 > ^^->
1->export class A
>{
>
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
---
>>> })();
1 >^^^^
2 > ^
3 >
4 > ^^^^
5 > ^^^^^^^^^^->
1 >
2 > }
3 >
4 > export class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
---
>>> exports.A = A;
1->^^^^
2 > ^^^^^^^^^
3 > ^^^^
4 > ^
1->
2 > A
3 >
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
4 >
1->Emitted(17, 5) Source(2, 14) + SourceIndex(0)
2 >Emitted(17, 14) Source(2, 15) + SourceIndex(0)
3 >Emitted(17, 18) Source(13, 2) + SourceIndex(0)
4 >Emitted(17, 19) Source(13, 2) + SourceIndex(0)
---
>>>});
>>>//# sourceMappingURL=es5-umd2.js.map
@@ -0,0 +1,17 @@
=== tests/cases/compiler/es5-umd2.ts ===
export class A
>A : Symbol(A, Decl(es5-umd2.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es5-umd2.ts, 6, 5))
{
return 42;
}
}
+18
View File
@@ -0,0 +1,18 @@
=== tests/cases/compiler/es5-umd2.ts ===
export class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}
+42
View File
@@ -0,0 +1,42 @@
//// [es5-umd3.ts]
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es5-umd3.js]
(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
})(["require", "exports"], function (require, exports) {
var A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
exports.default = A;
});
//# sourceMappingURL=es5-umd3.js.map
//// [es5-umd3.d.ts]
export default class A {
constructor();
B(): number;
}
@@ -0,0 +1,2 @@
//// [es5-umd3.js.map]
{"version":3,"file":"es5-umd3.js","sourceRoot":"","sources":["es5-umd3.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXD,mBAWC,CAAA"}
@@ -0,0 +1,146 @@
===================================================================
JsFile: es5-umd3.js
mapUrl: es5-umd3.js.map
sourceRoot:
sources: es5-umd3.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd3.js
sourceFile:es5-umd3.ts
-------------------------------------------------------------------
>>>(function (deps, factory) {
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
>>> }
>>> else if (typeof define === 'function' && define.amd) {
>>> define(deps, factory);
>>> }
>>>})(["require", "exports"], function (require, exports) {
>>> var A = (function () {
1 >^^^^
2 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^^^^^
2 > ^^->
1->export default class A
>{
>
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
---
>>> })();
1 >^^^^
2 > ^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^->
1 >
2 > }
3 >
4 > export default class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
---
>>> exports.default = A;
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^
3 > ^
1->
2 > export default class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
3 >
1->Emitted(17, 5) Source(2, 1) + SourceIndex(0)
2 >Emitted(17, 24) Source(13, 2) + SourceIndex(0)
3 >Emitted(17, 25) Source(13, 2) + SourceIndex(0)
---
>>>});
>>>//# sourceMappingURL=es5-umd3.js.map
@@ -0,0 +1,17 @@
=== tests/cases/compiler/es5-umd3.ts ===
export default class A
>A : Symbol(A, Decl(es5-umd3.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es5-umd3.ts, 6, 5))
{
return 42;
}
}
+18
View File
@@ -0,0 +1,18 @@
=== tests/cases/compiler/es5-umd3.ts ===
export default class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}
+45
View File
@@ -0,0 +1,45 @@
//// [es5-umd4.ts]
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
export = A;
//// [es5-umd4.js]
(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
})(["require", "exports"], function (require, exports) {
var A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
return A;
});
//# sourceMappingURL=es5-umd4.js.map
//// [es5-umd4.d.ts]
declare class A {
constructor();
B(): number;
}
export = A;
@@ -0,0 +1,2 @@
//// [es5-umd4.js.map]
{"version":3,"file":"es5-umd4.js","sourceRoot":"","sources":["es5-umd4.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAEU,AAAX,OAAS,CAAC,CAAC"}
@@ -0,0 +1,143 @@
===================================================================
JsFile: es5-umd4.js
mapUrl: es5-umd4.js.map
sourceRoot:
sources: es5-umd4.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd4.js
sourceFile:es5-umd4.ts
-------------------------------------------------------------------
>>>(function (deps, factory) {
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
>>> }
>>> else if (typeof define === 'function' && define.amd) {
>>> define(deps, factory);
>>> }
>>>})(["require", "exports"], function (require, exports) {
>>> var A = (function () {
1 >^^^^
2 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
---
>>> })();
1 >^^^^
2 > ^
3 >
4 > ^^^^
5 > ^^^^^->
1 >
2 > }
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
---
>>> return A;
1->^^^^
2 >
3 > ^^^^^^^
4 > ^
5 > ^
1->
>
>export = A;
2 >
3 > export =
4 > A
5 > ;
1->Emitted(17, 5) Source(15, 12) + SourceIndex(0)
2 >Emitted(17, 5) Source(15, 1) + SourceIndex(0)
3 >Emitted(17, 12) Source(15, 10) + SourceIndex(0)
4 >Emitted(17, 13) Source(15, 11) + SourceIndex(0)
5 >Emitted(17, 14) Source(15, 12) + SourceIndex(0)
---
>>>});
>>>//# sourceMappingURL=es5-umd4.js.map
@@ -0,0 +1,20 @@
=== tests/cases/compiler/es5-umd4.ts ===
class A
>A : Symbol(A, Decl(es5-umd4.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es5-umd4.ts, 6, 5))
{
return 42;
}
}
export = A;
>A : Symbol(A, Decl(es5-umd4.ts, 0, 0))
+21
View File
@@ -0,0 +1,21 @@
=== tests/cases/compiler/es5-umd4.ts ===
class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}
export = A;
>A : A
+2 -2
View File
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-amd.ts (0 errors) ====
class A
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-declaration-amd.ts (0 errors) ====
class A
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-sourcemap-amd.ts (0 errors) ====
class A
@@ -0,0 +1,18 @@
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-umd.ts (0 errors) ====
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
+30
View File
@@ -0,0 +1,30 @@
//// [es6-umd.ts]
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es6-umd.js]
class A {
constructor() {
}
B() {
return 42;
}
}
//# sourceMappingURL=es6-umd.js.map
//// [es6-umd.d.ts]
declare class A {
constructor();
B(): number;
}
+2
View File
@@ -0,0 +1,2 @@
//// [es6-umd.js.map]
{"version":3,"file":"es6-umd.js","sourceRoot":"","sources":["es6-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
@@ -0,0 +1,91 @@
===================================================================
JsFile: es6-umd.js
mapUrl: es6-umd.js.map
sourceRoot:
sources: es6-umd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es6-umd.js
sourceFile:es6-umd.ts
-------------------------------------------------------------------
>>>class A {
1 >
2 >^^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> constructor() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> B() {
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^->
1->
>
> public
2 > B
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
---
>>> return 42;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1->()
> {
>
2 > return
3 >
4 > 42
5 > ;
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
---
>>>//# sourceMappingURL=es6-umd.js.map1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
---
@@ -0,0 +1,18 @@
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-umd2.ts (0 errors) ====
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
+30
View File
@@ -0,0 +1,30 @@
//// [es6-umd2.ts]
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es6-umd2.js]
export class A {
constructor() {
}
B() {
return 42;
}
}
//# sourceMappingURL=es6-umd2.js.map
//// [es6-umd2.d.ts]
export declare class A {
constructor();
B(): number;
}
@@ -0,0 +1,2 @@
//// [es6-umd2.js.map]
{"version":3,"file":"es6-umd2.js","sourceRoot":"","sources":["es6-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
@@ -0,0 +1,91 @@
===================================================================
JsFile: es6-umd2.js
mapUrl: es6-umd2.js.map
sourceRoot:
sources: es6-umd2.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es6-umd2.js
sourceFile:es6-umd2.ts
-------------------------------------------------------------------
>>>export class A {
1 >
2 >^^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> constructor() {
1->^^^^
2 > ^^->
1->export class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> B() {
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^->
1->
>
> public
2 > B
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
---
>>> return 42;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1->()
> {
>
2 > return
3 >
4 > 42
5 > ;
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
---
>>>//# sourceMappingURL=es6-umd2.js.map1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
---
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts (0 errors) ====
export var a = 10;
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportNameSpaceImport_0.ts (0 errors) ====
export var a = 10;
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportNamedImport_0.ts (0 errors) ====
export var a = 10;
@@ -1,8 +1,8 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportNamedImportInExportAssignment_0.ts (0 errors) ====
export var a = 10;
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts (0 errors) ====
export class A
{
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts (0 errors) ====
export class A
{
@@ -3,7 +3,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty
Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
Type 'StringIterator' is not assignable to type 'Iterator<string>'.
Types of property 'next' are incompatible.
Type '() => { value: string; }' is not assignable to type '() => IteratorResult<string>'.
Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult<string>'.
Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
Property 'done' is missing in type '{ value: string; }'.
@@ -16,7 +16,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty
!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator<string>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '() => { value: string; }' is not assignable to type '() => IteratorResult<string>'.
!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult<string>'.
!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
!!! error TS2322: Property 'done' is missing in type '{ value: string; }'.
@@ -3,7 +3,7 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322
Type '() => SymbolIterator' is not assignable to type '() => Iterator<symbol>'.
Type 'SymbolIterator' is not assignable to type 'Iterator<symbol>'.
Types of property 'next' are incompatible.
Type '() => { value: symbol; }' is not assignable to type '() => IteratorResult<symbol>'.
Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult<symbol>'.
Type '{ value: symbol; }' is not assignable to type 'IteratorResult<symbol>'.
Property 'done' is missing in type '{ value: symbol; }'.
@@ -16,7 +16,7 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322
!!! error TS2322: Type '() => SymbolIterator' is not assignable to type '() => Iterator<symbol>'.
!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterator<symbol>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '() => IteratorResult<symbol>'.
!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult<symbol>'.
!!! error TS2322: Type '{ value: symbol; }' is not assignable to type 'IteratorResult<symbol>'.
!!! error TS2322: Property 'done' is missing in type '{ value: symbol; }'.
@@ -0,0 +1,11 @@
tests/cases/compiler/umdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'.
==== tests/cases/compiler/umdDependencyComment2.ts (1 errors) ====
///<amd-dependency path='bar'/>
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
m1.f();
@@ -0,0 +1,20 @@
//// [umdDependencyComment2.ts]
///<amd-dependency path='bar'/>
import m1 = require("m2")
m1.f();
//// [umdDependencyComment2.js]
///<amd-dependency path='bar'/>
(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
})(["require", "exports", "bar", "m2"], function (require, exports) {
var m1 = require("m2");
m1.f();
});
@@ -0,0 +1,11 @@
tests/cases/compiler/umdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'.
==== tests/cases/compiler/umdDependencyCommentName1.ts (1 errors) ====
///<amd-dependency path='bar' name='b'/>
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
m1.f();
@@ -0,0 +1,20 @@
//// [umdDependencyCommentName1.ts]
///<amd-dependency path='bar' name='b'/>
import m1 = require("m2")
m1.f();
//// [umdDependencyCommentName1.js]
///<amd-dependency path='bar' name='b'/>
(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
})(["require", "exports", "bar", "m2"], function (require, exports, b) {
var m1 = require("m2");
m1.f();
});
@@ -0,0 +1,13 @@
tests/cases/compiler/umdDependencyCommentName2.ts(5,21): error TS2307: Cannot find external module 'm2'.
==== tests/cases/compiler/umdDependencyCommentName2.ts (1 errors) ====
///<amd-dependency path='bar' name='b'/>
///<amd-dependency path='foo'/>
///<amd-dependency path='goo' name='c'/>
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
m1.f();
@@ -0,0 +1,24 @@
//// [umdDependencyCommentName2.ts]
///<amd-dependency path='bar' name='b'/>
///<amd-dependency path='foo'/>
///<amd-dependency path='goo' name='c'/>
import m1 = require("m2")
m1.f();
//// [umdDependencyCommentName2.js]
///<amd-dependency path='bar' name='b'/>
///<amd-dependency path='foo'/>
///<amd-dependency path='goo' name='c'/>
(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
})(["require", "exports", "bar", "goo", "foo", "m2"], function (require, exports, b, c) {
var m1 = require("m2");
m1.f();
});
@@ -0,0 +1,87 @@
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(35,1): error TS2445: Property 'member' is protected and only accessible within class 'Protected' and its subclasses.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(36,1): error TS2341: Property 'member' is private and only accessible within class 'Private'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(38,4): error TS2339: Property 'member' does not exist on type 'Default | Protected'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(39,4): error TS2339: Property 'member' does not exist on type 'Default | Private'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(40,4): error TS2339: Property 'member' does not exist on type 'Public | Protected'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(41,4): error TS2339: Property 'member' does not exist on type 'Public | Private'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(42,5): error TS2339: Property 'member' does not exist on type 'Protected | Private'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(43,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Protected'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(44,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Private'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(45,5): error TS2339: Property 'member' does not exist on type 'Default | Protected | Private'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(46,5): error TS2339: Property 'member' does not exist on type 'Public | Protected | Private'.
tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(47,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Protected | Private'.
==== tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts (12 errors) ====
class Default {
member: string;
}
class Public {
public member: string;
}
class Protected {
protected member: string;
}
class Private {
private member: number;
}
var v1: Default;
var v2: Public;
var v3: Protected;
var v4: Private;
var v5: Default | Public;
var v6: Default | Protected;
var v7: Default | Private;
var v8: Public | Protected;
var v9: Public | Private;
var v10: Protected | Private;
var v11: Default | Public | Protected;
var v12: Default | Public | Private;
var v13: Default | Protected | Private;
var v14: Public | Private | Protected;
var v15: Default | Public | Private | Protected;
v1.member;
v2.member;
v3.member;
~~~~~~~~~
!!! error TS2445: Property 'member' is protected and only accessible within class 'Protected' and its subclasses.
v4.member;
~~~~~~~~~
!!! error TS2341: Property 'member' is private and only accessible within class 'Private'.
v5.member;
v6.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Default | Protected'.
v7.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Default | Private'.
v8.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Public | Protected'.
v9.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Public | Private'.
v10.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Protected | Private'.
v11.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Protected'.
v12.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Private'.
v13.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Default | Protected | Private'.
v14.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Public | Protected | Private'.
v15.member;
~~~~~~
!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Protected | Private'.
@@ -0,0 +1,101 @@
//// [unionTypePropertyAccessibility.ts]
class Default {
member: string;
}
class Public {
public member: string;
}
class Protected {
protected member: string;
}
class Private {
private member: number;
}
var v1: Default;
var v2: Public;
var v3: Protected;
var v4: Private;
var v5: Default | Public;
var v6: Default | Protected;
var v7: Default | Private;
var v8: Public | Protected;
var v9: Public | Private;
var v10: Protected | Private;
var v11: Default | Public | Protected;
var v12: Default | Public | Private;
var v13: Default | Protected | Private;
var v14: Public | Private | Protected;
var v15: Default | Public | Private | Protected;
v1.member;
v2.member;
v3.member;
v4.member;
v5.member;
v6.member;
v7.member;
v8.member;
v9.member;
v10.member;
v11.member;
v12.member;
v13.member;
v14.member;
v15.member;
//// [unionTypePropertyAccessibility.js]
var Default = (function () {
function Default() {
}
return Default;
})();
var Public = (function () {
function Public() {
}
return Public;
})();
var Protected = (function () {
function Protected() {
}
return Protected;
})();
var Private = (function () {
function Private() {
}
return Private;
})();
var v1;
var v2;
var v3;
var v4;
var v5;
var v6;
var v7;
var v8;
var v9;
var v10;
var v11;
var v12;
var v13;
var v14;
var v15;
v1.member;
v2.member;
v3.member;
v4.member;
v5.member;
v6.member;
v7.member;
v8.member;
v9.member;
v10.member;
v11.member;
v12.member;
v13.member;
v14.member;
v15.member;
+17
View File
@@ -0,0 +1,17 @@
// @target: ES5
// @sourcemap: false
// @declaration: false
// @module: umd
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
+17
View File
@@ -0,0 +1,17 @@
// @target: ES5
// @sourcemap: false
// @declaration: false
// @module: umd
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
+17
View File
@@ -0,0 +1,17 @@
// @target: ES5
// @sourcemap: false
// @declaration: false
// @module: umd
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
+19
View File
@@ -0,0 +1,19 @@
// @target: ES5
// @sourcemap: false
// @declaration: false
// @module: umd
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
export = A;
+17
View File
@@ -0,0 +1,17 @@
// @target: ES6
// @sourcemap: false
// @declaration: false
// @module: umd
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
+17
View File
@@ -0,0 +1,17 @@
// @target: ES6
// @sourcemap: false
// @declaration: false
// @module: umd
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
@@ -0,0 +1,5 @@
//@module: umd
///<amd-dependency path='bar'/>
import m1 = require("m2")
m1.f();
@@ -0,0 +1,5 @@
//@module: umd
///<amd-dependency path='bar' name='b'/>
import m1 = require("m2")
m1.f();
@@ -0,0 +1,7 @@
//@module: umd
///<amd-dependency path='bar' name='b'/>
///<amd-dependency path='foo'/>
///<amd-dependency path='goo' name='c'/>
import m1 = require("m2")
m1.f();
@@ -0,0 +1,17 @@
var v0: T0;
type T0 = string | I0;
class I0 {
x: T0;
}
var v3: T3;
type T3 = string | I3;
class I3 {
[x: number]: T3;
}
var v4: T4;
type T4 = string | I4;
class I4 {
[x: string]: T4;
}
@@ -0,0 +1,29 @@
var v0: T0;
type T0 = string | I0;
interface I0 {
x: T0;
}
var v1: T1;
type T1 = string | I1;
interface I1 {
(): T1;
}
var v2: T2;
type T2 = string | I2;
interface I2 {
new (): T2;
}
var v3: T3;
type T3 = string | I3;
interface I3 {
[x: number]: T3;
}
var v4: T4;
type T4 = string | I4;
interface I4 {
[x: string]: T4;
}
@@ -0,0 +1,47 @@
class Default {
member: string;
}
class Public {
public member: string;
}
class Protected {
protected member: string;
}
class Private {
private member: number;
}
var v1: Default;
var v2: Public;
var v3: Protected;
var v4: Private;
var v5: Default | Public;
var v6: Default | Protected;
var v7: Default | Private;
var v8: Public | Protected;
var v9: Public | Private;
var v10: Protected | Private;
var v11: Default | Public | Protected;
var v12: Default | Public | Private;
var v13: Default | Protected | Private;
var v14: Public | Private | Protected;
var v15: Default | Public | Private | Protected;
v1.member;
v2.member;
v3.member;
v4.member;
v5.member;
v6.member;
v7.member;
v8.member;
v9.member;
v10.member;
v11.member;
v12.member;
v13.member;
v14.member;
v15.member;
@@ -0,0 +1,6 @@
/// <reference path='fourslash.ts'/>
////type X = [number]/*1*/
goTo.marker("1");
edit.insert(";");
verify.currentLineContentIs("type X = [number];");