mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge branch 'master' into fix4715
This commit is contained in:
commit
2d133454e1
1570 files changed
+19630
-16347
No files matched your search
+12
-2
@@ -106,6 +106,16 @@ var serverCoreSources = [
|
||||
return path.join(serverDirectory, f);
|
||||
});
|
||||
|
||||
var scriptSources = [
|
||||
"tslint/booleanTriviaRule.ts",
|
||||
"tslint/nextLineRule.ts",
|
||||
"tslint/noNullRule.ts",
|
||||
"tslint/preferConstRule.ts",
|
||||
"tslint/typeOperatorSpacingRule.ts"
|
||||
].map(function (f) {
|
||||
return path.join(scriptsDirectory, f);
|
||||
});
|
||||
|
||||
var serverSources = serverCoreSources.concat(servicesSources);
|
||||
|
||||
var languageServiceLibrarySources = [
|
||||
@@ -365,7 +375,6 @@ file(builtGeneratedDiagnosticMessagesJSON,[generatedDiagnosticMessagesJSON], fun
|
||||
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
|
||||
task("generate-diagnostics", [diagnosticInfoMapTs]);
|
||||
|
||||
|
||||
// Publish nightly
|
||||
var configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
|
||||
var configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
|
||||
@@ -909,7 +918,8 @@ function lintFileAsync(options, path, cb) {
|
||||
|
||||
var lintTargets = compilerSources
|
||||
.concat(harnessCoreSources)
|
||||
.concat(serverCoreSources);
|
||||
.concat(serverCoreSources)
|
||||
.concat(scriptSources);
|
||||
|
||||
desc("Runs tslint on the compiler sources");
|
||||
task("lint", ["build-rules"], function() {
|
||||
|
||||
@@ -13,10 +13,10 @@ export class Rule extends Lint.Rules.AbstractRule {
|
||||
class TypeOperatorSpacingWalker extends Lint.RuleWalker {
|
||||
public visitNode(node: ts.Node) {
|
||||
if (node.kind === ts.SyntaxKind.UnionType || node.kind === ts.SyntaxKind.IntersectionType) {
|
||||
let types = (<ts.UnionOrIntersectionTypeNode>node).types;
|
||||
const types = (<ts.UnionOrIntersectionTypeNode>node).types;
|
||||
let expectedStart = types[0].end + 2; // space, | or &
|
||||
for (let i = 1; i < types.length; i++) {
|
||||
let currentType = types[i];
|
||||
const currentType = types[i];
|
||||
if (expectedStart !== currentType.pos || currentType.getLeadingTriviaWidth() !== 1) {
|
||||
const failure = this.createFailure(currentType.pos, currentType.getWidth(), Rule.FAILURE_STRING);
|
||||
this.addFailure(failure);
|
||||
|
||||
+47
-42
@@ -46,6 +46,7 @@ namespace ts {
|
||||
const compilerOptions = host.getCompilerOptions();
|
||||
const languageVersion = compilerOptions.target || ScriptTarget.ES3;
|
||||
const modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None;
|
||||
const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System;
|
||||
|
||||
const emitResolver = createResolver();
|
||||
|
||||
@@ -532,7 +533,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Because of module/namespace merging, a module's exports are in scope,
|
||||
// yet we never want to treat an export specifier as putting a member in scope.
|
||||
// yet we never want to treat an export specifier as putting a member in scope.
|
||||
// Therefore, if the name we find is purely an export specifier, it is not actually considered in scope.
|
||||
// Two things to note about this:
|
||||
// 1. We have to check this without calling getSymbol. The problem with calling getSymbol
|
||||
@@ -768,9 +769,12 @@ namespace ts {
|
||||
const moduleSymbol = resolveExternalModuleName(node, (<ImportDeclaration>node.parent).moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
const exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]);
|
||||
if (!exportDefaultSymbol) {
|
||||
if (!exportDefaultSymbol && !allowSyntheticDefaultImports) {
|
||||
error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
||||
}
|
||||
else if (!exportDefaultSymbol && allowSyntheticDefaultImports) {
|
||||
return resolveSymbol(moduleSymbol.exports["export="]) || resolveSymbol(moduleSymbol);
|
||||
}
|
||||
return exportDefaultSymbol;
|
||||
}
|
||||
}
|
||||
@@ -3197,7 +3201,7 @@ namespace ts {
|
||||
case SyntaxKind.BooleanKeyword:
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return true;
|
||||
case SyntaxKind.ArrayType:
|
||||
return isIndependentType((<ArrayTypeNode>node).elementType);
|
||||
@@ -3858,7 +3862,7 @@ namespace ts {
|
||||
paramSymbol = resolvedSymbol;
|
||||
}
|
||||
parameters.push(paramSymbol);
|
||||
if (param.type && param.type.kind === SyntaxKind.StringLiteral) {
|
||||
if (param.type && param.type.kind === SyntaxKind.StringLiteralType) {
|
||||
hasStringLiterals = true;
|
||||
}
|
||||
|
||||
@@ -4527,8 +4531,7 @@ namespace ts {
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getStringLiteralType(node: StringLiteral): StringLiteralType {
|
||||
const text = node.text;
|
||||
function getStringLiteralTypeForText(text: string): StringLiteralType {
|
||||
if (hasProperty(stringLiteralTypes, text)) {
|
||||
return stringLiteralTypes[text];
|
||||
}
|
||||
@@ -4538,10 +4541,10 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function getTypeFromStringLiteral(node: StringLiteral): Type {
|
||||
function getTypeFromStringLiteralTypeNode(node: StringLiteralTypeNode): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = getStringLiteralType(node);
|
||||
links.resolvedType = getStringLiteralTypeForText(node.text);
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -4583,8 +4586,8 @@ namespace ts {
|
||||
return voidType;
|
||||
case SyntaxKind.ThisType:
|
||||
return getTypeFromThisTypeNode(node);
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getTypeFromStringLiteral(<StringLiteral>node);
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return getTypeFromStringLiteralTypeNode(<StringLiteralTypeNode>node);
|
||||
case SyntaxKind.TypeReference:
|
||||
return getTypeFromTypeReference(<TypeReferenceNode>node);
|
||||
case SyntaxKind.TypePredicate:
|
||||
@@ -8791,7 +8794,7 @@ namespace ts {
|
||||
// for the argument. In that case, we should check the argument.
|
||||
if (argType === undefined) {
|
||||
argType = arg.kind === SyntaxKind.StringLiteral && !reportErrors
|
||||
? getStringLiteralType(<StringLiteral>arg)
|
||||
? getStringLiteralTypeForText((<StringLiteral>arg).text)
|
||||
: checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
|
||||
}
|
||||
|
||||
@@ -8986,7 +8989,7 @@ namespace ts {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getStringLiteralType(<StringLiteral>element.name);
|
||||
return getStringLiteralTypeForText((<Identifier | LiteralExpression>element.name).text);
|
||||
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
const nameType = checkComputedPropertyName(<ComputedPropertyName>element.name);
|
||||
@@ -9855,17 +9858,25 @@ namespace ts {
|
||||
return aggregatedTypes;
|
||||
}
|
||||
|
||||
// TypeScript Specification 1.0 (6.3) - July 2014
|
||||
// An explicitly typed function whose return type isn't the Void or the Any type
|
||||
// must have at least one return statement somewhere in its body.
|
||||
// An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
/*
|
||||
*TypeScript Specification 1.0 (6.3) - July 2014
|
||||
* An explicitly typed function whose return type isn't the Void or the Any type
|
||||
* must have at least one return statement somewhere in its body.
|
||||
* An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
* @param returnType - return type of the function, can be undefined if return type is not explicitly specified
|
||||
*/
|
||||
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func: FunctionLikeDeclaration, returnType: Type): void {
|
||||
if (!produceDiagnostics) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Functions that return 'void' or 'any' don't need any return expressions.
|
||||
if (returnType === voidType || isTypeAny(returnType)) {
|
||||
// Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.
|
||||
if (returnType && (returnType === voidType || isTypeAny(returnType))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if return type is not specified then we'll do the check only if 'noImplicitReturns' option is set
|
||||
if (!returnType && !compilerOptions.noImplicitReturns) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9875,13 +9886,14 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
if (func.flags & NodeFlags.HasExplicitReturn) {
|
||||
if (!returnType || func.flags & NodeFlags.HasExplicitReturn) {
|
||||
if (compilerOptions.noImplicitReturns) {
|
||||
error(func.type, Diagnostics.Not_all_code_paths_return_a_value);
|
||||
error(func.type || func, Diagnostics.Not_all_code_paths_return_a_value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// This function does not conform to the specification.
|
||||
// NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present
|
||||
error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
||||
}
|
||||
}
|
||||
@@ -9956,14 +9968,10 @@ namespace ts {
|
||||
emitAwaiter = true;
|
||||
}
|
||||
|
||||
const returnType = node.type && getTypeFromTypeNode(node.type);
|
||||
let promisedType: Type;
|
||||
if (returnType && isAsync) {
|
||||
promisedType = checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
|
||||
if (returnType && !node.asteriskToken) {
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType);
|
||||
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
|
||||
if (!node.asteriskToken) {
|
||||
// return is not necessary in the body of generators
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);
|
||||
}
|
||||
|
||||
if (node.body) {
|
||||
@@ -9986,13 +9994,13 @@ namespace ts {
|
||||
// check assignability of the awaited type of the expression body against the promised type of
|
||||
// its return type annotation.
|
||||
const exprType = checkExpression(<Expression>node.body);
|
||||
if (returnType) {
|
||||
if (returnOrPromisedType) {
|
||||
if (isAsync) {
|
||||
const awaitedType = checkAwaitedType(exprType, node.body, Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member);
|
||||
checkTypeAssignableTo(awaitedType, promisedType, node.body);
|
||||
checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body);
|
||||
}
|
||||
else {
|
||||
checkTypeAssignableTo(exprType, returnType, node.body);
|
||||
checkTypeAssignableTo(exprType, returnOrPromisedType, node.body);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10608,7 +10616,7 @@ namespace ts {
|
||||
function checkStringLiteralExpression(node: StringLiteral): Type {
|
||||
const contextualType = getContextualType(node);
|
||||
if (contextualType && contextualTypeIsStringLiteralType(contextualType)) {
|
||||
return getStringLiteralType(node);
|
||||
return getStringLiteralTypeForText(node.text);
|
||||
}
|
||||
|
||||
return stringType;
|
||||
@@ -11431,7 +11439,9 @@ namespace ts {
|
||||
seen = c === node;
|
||||
}
|
||||
});
|
||||
if (subsequentNode) {
|
||||
// We may be here because of some extra junk between overloads that could not be parsed into a valid node.
|
||||
// In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here.
|
||||
if (subsequentNode && subsequentNode.pos === node.end) {
|
||||
if (subsequentNode.kind === node.kind) {
|
||||
const errorNode: Node = (<FunctionLikeDeclaration>subsequentNode).name || subsequentNode;
|
||||
// TODO(jfreeman): These are methods, so handle computed name case
|
||||
@@ -11442,7 +11452,7 @@ namespace ts {
|
||||
// we can get here in two cases
|
||||
// 1. mixed static and instance class members
|
||||
// 2. something with the same name was defined before the set of overloads that prevents them from merging
|
||||
// here we'll report error only for the first case since for second we should already report error in binder
|
||||
// here we'll report error only for the first case since for second we should already report error in binder
|
||||
if (reportError) {
|
||||
const diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
||||
error(errorNode, diagnostic);
|
||||
@@ -12132,14 +12142,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
checkSourceElement(node.body);
|
||||
if (node.type && !isAccessor(node.kind) && !node.asteriskToken) {
|
||||
const returnType = getTypeFromTypeNode(node.type);
|
||||
let promisedType: Type;
|
||||
if (isAsync) {
|
||||
promisedType = checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType);
|
||||
if (!isAccessor(node.kind) && !node.asteriskToken) {
|
||||
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);
|
||||
}
|
||||
|
||||
if (produceDiagnostics && !node.type) {
|
||||
|
||||
@@ -280,10 +280,15 @@ namespace ts {
|
||||
type: "boolean",
|
||||
description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Allow_javascript_files_to_be_compiled,
|
||||
description: Diagnostics.Allow_javascript_files_to_be_compiled
|
||||
}
|
||||
];
|
||||
|
||||
@@ -488,7 +493,7 @@ namespace ts {
|
||||
fileNames: getFileNames(),
|
||||
errors
|
||||
};
|
||||
|
||||
|
||||
function getFileNames(): string[] {
|
||||
let fileNames: string[] = [];
|
||||
if (hasProperty(json, "files")) {
|
||||
|
||||
@@ -357,7 +357,7 @@ namespace ts {
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.ThisType:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return writeTextOfNode(currentText, type);
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return emitExpressionWithTypeArguments(<ExpressionWithTypeArguments>type);
|
||||
@@ -658,7 +658,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
write("require(");
|
||||
writeTextOfNode(currentText, getExternalModuleImportEqualsDeclarationExpression(node));
|
||||
emitExternalModuleSpecifier(node);
|
||||
write(");");
|
||||
}
|
||||
writer.writeLine();
|
||||
@@ -715,14 +715,23 @@ namespace ts {
|
||||
}
|
||||
write(" from ");
|
||||
}
|
||||
emitExternalModuleSpecifier(node.moduleSpecifier);
|
||||
emitExternalModuleSpecifier(node);
|
||||
write(";");
|
||||
writer.writeLine();
|
||||
}
|
||||
|
||||
function emitExternalModuleSpecifier(moduleSpecifier: Expression) {
|
||||
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit) {
|
||||
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent as (ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration));
|
||||
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration) {
|
||||
let moduleSpecifier: Node;
|
||||
if (parent.kind === SyntaxKind.ImportEqualsDeclaration) {
|
||||
const node = parent as ImportEqualsDeclaration;
|
||||
moduleSpecifier = getExternalModuleImportEqualsDeclarationExpression(node);
|
||||
}
|
||||
else {
|
||||
const node = parent as (ImportDeclaration | ExportDeclaration);
|
||||
moduleSpecifier = node.moduleSpecifier;
|
||||
}
|
||||
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {
|
||||
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, parent);
|
||||
if (moduleName) {
|
||||
write("\"");
|
||||
write(moduleName);
|
||||
@@ -765,7 +774,7 @@ namespace ts {
|
||||
}
|
||||
if (node.moduleSpecifier) {
|
||||
write(" from ");
|
||||
emitExternalModuleSpecifier(node.moduleSpecifier);
|
||||
emitExternalModuleSpecifier(node);
|
||||
}
|
||||
write(";");
|
||||
writer.writeLine();
|
||||
|
||||
@@ -1622,7 +1622,7 @@
|
||||
},
|
||||
"Cannot assign an abstract constructor type to a non-abstract constructor type.": {
|
||||
"category": "Error",
|
||||
"code":2517
|
||||
"code": 2517
|
||||
},
|
||||
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
|
||||
"category": "Error",
|
||||
@@ -2068,6 +2068,14 @@
|
||||
"category": "Error",
|
||||
"code": 5056
|
||||
},
|
||||
"Cannot find a tsconfig.json file at the specified directory: '{0}'": {
|
||||
"category": "Error",
|
||||
"code": 5057
|
||||
},
|
||||
"The specified path does not exist: '{0}'": {
|
||||
"category": "Error",
|
||||
"code": 5058
|
||||
},
|
||||
|
||||
"Concatenate and emit output to single file.": {
|
||||
"category": "Message",
|
||||
@@ -2109,6 +2117,10 @@
|
||||
"category": "Message",
|
||||
"code": 6010
|
||||
},
|
||||
"Allow default imports from modules with no default export. This does not affect code emit, just typechecking.": {
|
||||
"category": "Message",
|
||||
"code": 6011
|
||||
},
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
|
||||
+61
-35
@@ -1276,7 +1276,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function isBinaryOrOctalIntegerLiteral(node: LiteralExpression, text: string): boolean {
|
||||
function isBinaryOrOctalIntegerLiteral(node: LiteralLikeNode, text: string): boolean {
|
||||
if (node.kind === SyntaxKind.NumericLiteral && text.length > 1) {
|
||||
switch (text.charCodeAt(1)) {
|
||||
case CharacterCodes.b:
|
||||
@@ -1290,7 +1290,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitLiteral(node: LiteralExpression) {
|
||||
function emitLiteral(node: LiteralExpression | TemplateLiteralFragment) {
|
||||
const text = getLiteralText(node);
|
||||
|
||||
if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) {
|
||||
@@ -1305,7 +1305,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function getLiteralText(node: LiteralExpression) {
|
||||
function getLiteralText(node: LiteralExpression | TemplateLiteralFragment) {
|
||||
// Any template literal or string literal with an extended escape
|
||||
// (e.g. "\u{0067}") will need to be downleveled as a escaped string literal.
|
||||
if (languageVersion < ScriptTarget.ES6 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {
|
||||
@@ -1364,7 +1364,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(`"${text}"`);
|
||||
}
|
||||
|
||||
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression) => void) {
|
||||
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression | TemplateLiteralFragment) => void) {
|
||||
write("[");
|
||||
if (node.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral) {
|
||||
literalEmitter(<LiteralExpression>node.template);
|
||||
@@ -5571,9 +5571,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitDecoratorsOfClass(node);
|
||||
}
|
||||
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
return;
|
||||
}
|
||||
// If this is an exported class, but not on the top level (i.e. on an internal
|
||||
// module), export it
|
||||
if (!isES6ExportedDeclaration(node) && (node.flags & NodeFlags.Export)) {
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
// if this is a top level default export of decorated class, write the export after the declaration.
|
||||
writeLine();
|
||||
if (thisNodeIsDecorated && modulekind === ModuleKind.ES6) {
|
||||
write("export default ");
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
else if (modulekind === ModuleKind.System) {
|
||||
write(`${exportFunctionForFile}("default", `);
|
||||
emitDeclarationName(node);
|
||||
write(");");
|
||||
}
|
||||
else if (modulekind !== ModuleKind.ES6) {
|
||||
write(`exports.default = `);
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
else if (node.parent.kind !== SyntaxKind.SourceFile || (modulekind !== ModuleKind.ES6 && !(node.flags & NodeFlags.Default))) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitModuleMemberName(node);
|
||||
@@ -5582,13 +5604,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node) && (node.flags & NodeFlags.Default) && thisNodeIsDecorated) {
|
||||
// if this is a top level default export of decorated class, write the export after the declaration.
|
||||
writeLine();
|
||||
write("export default ");
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassLikeDeclarationBelowES6(node: ClassLikeDeclaration) {
|
||||
@@ -5954,7 +5969,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
function emitSerializedTypeNode(node: TypeNode) {
|
||||
if (node) {
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
write("void 0");
|
||||
@@ -5980,7 +5994,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return;
|
||||
|
||||
case SyntaxKind.StringKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
write("String");
|
||||
return;
|
||||
|
||||
@@ -6796,7 +6810,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string {
|
||||
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, emitRelativePathAsModuleName: boolean): string {
|
||||
if (emitRelativePathAsModuleName) {
|
||||
const name = getExternalModuleNameFromDeclaration(host, resolver, importNode);
|
||||
if (name) {
|
||||
return `"${name}"`;
|
||||
}
|
||||
}
|
||||
const moduleName = getExternalModuleName(importNode);
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
return tryRenameExternalModule(<LiteralExpression>moduleName) || getLiteralText(<LiteralExpression>moduleName);
|
||||
@@ -7356,7 +7376,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
const dependencyGroups: DependencyGroup[] = [];
|
||||
|
||||
for (let i = 0; i < externalImports.length; ++i) {
|
||||
let text = getExternalModuleNameText(externalImports[i]);
|
||||
const text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName);
|
||||
if (hasProperty(groupIndices, text)) {
|
||||
// deduplicate/group entries in dependency list by the dependency name
|
||||
const groupIndex = groupIndices[text];
|
||||
@@ -7372,18 +7392,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(", ");
|
||||
}
|
||||
|
||||
if (emitRelativePathAsModuleName) {
|
||||
const name = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]);
|
||||
if (name) {
|
||||
text = `"${name}"`;
|
||||
}
|
||||
}
|
||||
write(text);
|
||||
}
|
||||
write(`], function(${exportFunctionForFile}) {`);
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
|
||||
emitEmitHelpers(node);
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitSystemModuleBody(node, dependencyGroups, startIndex);
|
||||
@@ -7420,14 +7434,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
for (const importNode of externalImports) {
|
||||
// Find the name of the external module
|
||||
let externalModuleName = getExternalModuleNameText(importNode);
|
||||
|
||||
if (emitRelativePathAsModuleName) {
|
||||
const name = getExternalModuleNameFromDeclaration(host, resolver, importNode);
|
||||
if (name) {
|
||||
externalModuleName = `"${name}"`;
|
||||
}
|
||||
}
|
||||
const externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName);
|
||||
|
||||
// Find the name of the module alias, if there is one
|
||||
const importAliasName = getLocalNameForExternalImport(importNode);
|
||||
@@ -7493,7 +7500,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
writeModuleName(node, emitRelativePathAsModuleName);
|
||||
emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName);
|
||||
increaseIndent();
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
@@ -7505,7 +7512,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitCommonJSModule(node: SourceFile) {
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ true);
|
||||
emitEmitHelpers(node);
|
||||
collectExternalModuleInfo(node);
|
||||
emitExportStarHelper();
|
||||
@@ -7534,7 +7541,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
})(`);
|
||||
emitAMDFactoryHeader(dependencyNames);
|
||||
increaseIndent();
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
@@ -7676,19 +7683,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function emitDirectivePrologues(statements: Node[], startWithNewLine: boolean): number {
|
||||
function isUseStrictPrologue(node: ExpressionStatement): boolean {
|
||||
return !!(node.expression as StringLiteral).text.match(/use strict/);
|
||||
}
|
||||
|
||||
function ensureUseStrictPrologue(startWithNewLine: boolean, writeUseStrict: boolean) {
|
||||
if (writeUseStrict) {
|
||||
if (startWithNewLine) {
|
||||
writeLine();
|
||||
}
|
||||
write("\"use strict\";");
|
||||
}
|
||||
}
|
||||
|
||||
function emitDirectivePrologues(statements: Node[], startWithNewLine: boolean, ensureUseStrict?: boolean): number {
|
||||
let foundUseStrict = false;
|
||||
for (let i = 0; i < statements.length; ++i) {
|
||||
if (isPrologueDirective(statements[i])) {
|
||||
if (isUseStrictPrologue(statements[i] as ExpressionStatement)) {
|
||||
foundUseStrict = true;
|
||||
}
|
||||
if (startWithNewLine || i > 0) {
|
||||
writeLine();
|
||||
}
|
||||
emit(statements[i]);
|
||||
}
|
||||
else {
|
||||
ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict);
|
||||
// return index of the first non prologue directive
|
||||
return i;
|
||||
}
|
||||
}
|
||||
ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict);
|
||||
return statements.length;
|
||||
}
|
||||
|
||||
|
||||
+18
-6
@@ -1874,7 +1874,7 @@ namespace ts {
|
||||
function parseTemplateExpression(): TemplateExpression {
|
||||
const template = <TemplateExpression>createNode(SyntaxKind.TemplateExpression);
|
||||
|
||||
template.head = parseLiteralNode();
|
||||
template.head = parseTemplateLiteralFragment();
|
||||
Debug.assert(template.head.kind === SyntaxKind.TemplateHead, "Template head has wrong token kind");
|
||||
|
||||
const templateSpans = <NodeArray<TemplateSpan>>[];
|
||||
@@ -1895,22 +1895,34 @@ namespace ts {
|
||||
const span = <TemplateSpan>createNode(SyntaxKind.TemplateSpan);
|
||||
span.expression = allowInAnd(parseExpression);
|
||||
|
||||
let literal: LiteralExpression;
|
||||
let literal: TemplateLiteralFragment;
|
||||
|
||||
if (token === SyntaxKind.CloseBraceToken) {
|
||||
reScanTemplateToken();
|
||||
literal = parseLiteralNode();
|
||||
literal = parseTemplateLiteralFragment();
|
||||
}
|
||||
else {
|
||||
literal = <LiteralExpression>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
|
||||
literal = <TemplateLiteralFragment>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
|
||||
}
|
||||
|
||||
span.literal = literal;
|
||||
return finishNode(span);
|
||||
}
|
||||
|
||||
function parseStringLiteralTypeNode(): StringLiteralTypeNode {
|
||||
return <StringLiteralTypeNode>parseLiteralLikeNode(SyntaxKind.StringLiteralType, /*internName*/ true);
|
||||
}
|
||||
|
||||
function parseLiteralNode(internName?: boolean): LiteralExpression {
|
||||
const node = <LiteralExpression>createNode(token);
|
||||
return <LiteralExpression>parseLiteralLikeNode(token, internName);
|
||||
}
|
||||
|
||||
function parseTemplateLiteralFragment(): TemplateLiteralFragment {
|
||||
return <TemplateLiteralFragment>parseLiteralLikeNode(token, /*internName*/ false);
|
||||
}
|
||||
|
||||
function parseLiteralLikeNode(kind: SyntaxKind, internName: boolean): LiteralLikeNode {
|
||||
const node = <LiteralExpression>createNode(kind);
|
||||
const text = scanner.getTokenValue();
|
||||
node.text = internName ? internIdentifier(text) : text;
|
||||
|
||||
@@ -2397,7 +2409,7 @@ namespace ts {
|
||||
const node = tryParse(parseKeywordAndNoDot);
|
||||
return node || parseTypeReferenceOrTypePredicate();
|
||||
case SyntaxKind.StringLiteral:
|
||||
return <StringLiteral>parseLiteralNode(/*internName*/ true);
|
||||
return parseStringLiteralTypeNode();
|
||||
case SyntaxKind.VoidKeyword:
|
||||
return parseTokenNode<TypeNode>();
|
||||
case SyntaxKind.ThisKeyword:
|
||||
|
||||
+25
-18
@@ -395,7 +395,7 @@ namespace ts {
|
||||
getTypeChecker,
|
||||
getClassifiableNames,
|
||||
getDiagnosticsProducingTypeChecker,
|
||||
getCommonSourceDirectory: () => commonSourceDirectory,
|
||||
getCommonSourceDirectory,
|
||||
emit,
|
||||
getCurrentDirectory: () => currentDirectory,
|
||||
getNodeCount: () => getDiagnosticsProducingTypeChecker().getNodeCount(),
|
||||
@@ -411,6 +411,25 @@ namespace ts {
|
||||
|
||||
return program;
|
||||
|
||||
function getCommonSourceDirectory() {
|
||||
if (typeof commonSourceDirectory === "undefined") {
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
// If a rootDir is specified and is valid use it as the commonSourceDirectory
|
||||
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
|
||||
}
|
||||
else {
|
||||
commonSourceDirectory = computeCommonSourceDirectory(files);
|
||||
}
|
||||
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
|
||||
// Make sure directory path ends with directory separator so this string can directly
|
||||
// used to replace with "" to get the relative path of the source file and the relative path doesn't
|
||||
// start with / making it rooted path
|
||||
commonSourceDirectory += directorySeparator;
|
||||
}
|
||||
}
|
||||
return commonSourceDirectory;
|
||||
}
|
||||
|
||||
function getClassifiableNames() {
|
||||
if (!classifiableNames) {
|
||||
// Initialize a checker so that all our files are bound.
|
||||
@@ -1234,24 +1253,12 @@ namespace ts {
|
||||
options.sourceRoot || // there is --sourceRoot specified
|
||||
options.mapRoot) { // there is --mapRoot specified
|
||||
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
// If a rootDir is specified and is valid use it as the commonSourceDirectory
|
||||
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
|
||||
}
|
||||
else {
|
||||
// Compute the commonSourceDirectory from the input files
|
||||
commonSourceDirectory = computeCommonSourceDirectory(files);
|
||||
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
|
||||
if (options.outDir && commonSourceDirectory === "" && forEach(files, file => getRootLength(file.fileName) > 1)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
}
|
||||
}
|
||||
// Precalculate and cache the common source directory
|
||||
const dir = getCommonSourceDirectory();
|
||||
|
||||
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
|
||||
// Make sure directory path ends with directory separator so this string can directly
|
||||
// used to replace with "" to get the relative path of the source file and the relative path doesn't
|
||||
// start with / making it rooted path
|
||||
commonSourceDirectory += directorySeparator;
|
||||
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
|
||||
if (options.outDir && dir === "" && forEach(files, file => getRootLength(file.fileName) > 1)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-1
@@ -295,11 +295,26 @@ namespace ts {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), /* compilerHost */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json"));
|
||||
if (commandLine.fileNames.length !== 0) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), /* compilerHost */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
const fileOrDirectory = normalizePath(commandLine.options.project);
|
||||
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
|
||||
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
else {
|
||||
configFileName = fileOrDirectory;
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
|
||||
const searchPath = normalizePath(sys.getCurrentDirectory());
|
||||
|
||||
+23
-10
@@ -205,6 +205,7 @@ namespace ts {
|
||||
IntersectionType,
|
||||
ParenthesizedType,
|
||||
ThisType,
|
||||
StringLiteralType,
|
||||
// Binding patterns
|
||||
ObjectBindingPattern,
|
||||
ArrayBindingPattern,
|
||||
@@ -350,7 +351,7 @@ namespace ts {
|
||||
FirstFutureReservedWord = ImplementsKeyword,
|
||||
LastFutureReservedWord = YieldKeyword,
|
||||
FirstTypeNode = TypePredicate,
|
||||
LastTypeNode = ThisType,
|
||||
LastTypeNode = StringLiteralType,
|
||||
FirstPunctuation = OpenBraceToken,
|
||||
LastPunctuation = CaretEqualsToken,
|
||||
FirstToken = Unknown,
|
||||
@@ -790,10 +791,13 @@ namespace ts {
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
// Note that a StringLiteral AST node is both an Expression and a TypeNode. The latter is
|
||||
// because string literals can appear in type annotations as well.
|
||||
// @kind(SyntaxKind.StringLiteralType)
|
||||
export interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode {
|
||||
_stringLiteralTypeBrand: any;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.StringLiteral)
|
||||
export interface StringLiteral extends LiteralExpression, TypeNode {
|
||||
export interface StringLiteral extends LiteralExpression {
|
||||
_stringLiteralBrand: any;
|
||||
}
|
||||
|
||||
@@ -911,24 +915,32 @@ namespace ts {
|
||||
body: ConciseBody;
|
||||
}
|
||||
|
||||
export interface LiteralLikeNode extends Node {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
|
||||
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
|
||||
// or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters.
|
||||
// For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1".
|
||||
// @kind(SyntaxKind.NumericLiteral)
|
||||
// @kind(SyntaxKind.RegularExpressionLiteral)
|
||||
// @kind(SyntaxKind.NoSubstitutionTemplateLiteral)
|
||||
export interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
|
||||
_literalExpressionBrand: any;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.TemplateHead)
|
||||
// @kind(SyntaxKind.TemplateMiddle)
|
||||
// @kind(SyntaxKind.TemplateTail)
|
||||
export interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
export interface TemplateLiteralFragment extends LiteralLikeNode {
|
||||
_templateLiteralFragmentBrand: any;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.TemplateExpression)
|
||||
export interface TemplateExpression extends PrimaryExpression {
|
||||
head: LiteralExpression;
|
||||
head: TemplateLiteralFragment;
|
||||
templateSpans: NodeArray<TemplateSpan>;
|
||||
}
|
||||
|
||||
@@ -937,7 +949,7 @@ namespace ts {
|
||||
// @kind(SyntaxKind.TemplateSpan)
|
||||
export interface TemplateSpan extends Node {
|
||||
expression: Expression;
|
||||
literal: LiteralExpression;
|
||||
literal: TemplateLiteralFragment;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.ParenthesizedExpression)
|
||||
@@ -2360,6 +2372,7 @@ namespace ts {
|
||||
noImplicitReturns?: boolean;
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowJs?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
|
||||
@@ -466,9 +466,6 @@ namespace ts {
|
||||
return true;
|
||||
case SyntaxKind.VoidKeyword:
|
||||
return node.parent.kind !== SyntaxKind.VoidExpression;
|
||||
case SyntaxKind.StringLiteral:
|
||||
// Specialized signatures can have string literals as their parameters' type names
|
||||
return node.parent.kind === SyntaxKind.Parameter;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
||||
|
||||
@@ -1909,7 +1906,7 @@ namespace ts {
|
||||
* Resolves a local path to a path which is absolute to the base of the emit
|
||||
*/
|
||||
export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string {
|
||||
const dir = host.getCurrentDirectory();
|
||||
const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
|
||||
const relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false);
|
||||
return removeFileExtension(relativePath);
|
||||
}
|
||||
|
||||
@@ -3372,6 +3372,7 @@ namespace ts {
|
||||
|
||||
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken: Node): boolean {
|
||||
if (contextToken.kind === SyntaxKind.StringLiteral
|
||||
|| contextToken.kind === SyntaxKind.StringLiteralType
|
||||
|| contextToken.kind === SyntaxKind.RegularExpressionLiteral
|
||||
|| isTemplateLiteralKind(contextToken.kind)) {
|
||||
let start = contextToken.getStart();
|
||||
@@ -6372,6 +6373,7 @@ namespace ts {
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
@@ -6833,7 +6835,7 @@ namespace ts {
|
||||
else if (tokenKind === SyntaxKind.NumericLiteral) {
|
||||
return ClassificationType.numericLiteral;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.StringLiteral) {
|
||||
else if (tokenKind === SyntaxKind.StringLiteral || tokenKind === SyntaxKind.StringLiteralType) {
|
||||
return ClassificationType.stringLiteral;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.RegularExpressionLiteral) {
|
||||
@@ -7752,7 +7754,7 @@ namespace ts {
|
||||
addResult(start, end, classFromKind(token));
|
||||
|
||||
if (end >= text.length) {
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
if (token === SyntaxKind.StringLiteral || token === SyntaxKind.StringLiteralType) {
|
||||
// Check to see if we finished up on a multiline string literal.
|
||||
let tokenText = scanner.getTokenText();
|
||||
if (scanner.isUnterminated()) {
|
||||
@@ -7902,6 +7904,7 @@ namespace ts {
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return ClassificationType.numericLiteral;
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return ClassificationType.stringLiteral;
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
return ClassificationType.regularExpressionLiteral;
|
||||
|
||||
@@ -257,14 +257,14 @@ namespace ts {
|
||||
return syntaxList;
|
||||
}
|
||||
|
||||
/* Gets the token whose text has range [start, end) and
|
||||
/* Gets the token whose text has range [start, end) and
|
||||
* position >= start and (position < end or (position === end && token is keyword or identifier))
|
||||
*/
|
||||
export function getTouchingWord(sourceFile: SourceFile, position: number): Node {
|
||||
return getTouchingToken(sourceFile, position, n => isWord(n.kind));
|
||||
}
|
||||
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
* and (position < end or (position === end && token is keyword or identifier or numeric\string litera))
|
||||
*/
|
||||
export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node {
|
||||
@@ -391,8 +391,8 @@ namespace ts {
|
||||
const start = child.getStart(sourceFile);
|
||||
const lookInPreviousChild =
|
||||
(start >= position) || // cursor in the leading trivia
|
||||
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
|
||||
|
||||
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
|
||||
|
||||
if (lookInPreviousChild) {
|
||||
// actual start of the node is past the position - previous token should be at the end of previous child
|
||||
let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i);
|
||||
@@ -407,7 +407,7 @@ namespace ts {
|
||||
|
||||
Debug.assert(startNode !== undefined || n.kind === SyntaxKind.SourceFile);
|
||||
|
||||
// Here we know that none of child token nodes embrace the position,
|
||||
// Here we know that none of child token nodes embrace the position,
|
||||
// the only known case is when position is at the end of the file.
|
||||
// Try to find the rightmost token in the file without filtering.
|
||||
// Namely we are skipping the check: 'position < node.end'
|
||||
@@ -429,7 +429,7 @@ namespace ts {
|
||||
|
||||
export function isInString(sourceFile: SourceFile, position: number) {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart();
|
||||
return token && (token.kind === SyntaxKind.StringLiteral || token.kind === SyntaxKind.StringLiteralType) && position > token.getStart();
|
||||
}
|
||||
|
||||
export function isInComment(sourceFile: SourceFile, position: number) {
|
||||
@@ -445,7 +445,7 @@ namespace ts {
|
||||
|
||||
if (token && position <= token.getStart()) {
|
||||
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
|
||||
|
||||
// The end marker of a single-line comment does not include the newline character.
|
||||
// In the following case, we are inside a comment (^ denotes the cursor position):
|
||||
//
|
||||
@@ -565,6 +565,7 @@ namespace ts {
|
||||
|
||||
export function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean {
|
||||
if (kind === SyntaxKind.StringLiteral
|
||||
|| kind === SyntaxKind.StringLiteralType
|
||||
|| kind === SyntaxKind.RegularExpressionLiteral
|
||||
|| isTemplateLiteralKind(kind)) {
|
||||
return true;
|
||||
|
||||
@@ -40,6 +40,7 @@ compile(process.argv.slice(2), {
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
"use strict";
|
||||
var ts = require("typescript");
|
||||
function compile(fileNames, options) {
|
||||
var program = ts.createProgram(fileNames, options);
|
||||
|
||||
@@ -70,6 +70,7 @@ fileNames.forEach(fileName => {
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
"use strict";
|
||||
var ts = require("typescript");
|
||||
function delint(sourceFile) {
|
||||
delintNode(sourceFile);
|
||||
|
||||
@@ -22,6 +22,7 @@ console.log(JSON.stringify(result));
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
"use strict";
|
||||
var ts = require("typescript");
|
||||
var source = "let x: string = 'string'";
|
||||
var result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
|
||||
|
||||
@@ -109,6 +109,7 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
"use strict";
|
||||
var ts = require("typescript");
|
||||
function watch(rootFileNames, options) {
|
||||
var files = {};
|
||||
|
||||
@@ -5,6 +5,7 @@ export class C {
|
||||
export = B;
|
||||
|
||||
//// [ExportAssignment7.js]
|
||||
"use strict";
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ export class C {
|
||||
}
|
||||
|
||||
//// [ExportAssignment8.js]
|
||||
"use strict";
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
|
||||
+2
@@ -30,6 +30,7 @@ export module A {
|
||||
|
||||
|
||||
//// [part1.js]
|
||||
"use strict";
|
||||
var A;
|
||||
(function (A) {
|
||||
var Utils;
|
||||
@@ -42,6 +43,7 @@ var A;
|
||||
A.Origin = { x: 0, y: 0 };
|
||||
})(A = exports.A || (exports.A = {}));
|
||||
//// [part2.js]
|
||||
"use strict";
|
||||
var A;
|
||||
(function (A) {
|
||||
// collision with 'Origin' var in other part of merged module
|
||||
|
||||
@@ -14,6 +14,7 @@ y = moduleA; // should be error
|
||||
|
||||
|
||||
//// [aliasAssignments_moduleA.js]
|
||||
"use strict";
|
||||
var someClass = (function () {
|
||||
function someClass() {
|
||||
}
|
||||
@@ -21,6 +22,7 @@ var someClass = (function () {
|
||||
})();
|
||||
exports.someClass = someClass;
|
||||
//// [aliasAssignments_1.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasAssignments_moduleA");
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
|
||||
@@ -23,6 +23,7 @@ var x: foo.A = foo.bar("hello"); // foo.A should be ok but foo.bar should be err
|
||||
|
||||
//// [aliasOnMergedModuleInterface_0.js]
|
||||
//// [aliasOnMergedModuleInterface_1.js]
|
||||
"use strict";
|
||||
var z;
|
||||
z.bar("hello"); // This should be ok
|
||||
var x = foo.bar("hello"); // foo.A should be ok but foo.bar should be error
|
||||
@@ -28,6 +28,7 @@ class C2 {
|
||||
}
|
||||
|
||||
//// [aliasUsage1_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -35,6 +36,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsage1_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -50,6 +52,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsage1_main.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasUsage1_moduleA");
|
||||
var C2 = (function () {
|
||||
function C2() {
|
||||
|
||||
@@ -22,6 +22,7 @@ var xs: IHasVisualizationModel[] = [moduleA];
|
||||
var xs2: typeof moduleA[] = [moduleA];
|
||||
|
||||
//// [aliasUsageInArray_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -29,6 +30,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInArray_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -44,6 +46,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInArray_main.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasUsageInArray_moduleA");
|
||||
var xs = [moduleA];
|
||||
var xs2 = [moduleA];
|
||||
@@ -21,6 +21,7 @@ var f = (x: IHasVisualizationModel) => x;
|
||||
f = (x) => moduleA;
|
||||
|
||||
//// [aliasUsageInFunctionExpression_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -28,6 +29,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInFunctionExpression_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -43,6 +45,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInFunctionExpression_main.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasUsageInFunctionExpression_moduleA");
|
||||
var f = function (x) { return x; };
|
||||
f = function (x) { return moduleA; };
|
||||
@@ -25,6 +25,7 @@ var r2 = foo({ a: <IHasVisualizationModel>null });
|
||||
|
||||
|
||||
//// [aliasUsageInGenericFunction_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -32,6 +33,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInGenericFunction_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -47,6 +49,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInGenericFunction_main.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasUsageInGenericFunction_moduleA");
|
||||
function foo(x) {
|
||||
return x;
|
||||
|
||||
@@ -27,6 +27,7 @@ class N2 {
|
||||
}
|
||||
|
||||
//// [aliasUsageInIndexerOfClass_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -34,6 +35,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInIndexerOfClass_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -49,6 +51,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInIndexerOfClass_main.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
|
||||
var N = (function () {
|
||||
function N() {
|
||||
|
||||
@@ -22,6 +22,7 @@ var b: { x: IHasVisualizationModel } = { x: moduleA };
|
||||
var c: { y: { z: IHasVisualizationModel } } = { y: { z: moduleA } };
|
||||
|
||||
//// [aliasUsageInObjectLiteral_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -29,6 +30,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInObjectLiteral_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -44,6 +46,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInObjectLiteral_main.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasUsageInObjectLiteral_moduleA");
|
||||
var a = { x: moduleA };
|
||||
var b = { x: moduleA };
|
||||
|
||||
@@ -25,6 +25,7 @@ var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || {
|
||||
var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x: moduleA } : null;
|
||||
|
||||
//// [aliasUsageInOrExpression_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -32,6 +33,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInOrExpression_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -47,6 +49,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInOrExpression_main.js]
|
||||
"use strict";
|
||||
var moduleA = require("./aliasUsageInOrExpression_moduleA");
|
||||
var i;
|
||||
var d1 = i || moduleA;
|
||||
|
||||
@@ -25,6 +25,7 @@ class D extends C<IHasVisualizationModel> {
|
||||
}
|
||||
|
||||
//// [aliasUsageInTypeArgumentOfExtendsClause_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -32,6 +33,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -47,6 +49,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInTypeArgumentOfExtendsClause_main.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
|
||||
@@ -21,6 +21,7 @@ var i: IHasVisualizationModel;
|
||||
var m: typeof moduleA = i;
|
||||
|
||||
//// [aliasUsageInVarAssignment_backbone.js]
|
||||
"use strict";
|
||||
var Model = (function () {
|
||||
function Model() {
|
||||
}
|
||||
@@ -28,6 +29,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInVarAssignment_moduleA.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -43,5 +45,6 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInVarAssignment_main.js]
|
||||
"use strict";
|
||||
var i;
|
||||
var m = i;
|
||||
@@ -19,10 +19,13 @@ export var a = function () {
|
||||
|
||||
|
||||
//// [aliasUsedAsNameValue_0.js]
|
||||
"use strict";
|
||||
//// [aliasUsedAsNameValue_1.js]
|
||||
"use strict";
|
||||
function b(a) { return null; }
|
||||
exports.b = b;
|
||||
//// [aliasUsedAsNameValue_2.js]
|
||||
"use strict";
|
||||
///<reference path='aliasUsedAsNameValue_0.ts' />
|
||||
///<reference path='aliasUsedAsNameValue_1.ts' />
|
||||
var mod = require("./aliasUsedAsNameValue_0");
|
||||
|
||||
@@ -11,5 +11,7 @@ import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializ
|
||||
var d = b.q3;
|
||||
|
||||
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.js]
|
||||
"use strict";
|
||||
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.js]
|
||||
"use strict";
|
||||
var d = b.q3;
|
||||
@@ -18,6 +18,7 @@ module M {
|
||||
|
||||
//// [aliasesInSystemModule1.js]
|
||||
System.register(['foo'], function(exports_1) {
|
||||
"use strict";
|
||||
var alias;
|
||||
var cls, cls2, x, y, z, M;
|
||||
return {
|
||||
|
||||
@@ -17,6 +17,7 @@ module M {
|
||||
|
||||
//// [aliasesInSystemModule2.js]
|
||||
System.register(["foo"], function(exports_1) {
|
||||
"use strict";
|
||||
var foo_1;
|
||||
var cls, cls2, x, y, z, M;
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports.Foo = Foo;
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var b_1 = require("./b");
|
||||
exports.x = new b_1["default"].Foo();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Namespace.Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
>Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.ts, 0, 18))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : typeof Namespace
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Namespace.Foo
|
||||
>new Namespace.Foo() : Namespace.Foo
|
||||
>Namespace.Foo : typeof Namespace.Foo
|
||||
>Namespace : typeof Namespace
|
||||
>Foo : typeof Namespace.Foo
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports2.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports_1("Foo", Foo);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"].Foo());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Namespace.Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
>Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.ts, 0, 18))
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : typeof Namespace
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Namespace.Foo
|
||||
>new Namespace.Foo() : Namespace.Foo
|
||||
>Namespace.Foo : typeof Namespace.Foo
|
||||
>Namespace : typeof Namespace
|
||||
>Foo : typeof Namespace.Foo
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/a.ts(1,8): error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
import Namespace from "./b";
|
||||
~~~~~~~~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
==== tests/cases/compiler/b.ts (0 errors) ====
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports3.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports_1("Foo", Foo);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"].Foo());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports4.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var b_1 = require("./b");
|
||||
exports.x = new b_1["default"]();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.d.ts, 0, 19))
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Foo
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports5.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"]());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.d.ts, 0, 19))
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Foo
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/compiler/a.ts(1,8): error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/b.d.ts (0 errors) ====
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
import Foo from "./b";
|
||||
~~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
export var x = new Foo();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports6.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"]());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -27,6 +27,7 @@ var n: number;
|
||||
//// [decls.js]
|
||||
// Ambient external import declaration referencing ambient external module using top level module name
|
||||
//// [consumer.js]
|
||||
"use strict";
|
||||
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
|
||||
var imp3 = require('equ2');
|
||||
var n = imp3.x;
|
||||
|
||||
@@ -13,6 +13,7 @@ var x = ext;
|
||||
|
||||
//// [ambientExternalModuleInAnotherExternalModule.js]
|
||||
define(["require", "exports", "ext"], function (require, exports, ext) {
|
||||
"use strict";
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
|
||||
@@ -3,4 +3,5 @@ export declare module "M" { }
|
||||
|
||||
//// [ambientExternalModuleInsideNonAmbientExternalModule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
@@ -18,6 +18,7 @@ declare module "M" {
|
||||
|
||||
//// [ambientExternalModuleMerging_use.js]
|
||||
define(["require", "exports", "M"], function (require, exports, M) {
|
||||
"use strict";
|
||||
// Should be strings
|
||||
var x = M.x;
|
||||
var y = M.y;
|
||||
|
||||
@@ -21,5 +21,6 @@ var c = new A();
|
||||
//// [ambientExternalModuleWithInternalImportDeclaration_0.js]
|
||||
//// [ambientExternalModuleWithInternalImportDeclaration_1.js]
|
||||
define(["require", "exports", 'M'], function (require, exports, A) {
|
||||
"use strict";
|
||||
var c = new A();
|
||||
});
|
||||
@@ -20,5 +20,6 @@ var c = new A();
|
||||
//// [ambientExternalModuleWithoutInternalImportDeclaration_0.js]
|
||||
//// [ambientExternalModuleWithoutInternalImportDeclaration_1.js]
|
||||
define(["require", "exports", 'M'], function (require, exports, A) {
|
||||
"use strict";
|
||||
var c = new A();
|
||||
});
|
||||
@@ -7,4 +7,5 @@ export declare module M { }
|
||||
|
||||
//// [ambientInsideNonAmbientExternalModule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
@@ -6,5 +6,6 @@ m1.f();
|
||||
|
||||
//// [amdDependencyComment1.js]
|
||||
///<amd-dependency path='bar'/>
|
||||
"use strict";
|
||||
var m1 = require("m2");
|
||||
m1.f();
|
||||
@@ -7,5 +7,6 @@ m1.f();
|
||||
//// [amdDependencyComment2.js]
|
||||
///<amd-dependency path='bar'/>
|
||||
define(["require", "exports", "m2", "bar"], function (require, exports, m1) {
|
||||
"use strict";
|
||||
m1.f();
|
||||
});
|
||||
@@ -6,5 +6,6 @@ m1.f();
|
||||
|
||||
//// [amdDependencyCommentName1.js]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
"use strict";
|
||||
var m1 = require("m2");
|
||||
m1.f();
|
||||
@@ -7,5 +7,6 @@ m1.f();
|
||||
//// [amdDependencyCommentName2.js]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
define(["require", "exports", "bar", "m2"], function (require, exports, b, m1) {
|
||||
"use strict";
|
||||
m1.f();
|
||||
});
|
||||
@@ -11,5 +11,6 @@ m1.f();
|
||||
///<amd-dependency path='foo'/>
|
||||
///<amd-dependency path='goo' name='c'/>
|
||||
define(["require", "exports", "bar", "goo", "m2", "foo"], function (require, exports, b, c, m1) {
|
||||
"use strict";
|
||||
m1.f();
|
||||
});
|
||||
@@ -26,6 +26,7 @@ import "unaliasedModule2";
|
||||
///<amd-dependency path='aliasedModule6' name='n2'/>
|
||||
///<amd-dependency path='unaliasedModule4'/>
|
||||
define(["require", "exports", "aliasedModule5", "aliasedModule6", "aliasedModule1", "aliasedModule2", "aliasedModule3", "aliasedModule4", "unaliasedModule3", "unaliasedModule4", "unaliasedModule1", "unaliasedModule2"], function (require, exports, n1, n2, r1, aliasedModule2_1, aliasedModule3_1, ns) {
|
||||
"use strict";
|
||||
r1;
|
||||
aliasedModule2_1.p1;
|
||||
aliasedModule3_1["default"];
|
||||
|
||||
@@ -14,6 +14,7 @@ if(foo.E1.A === 0){
|
||||
|
||||
//// [foo_0.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
(function (E1) {
|
||||
E1[E1["A"] = 0] = "A";
|
||||
E1[E1["B"] = 1] = "B";
|
||||
@@ -23,6 +24,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
//// [foo_1.js]
|
||||
define(["require", "exports", "./foo_0"], function (require, exports, foo) {
|
||||
"use strict";
|
||||
if (foo.E1.A === 0) {
|
||||
}
|
||||
});
|
||||
@@ -33,6 +33,7 @@ var e: number = <foo.E1>0;
|
||||
|
||||
//// [foo_0.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var C1 = (function () {
|
||||
function C1() {
|
||||
this.m1 = 42;
|
||||
@@ -50,6 +51,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
//// [foo_1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var i;
|
||||
var x = {};
|
||||
var y = false;
|
||||
|
||||
@@ -11,6 +11,7 @@ export = Foo;
|
||||
|
||||
//// [amdModuleName1.js]
|
||||
define("NamedModule", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
///<amd-module name='NamedModule'/>
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
|
||||
@@ -12,6 +12,7 @@ export = Foo;
|
||||
|
||||
//// [amdModuleName2.js]
|
||||
define("SecondModuleName", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
///<amd-module name='FirstModuleName'/>
|
||||
///<amd-module name='SecondModuleName'/>
|
||||
var Foo = (function () {
|
||||
|
||||
@@ -25,6 +25,7 @@ export = Road;
|
||||
|
||||
|
||||
//// [arrayOfExportedClass_0.js]
|
||||
"use strict";
|
||||
var Car = (function () {
|
||||
function Car() {
|
||||
}
|
||||
@@ -32,6 +33,7 @@ var Car = (function () {
|
||||
})();
|
||||
module.exports = Car;
|
||||
//// [arrayOfExportedClass_1.js]
|
||||
"use strict";
|
||||
var Road = (function () {
|
||||
function Road() {
|
||||
}
|
||||
|
||||
@@ -13,9 +13,11 @@ import { foo } from './foo';
|
||||
|
||||
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
function foo() { }
|
||||
exports.foo = foo;
|
||||
//// [bar.js]
|
||||
"use strict";
|
||||
var foo_1 = require('./foo');
|
||||
// These should emit identically
|
||||
foo_1.foo;
|
||||
|
||||
@@ -5,6 +5,7 @@ module c5 { } // should be ok everywhere
|
||||
|
||||
//// [augmentedTypesExternalModule1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.a = 1;
|
||||
var c5 = (function () {
|
||||
function c5() {
|
||||
|
||||
@@ -8,4 +8,5 @@ export declare var a: {
|
||||
|
||||
//// [badExternalModuleReference.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
@@ -20,4 +20,5 @@ import * as http from 'intern/dojo/node!http';
|
||||
//// [a.js]
|
||||
/// <reference path="a.d.ts"/>
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
@@ -145,6 +145,7 @@ for (const y = 0; y < 1;) {
|
||||
|
||||
//// [capturedLetConstInLoop4.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var v0, v00, v1, v2, v3, v4, v5, v6, v7, v8, v0_c, v00_c, v1_c, v2_c, v3_c, v4_c, v5_c, v6_c, v7_c, v8_c;
|
||||
//======let
|
||||
function exportedFoo() {
|
||||
|
||||
@@ -12,12 +12,14 @@ y.m.foo();
|
||||
|
||||
|
||||
//// [chainedImportAlias_file0.js]
|
||||
"use strict";
|
||||
var m;
|
||||
(function (m) {
|
||||
function foo() { }
|
||||
m.foo = foo;
|
||||
})(m = exports.m || (exports.m = {}));
|
||||
//// [chainedImportAlias_file1.js]
|
||||
"use strict";
|
||||
var x = require('./chainedImportAlias_file0');
|
||||
var y = x;
|
||||
y.m.foo();
|
||||
@@ -34,6 +34,7 @@ export module M1 {
|
||||
|
||||
|
||||
//// [foo1.js]
|
||||
"use strict";
|
||||
var foo2 = require('./foo2');
|
||||
var M1;
|
||||
(function (M1) {
|
||||
@@ -48,6 +49,7 @@ var M1;
|
||||
M1.C1 = C1;
|
||||
})(M1 = exports.M1 || (exports.M1 = {}));
|
||||
//// [foo2.js]
|
||||
"use strict";
|
||||
var foo1 = require('./foo1');
|
||||
var M1;
|
||||
(function (M1) {
|
||||
|
||||
@@ -5,6 +5,7 @@ default abstract class C {}
|
||||
import abstract class D {}
|
||||
|
||||
//// [classAbstractManyKeywords.js]
|
||||
"use strict";
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export class Test1 {
|
||||
//// [classMemberInitializerWithLamdaScoping3_0.js]
|
||||
var field1;
|
||||
//// [classMemberInitializerWithLamdaScoping3_1.js]
|
||||
"use strict";
|
||||
var Test1 = (function () {
|
||||
function Test1(field1) {
|
||||
this.field1 = field1;
|
||||
|
||||
@@ -16,7 +16,9 @@ export class Test1 {
|
||||
}
|
||||
|
||||
//// [classMemberInitializerWithLamdaScoping3_0.js]
|
||||
"use strict";
|
||||
//// [classMemberInitializerWithLamdaScoping3_1.js]
|
||||
"use strict";
|
||||
var Test1 = (function () {
|
||||
function Test1(field1) {
|
||||
this.field1 = field1;
|
||||
|
||||
@@ -26,6 +26,7 @@ export = Foo;
|
||||
|
||||
|
||||
//// [clinterfaces.js]
|
||||
"use strict";
|
||||
var M;
|
||||
(function (M) {
|
||||
var C = (function () {
|
||||
|
||||
@@ -19,18 +19,21 @@ export function foo2() {
|
||||
|
||||
//// [collisionExportsRequireAndAlias_file1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function bar() {
|
||||
}
|
||||
exports.bar = bar;
|
||||
});
|
||||
//// [collisionExportsRequireAndAlias_file3333.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function bar2() {
|
||||
}
|
||||
exports.bar2 = bar2;
|
||||
});
|
||||
//// [collisionExportsRequireAndAlias_file2.js]
|
||||
define(["require", "exports", 'collisionExportsRequireAndAlias_file1', 'collisionExportsRequireAndAlias_file3333'], function (require, exports, require, exports) {
|
||||
"use strict";
|
||||
function foo() {
|
||||
require.bar();
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndAmbientClass_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var m2;
|
||||
(function (m2) {
|
||||
})(m2 || (m2 = {}));
|
||||
|
||||
@@ -62,6 +62,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndAmbientEnum_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var m2;
|
||||
(function (m2) {
|
||||
})(m2 || (m2 = {}));
|
||||
|
||||
@@ -15,6 +15,7 @@ module m2 {
|
||||
|
||||
//// [collisionExportsRequireAndAmbientFunction.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var m2;
|
||||
(function (m2) {
|
||||
var a = 10;
|
||||
|
||||
@@ -96,6 +96,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndAmbientModule_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function foo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndAmbientVar_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var m2;
|
||||
(function (m2) {
|
||||
var a = 10;
|
||||
|
||||
@@ -38,6 +38,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndClass_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var require = (function () {
|
||||
function require() {
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndEnum_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
(function (require) {
|
||||
require[require["_thisVal1"] = 0] = "_thisVal1";
|
||||
require[require["_thisVal2"] = 1] = "_thisVal2";
|
||||
|
||||
@@ -24,6 +24,7 @@ module m2 {
|
||||
|
||||
//// [collisionExportsRequireAndFunction.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function exports() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ module m2 {
|
||||
|
||||
//// [collisionExportsRequireAndInternalModuleAlias.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var m;
|
||||
(function (m) {
|
||||
var c = (function () {
|
||||
|
||||
@@ -93,6 +93,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndModule_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var require;
|
||||
(function (require) {
|
||||
var C = (function () {
|
||||
|
||||
@@ -16,6 +16,7 @@ export function foo2(): exports.I {
|
||||
|
||||
//// [collisionExportsRequireAndUninstantiatedModule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function foo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ module m4 {
|
||||
|
||||
//// [collisionExportsRequireAndVar_externalmodule.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function foo() {
|
||||
}
|
||||
exports.foo = foo;
|
||||
|
||||
@@ -7,4 +7,5 @@ import foo = require('./foo');
|
||||
//// [commentOnImportStatement1.js]
|
||||
/* Copyright */
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
@@ -3,3 +3,4 @@
|
||||
import foo = require('./foo');
|
||||
|
||||
//// [commentOnImportStatement2.js]
|
||||
"use strict";
|
||||
@@ -6,3 +6,4 @@ import foo = require('./foo');
|
||||
|
||||
//// [commentOnImportStatement3.js]
|
||||
/* copyright */
|
||||
"use strict";
|
||||
@@ -5,4 +5,5 @@ export var b: number;
|
||||
|
||||
//// [commentsBeforeVariableStatement1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
@@ -9,6 +9,7 @@ export module outerModule.InnerModule {
|
||||
|
||||
//// [commentsDottedModuleName.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
/** this is multi declare module*/
|
||||
var outerModule;
|
||||
(function (outerModule) {
|
||||
|
||||
@@ -63,6 +63,7 @@ var newVar2 = new extMod.m4.m2.c();
|
||||
|
||||
//// [commentsExternalModules_0.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
/** Module comment*/
|
||||
var m1;
|
||||
(function (m1) {
|
||||
@@ -126,6 +127,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
//// [commentsExternalModules_1.js]
|
||||
define(["require", "exports", "commentsExternalModules_0"], function (require, exports, extMod) {
|
||||
"use strict";
|
||||
extMod.m1.fooExport();
|
||||
var newVar = new extMod.m1.m2.c();
|
||||
extMod.m4.fooExport();
|
||||
|
||||
Loaded 100 of 1570 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user