diff --git a/Jakefile.js b/Jakefile.js index 398b897097d..beb16d2886f 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -544,7 +544,8 @@ compileFile(word2mdJs, // The generated spec.md; built for the 'generate-spec' task file(specMd, [word2mdJs, specWord], function () { var specWordFullPath = path.resolve(specWord); - var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" ' + specMd; + var specMDFullPath = path.resolve(specMd); + var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" ' + '"' + specMDFullPath + '"'; console.log(cmd); child_process.exec(cmd, function () { complete(); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 30d4818592b..50a3aee9955 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15017,6 +15017,35 @@ namespace ts { return getReferencedValueSymbol(node) === argumentsSymbol; } + function moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean { + let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol) { + // module not found - be conservative + return true; + } + + const hasExportAssignment = getExportAssignmentSymbol(moduleSymbol) !== undefined; + // if module has export assignment then 'resolveExternalModuleSymbol' will return resolved symbol for export assignment + // otherwise it will return moduleSymbol itself + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + + const symbolLinks = getSymbolLinks(moduleSymbol); + if (symbolLinks.exportsSomeValue === undefined) { + // for export assignments - check if resolved symbol for RHS is itself a value + // otherwise - check if at least one export is value + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & SymbolFlags.Value) + : forEachValue(getExportsOfModule(moduleSymbol), isValue); + } + + return symbolLinks.exportsSomeValue; + + function isValue(s: Symbol): boolean { + s = resolveSymbol(s); + return s && !!(s.flags & SymbolFlags.Value); + } + } + // When resolved as an expression identifier, if the given node references an exported entity, return the declaration // node of the exported entity's container. Otherwise, return undefined. function getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration { @@ -15322,6 +15351,7 @@ namespace ts { getReferencedValueDeclaration, getTypeReferenceSerializationKind, isOptionalParameter, + moduleExportsSomeValue, isArgumentsLocalBinding, getExternalModuleFileFromDeclaration }; @@ -15969,6 +15999,13 @@ namespace ts { return grammarErrorOnNode((prop).equalsToken, Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } + // Modifiers are never allowed on properties except for 'async' on a method declaration + forEach(prop.modifiers, mod => { + if (mod.kind !== SyntaxKind.AsyncKeyword || prop.kind !== SyntaxKind.MethodDeclaration) { + grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); + } + }); + // ECMA-262 11.1.5 Object Initialiser // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fb62143ca5e..09f08e50ebe 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -435,7 +435,7 @@ "category": "Error", "code": 1147 }, - "Cannot compile modules unless the '--module' flag is provided.": { + "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": { "category": "Error", "code": 1148 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index dcfce6a2c81..a73d7374b59 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -499,7 +499,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; let exportSpecifiers: Map; let exportEquals: ExportAssignment; - let hasExportStars: boolean; + let hasExportStarsToExportValues: boolean; let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[]; @@ -574,7 +574,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = undefined; + hasExportStarsToExportValues = undefined; detachedCommentsInfo = undefined; sourceMapData = undefined; isEs6Module = false; @@ -1453,6 +1453,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: case SyntaxKind.IfStatement: + case SyntaxKind.JsxClosingElement: case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.JsxOpeningElement: case SyntaxKind.JsxSpreadAttribute: @@ -6230,15 +6231,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { // export * from "foo" - writeLine(); - write("__export("); - if (modulekind !== ModuleKind.AMD) { - emitRequire(getExternalModuleName(node)); + if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + writeLine(); + write("__export("); + if (modulekind !== ModuleKind.AMD) { + emitRequire(getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); } - else { - write(generatedName); - } - write(");"); } emitEnd(node); } @@ -6326,7 +6329,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = []; exportSpecifiers = {}; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; for (const node of sourceFile.statements) { switch (node.kind) { case SyntaxKind.ImportDeclaration: @@ -6349,8 +6352,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if ((node).moduleSpecifier) { if (!(node).exportClause) { // export * from "mod" - externalImports.push(node); - hasExportStars = true; + if (resolver.moduleExportsSomeValue((node).moduleSpecifier)) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } } else if (resolver.isValueAliasDeclaration(node)) { // export { x, y } from "mod" where at least one export is a value symbol @@ -6376,7 +6381,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitExportStarHelper() { - if (hasExportStars) { + if (hasExportStarsToExportValues) { writeLine(); write("function __export(m) {"); increaseIndent(); @@ -6454,7 +6459,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // should always win over entries with similar names that were added via star exports // to support this we store names of local/indirect exported entries in a set. // this set is used to filter names brought by star expors. - if (!hasExportStars) { + if (!hasExportStarsToExportValues) { // local names set is needed only in presence of star exports return undefined; } @@ -6879,6 +6884,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("});"); } else { + // collectExternalModuleInfo prefilters star exports to keep only ones that export values + // this means that check 'resolver.moduleExportsSomeValue' is redundant and can be omitted here writeLine(); // export * from 'foo' // emit as: @@ -7147,7 +7154,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); @@ -7371,7 +7378,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index e4262458d30..f5273e38ecf 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3639,7 +3639,7 @@ namespace ts { parseExpected(SyntaxKind.OpenBraceToken); if (token !== SyntaxKind.CloseBraceToken) { - node.expression = parseExpression(); + node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { parseExpected(SyntaxKind.CloseBraceToken); @@ -3981,6 +3981,7 @@ namespace ts { } else { const propertyAssignment = createNode(SyntaxKind.PropertyAssignment, fullStart); + propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(SyntaxKind.ColonToken); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 36a0db6325b..021f68837b9 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1649,7 +1649,7 @@ namespace ts { else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet const span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); } // Cannot specify module gen target of es6 when below es6 diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2389277d919..57e324daa41 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1887,6 +1887,7 @@ namespace ts { getReferencedValueDeclaration(reference: Identifier): Declaration; getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind; isOptionalParameter(node: ParameterDeclaration): boolean; + moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; isArgumentsLocalBinding(node: Identifier): boolean; getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): SourceFile; } @@ -2005,6 +2006,7 @@ namespace ts { exportsChecked?: boolean; // True if exports of external module have been checked isNestedRedeclaration?: boolean; // True if symbol is block scoped redeclaration bindingElement?: BindingElement; // Binding element associated with property symbol + exportsSomeValue?: boolean; // true if module exports some value (not just types) } /* @internal */ diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 5984505c4cf..0dff2cedc39 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -6923,7 +6923,7 @@ interface IDBDatabase extends EventTarget { onerror: (ev: Event) => any; version: string; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6948,10 +6948,11 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; + keyPath: string | string[]; name: string; objectStore: IDBObjectStore; unique: boolean; + multiEntry: boolean; count(key?: any): IDBRequest; get(key: any): IDBRequest; getKey(key: any): IDBRequest; @@ -6988,7 +6989,7 @@ interface IDBObjectStore { add(value: any, key?: any): IDBRequest; clear(): IDBRequest; count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; delete(key: any): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; @@ -12575,6 +12576,16 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface IDBObjectStoreParameters { + keyPath?: string | string[]; + autoIncrement?: boolean; +} + +interface IDBIndexParameters { + unique?: boolean; + multiEntry?: boolean; +} + interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -12610,6 +12621,15 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface HTMLTemplateElement extends HTMLElement { + content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index 8001511a98b..a1d87f79787 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -311,7 +311,7 @@ interface IDBDatabase extends EventTarget { onerror: (ev: Event) => any; version: string; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -336,10 +336,11 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; + keyPath: string | string[]; name: string; objectStore: IDBObjectStore; unique: boolean; + multiEntry: boolean; count(key?: any): IDBRequest; get(key: any): IDBRequest; getKey(key: any): IDBRequest; @@ -376,7 +377,7 @@ interface IDBObjectStore { add(value: any, key?: any): IDBRequest; clear(): IDBRequest; count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; delete(key: any): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; @@ -892,6 +893,16 @@ interface WorkerUtils extends Object, WindowBase64 { setTimeout(handler: any, timeout?: any, ...args: any[]): number; } +interface IDBObjectStoreParameters { + keyPath?: string | string[]; + autoIncrement?: boolean; +} + +interface IDBIndexParameters { + unique?: boolean; + multiEntry?: boolean; +} + interface BlobPropertyBag { type?: string; endings?: string; diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 651105e9d5c..55adb7b7233 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -31,8 +31,8 @@ namespace ts.formatting { * the first token in line so it should be indented */ interface DynamicIndentation { - getIndentationForToken(tokenLine: number, tokenKind: SyntaxKind): number; - getIndentationForComment(owningToken: SyntaxKind, tokenIndentation: number): number; + getIndentationForToken(tokenLine: number, tokenKind: SyntaxKind, container: Node): number; + getIndentationForComment(owningToken: SyntaxKind, tokenIndentation: number, container: Node): number; /** * Indentation for open and close tokens of the node if it is block or another node that needs special indentation * ... { @@ -54,7 +54,7 @@ namespace ts.formatting { * so bar inherits indentation from foo and bar.delta will be 4 * */ - getDelta(): number; + getDelta(child: TextRangeWithKind): number; /** * Formatter calls this function when rule adds or deletes new lines from the text * so indentation scope can adjust values of indentation and delta. @@ -282,19 +282,19 @@ namespace ts.formatting { */ function getOwnOrInheritedDelta(n: Node, options: FormatCodeOptions, sourceFile: SourceFile): number { let previousLine = Constants.Unknown; - let childKind = SyntaxKind.Unknown; + let child: Node; while (n) { let line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } - if (SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + if (SmartIndenter.shouldIndentChildNode(n, child)) { return options.IndentSize; } previousLine = line; - childKind = n.kind; + child = n; n = n.parent; } return 0; @@ -386,34 +386,7 @@ namespace ts.formatting { effectiveParentStartLine: number): Indentation { let indentation = inheritedIndentation; - if (indentation === Constants.Unknown) { - if (isSomeBlock(node.kind)) { - // blocks should be indented in - // - other blocks - // - source file - // - switch\default clauses - if (isSomeBlock(parent.kind) || - parent.kind === SyntaxKind.SourceFile || - parent.kind === SyntaxKind.CaseClause || - parent.kind === SyntaxKind.DefaultClause) { - - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - else { - indentation = parentDynamicIndentation.getIndentation(); - } - } - else { - if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - indentation = parentDynamicIndentation.getIndentation(); - } - else { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - } - } - - var delta = SmartIndenter.shouldIndentChildNode(node.kind, SyntaxKind.Unknown) ? options.IndentSize : 0; + var delta = SmartIndenter.shouldIndentChildNode(node) ? options.IndentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent @@ -422,8 +395,17 @@ namespace ts.formatting { indentation = startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(); - delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); } + else if (indentation === Constants.Unknown) { + if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node); + } + } + return { indentation, delta @@ -455,7 +437,7 @@ namespace ts.formatting { function getDynamicIndentation(node: Node, nodeStartLine: number, indentation: number, delta: number): DynamicIndentation { return { - getIndentationForComment: (kind, tokenIndentation) => { + getIndentationForComment: (kind, tokenIndentation, container) => { switch (kind) { // preceding comment to the token that closes the indentation scope inherits the indentation from the scope // .. { @@ -464,11 +446,11 @@ namespace ts.formatting { case SyntaxKind.CloseBraceToken: case SyntaxKind.CloseBracketToken: case SyntaxKind.CloseParenToken: - return indentation + delta; + return indentation + getEffectiveDelta(delta, container); } return tokenIndentation !== Constants.Unknown ? tokenIndentation : indentation; }, - getIndentationForToken: (line, kind) => { + getIndentationForToken: (line, kind, container) => { if (nodeStartLine !== line && node.decorators) { if (kind === getFirstNonDecoratorTokenOfNode(node)) { // if this token is the first token following the list of decorators, we do not need to indent @@ -489,13 +471,13 @@ namespace ts.formatting { return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + delta : indentation; + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; } }, getIndentation: () => indentation, - getDelta: () => delta, + getDelta: child => getEffectiveDelta(delta, child), recomputeIndentation: lineAdded => { - if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { indentation += options.IndentSize; } @@ -503,14 +485,19 @@ namespace ts.formatting { indentation -= options.IndentSize; } - if (SmartIndenter.shouldIndentChildNode(node.kind, SyntaxKind.Unknown)) { + if (SmartIndenter.shouldIndentChildNode(node)) { delta = options.IndentSize; } else { delta = 0; } } - }, + } + } + + function getEffectiveDelta(delta: number, child: TextRangeWithKind) { + // Delta value should be zero when the node explicitly prevents indentation of the child node + return SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; } } @@ -610,7 +597,7 @@ namespace ts.formatting { // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules let tokenInfo = formattingScanner.readTokenInfo(child); Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } @@ -679,7 +666,7 @@ namespace ts.formatting { } } - function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation): void { + function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation, container?: Node): void { Debug.assert(rangeContainsRange(parent, currentTokenInfo.token)); let lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); @@ -720,11 +707,11 @@ namespace ts.formatting { if (indentToken) { let tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : Constants.Unknown; if (currentTokenInfo.leadingTrivia) { - let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); + let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); let indentNextTokenOrTrivia = true; for (let triviaItem of currentTokenInfo.leadingTrivia) { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 12efb774dd3..de4761f57d2 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -123,6 +123,7 @@ namespace ts.formatting { public SpaceAfterModuleName: Rule; // Lambda expressions + public SpaceBeforeArrow: Rule; public SpaceAfterArrow: Rule; // Optional parameters and let args @@ -254,7 +255,7 @@ namespace ts.formatting { // No space before and after indexer this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext ), RuleAction.Delete)); + this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments; @@ -342,6 +343,7 @@ namespace ts.formatting { this.SpaceAfterModuleName = new Rule(RuleDescriptor.create1(SyntaxKind.StringLiteral, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsModuleDeclContext), RuleAction.Space)); // Lambda expressions + this.SpaceBeforeArrow = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsGreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); this.SpaceAfterArrow = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsGreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); // Optional parameters and let args @@ -379,8 +381,7 @@ namespace ts.formatting { this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); // These rules are higher in priority than user-configurable rules. - this.HighPriorityCommonRules = - [ + this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, this.NoSpaceAfterQuestionMark, @@ -411,7 +412,7 @@ namespace ts.formatting { this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, - this.SpaceAfterArrow, + this.SpaceBeforeArrow, this.SpaceAfterArrow, this.NoSpaceAfterEllipsis, this.NoSpaceAfterOptionalParameters, this.NoSpaceBetweenEmptyInterfaceBraceBrackets, @@ -427,8 +428,7 @@ namespace ts.formatting { ]; // These rules are lower in priority than user-configurable rules. - this.LowPriorityCommonRules = - [ + this.LowPriorityCommonRules = [ this.NoSpaceBeforeSemicolon, this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, @@ -732,7 +732,7 @@ namespace ts.formatting { } static IsStartOfVariableDeclarationList(context: FormattingContext): boolean { - return context.currentTokenParent.kind === SyntaxKind.VariableDeclarationList && + return context.currentTokenParent.kind === SyntaxKind.VariableDeclarationList && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index bc02f6d6f32..067118fd7a8 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -68,7 +68,7 @@ namespace ts.formatting { let indentationDelta: number; while (current) { - if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : SyntaxKind.Unknown)) { + if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { @@ -153,7 +153,7 @@ namespace ts.formatting { } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } @@ -466,12 +466,10 @@ namespace ts.formatting { } return false; } - - export function shouldIndentChildNode(parent: SyntaxKind, child: SyntaxKind): boolean { - if (nodeContentIsAlwaysIndented(parent)) { - return true; - } - switch (parent) { + + export function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean) { + let childKind = child ? child.kind : SyntaxKind.Unknown; + switch (parent.kind) { case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: case SyntaxKind.ForInStatement: @@ -485,10 +483,17 @@ namespace ts.formatting { case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - return child !== SyntaxKind.Block; - default: - return false; + return childKind !== SyntaxKind.Block; } + // No explicit rule for given nodes so the result will follow the default value argument + return indentByDefault; + } + + /* + Function returns true when the parent node should indent the given child by an explicit rule + */ + export function shouldIndentChildNode(parent: TextRangeWithKind, child?: TextRangeWithKind): boolean { + return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); } } } diff --git a/src/services/services.ts b/src/services/services.ts index 4e0a0265b91..a9dda549ead 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3751,7 +3751,8 @@ namespace ts { // Ignore omitted expressions for missing members if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment && - m.kind !== SyntaxKind.BindingElement) { + m.kind !== SyntaxKind.BindingElement && + m.kind !== SyntaxKind.MethodDeclaration) { continue; } diff --git a/tests/baselines/reference/ExportAssignment7.errors.txt b/tests/baselines/reference/ExportAssignment7.errors.txt index 83651e10b8e..fe461785c63 100644 --- a/tests/baselines/reference/ExportAssignment7.errors.txt +++ b/tests/baselines/reference/ExportAssignment7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name ==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ==== export class C { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } export = B; diff --git a/tests/baselines/reference/ExportAssignment8.errors.txt b/tests/baselines/reference/ExportAssignment8.errors.txt index d1a285cfe51..22e32c9c7d0 100644 --- a/tests/baselines/reference/ExportAssignment8.errors.txt +++ b/tests/baselines/reference/ExportAssignment8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name ==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ==== export = B; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~ diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt index fefdcd8f6f5..e46805a6a2f 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'. @@ -7,7 +7,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error ==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ==== export module A { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export interface Point { x: number; y: number; diff --git a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt index d05dfe813fd..2a9b1fe4879 100644 --- a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt +++ b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/ambient/consumer.ts (1 errors) ==== /// import imp1 = require('equ'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. // Ambient external module members are always exported with or without export keyword when module lacks export assignment diff --git a/tests/baselines/reference/circularReference.errors.txt b/tests/baselines/reference/circularReference.errors.txt index 5e0a6208a1e..9954944ff1f 100644 --- a/tests/baselines/reference/circularReference.errors.txt +++ b/tests/baselines/reference/circularReference.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo1.ts(9,12): error TS2339: Property 'x' does not exist on type 'C1'. tests/cases/conformance/externalModules/foo2.ts(8,12): error TS2339: Property 'y' does not exist on type 'C1'. tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x' does not exist on type 'C1'. @@ -29,7 +29,7 @@ tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x ==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ==== import foo2 = require('./foo2'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export module M1 { export class C1 { m1: foo2.M1.C1; diff --git a/tests/baselines/reference/classAbstractManyKeywords.errors.txt b/tests/baselines/reference/classAbstractManyKeywords.errors.txt index b200404eaf0..eec5ac4bc0d 100644 --- a/tests/baselines/reference/classAbstractManyKeywords.errors.txt +++ b/tests/baselines/reference/classAbstractManyKeywords.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,25): error TS1005: ';' expected. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(3,1): error TS1128: Declaration or statement expected. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(4,17): error TS1005: '=' expected. @@ -7,7 +7,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst ==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts (4 errors) ==== export default abstract class A {} ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~ !!! error TS1005: ';' expected. export abstract class B {} diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt index 47adb957141..b016952a3aa 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. @@ -11,7 +11,7 @@ tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error T }; export class Test1 { ~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. constructor(private field1: string) { } messageHandler = () => { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt index 9d1a2dd3418..73fa862e82b 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'. ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (1 errors) ==== export var field1: string; ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ==== declare var console: { diff --git a/tests/baselines/reference/duplicateExportAssignments.errors.txt b/tests/baselines/reference/duplicateExportAssignments.errors.txt index 47a97f9d8af..a76513133b9 100644 --- a/tests/baselines/reference/duplicateExportAssignments.errors.txt +++ b/tests/baselines/reference/duplicateExportAssignments.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2300: Duplicate identifier 'export='. tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2300: Duplicate identifier 'export='. tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2300: Duplicate identifier 'export='. @@ -17,7 +17,7 @@ tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate id var y = 20; export = x; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'export='. export = y; diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index bd6d535d88e..0a49c71e29b 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(2,4): error TS1005: ';' expected. tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected. tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'. -tests/cases/compiler/duplicateLocalVariable1.ts(12,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/duplicateLocalVariable1.ts(12,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. @@ -25,7 +25,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequen export class TestCase { ~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) { } } diff --git a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt index faf27a85206..90f10087194 100644 --- a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt +++ b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts (1 errors) ==== export class A ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. { constructor () { diff --git a/tests/baselines/reference/es6ExportEqualsInterop.js b/tests/baselines/reference/es6ExportEqualsInterop.js index 3d9c1c95fcd..1ad4222d222 100644 --- a/tests/baselines/reference/es6ExportEqualsInterop.js +++ b/tests/baselines/reference/es6ExportEqualsInterop.js @@ -290,7 +290,6 @@ exports.a8 = function_module_2.a; var class_module_2 = require("class-module"); exports.a0 = class_module_2.a; // export-star -__export(require("interface")); __export(require("variable")); __export(require("interface-variable")); __export(require("module")); diff --git a/tests/baselines/reference/exportAssignDottedName.errors.txt b/tests/baselines/reference/exportAssignDottedName.errors.txt index 39a0a2577ee..3ed4f3c888f 100644 --- a/tests/baselines/reference/exportAssignDottedName.errors.txt +++ b/tests/baselines/reference/exportAssignDottedName.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot comp ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== export function x(){ ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. return true; } \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt index 753bc567619..167c0baca3d 100644 --- a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo3.ts (0 errors) ==== @@ -7,7 +7,7 @@ tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot comp ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== export function x(){ ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. return true; } diff --git a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt index c3d58c9b36f..9e8bfa8d747 100644 --- a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression expected. @@ -6,7 +6,7 @@ tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression var x = 10; export = typeof x; // Ok ~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== export = "sausages"; // Ok diff --git a/tests/baselines/reference/exportAssignTypes.errors.txt b/tests/baselines/reference/exportAssignTypes.errors.txt index ba5538777c5..9d39f48fec8 100644 --- a/tests/baselines/reference/exportAssignTypes.errors.txt +++ b/tests/baselines/reference/exportAssignTypes.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/consumer.ts (0 errors) ==== @@ -27,7 +27,7 @@ tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot var x = "test"; export = x; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/expNumber.ts (0 errors) ==== var x = 42; diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index 4a1ee9b739f..39c8123a1e7 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -53,7 +53,7 @@ var Bbb; return SomeType; })(); Bbb.SomeType = SomeType; - __export(require()); // this line causes the nullref + // this line causes the nullref })(Bbb || (Bbb = {})); var a; diff --git a/tests/baselines/reference/exportDeclaredModule.errors.txt b/tests/baselines/reference/exportDeclaredModule.errors.txt index 47ee543e0c0..c235d4c448f 100644 --- a/tests/baselines/reference/exportDeclaredModule.errors.txt +++ b/tests/baselines/reference/exportDeclaredModule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== @@ -12,5 +12,5 @@ tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compi } export = M1; ~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. \ No newline at end of file diff --git a/tests/baselines/reference/exportNonVisibleType.errors.txt b/tests/baselines/reference/exportNonVisibleType.errors.txt index 04c174b4994..bc4dac4ca58 100644 --- a/tests/baselines/reference/exportNonVisibleType.errors.txt +++ b/tests/baselines/reference/exportNonVisibleType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compi var x: I1 = {a: "test", b: 42}; export = x; // Should fail, I1 not exported. ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== diff --git a/tests/baselines/reference/exportStarForValues.js b/tests/baselines/reference/exportStarForValues.js new file mode 100644 index 00000000000..dd432ecc1d3 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/exportStarForValues.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +var x; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x; +}); diff --git a/tests/baselines/reference/exportStarForValues.symbols b/tests/baselines/reference/exportStarForValues.symbols new file mode 100644 index 00000000000..6694afecdc6 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x; +>x : Symbol(x, Decl(file2.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValues.types b/tests/baselines/reference/exportStarForValues.types new file mode 100644 index 00000000000..b326a7e7ff6 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x; +>x : any + diff --git a/tests/baselines/reference/exportStarForValues10.js b/tests/baselines/reference/exportStarForValues10.js new file mode 100644 index 00000000000..dca5dad9b7a --- /dev/null +++ b/tests/baselines/reference/exportStarForValues10.js @@ -0,0 +1,55 @@ +//// [tests/cases/compiler/exportStarForValues10.ts] //// + +//// [file0.ts] + +export var v = 1; + +//// [file1.ts] +export interface Foo { x } + +//// [file2.ts] +export * from "file0"; +export * from "file1"; +var x = 1; + +//// [file0.js] +System.register([], function(exports_1) { + "use strict"; + var v; + return { + setters:[], + execute: function() { + exports_1("v", v = 1); + } + } +}); +//// [file1.js] +System.register([], function(exports_1) { + "use strict"; + return { + setters:[], + execute: function() { + } + } +}); +//// [file2.js] +System.register(["file0"], function(exports_1) { + "use strict"; + var x; + function exportStar_1(m) { + var exports = {}; + for(var n in m) { + if (n !== "default") exports[n] = m[n]; + } + exports_1(exports); + } + return { + setters:[ + function (file0_1_1) { + exportStar_1(file0_1_1); + }], + execute: function() { + x = 1; + } + } +}); diff --git a/tests/baselines/reference/exportStarForValues10.symbols b/tests/baselines/reference/exportStarForValues10.symbols new file mode 100644 index 00000000000..2de35864d27 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues10.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file0.ts === + +export var v = 1; +>v : Symbol(v, Decl(file0.ts, 1, 10)) + +=== tests/cases/compiler/file1.ts === +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 0, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file0"; +export * from "file1"; +var x = 1; +>x : Symbol(x, Decl(file2.ts, 2, 3)) + diff --git a/tests/baselines/reference/exportStarForValues10.types b/tests/baselines/reference/exportStarForValues10.types new file mode 100644 index 00000000000..370f02318c1 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues10.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file0.ts === + +export var v = 1; +>v : number +>1 : number + +=== tests/cases/compiler/file1.ts === +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file0"; +export * from "file1"; +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues2.js b/tests/baselines/reference/exportStarForValues2.js new file mode 100644 index 00000000000..e45d5bdd3ba --- /dev/null +++ b/tests/baselines/reference/exportStarForValues2.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/exportStarForValues2.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +var x = 1; + +//// [file3.ts] +export * from "file2" +var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues2.symbols b/tests/baselines/reference/exportStarForValues2.symbols new file mode 100644 index 00000000000..0fa739f5431 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues2.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 3)) + +=== tests/cases/compiler/file3.ts === +export * from "file2" +var x = 1; +>x : Symbol(x, Decl(file3.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValues2.types b/tests/baselines/reference/exportStarForValues2.types new file mode 100644 index 00000000000..f1de53bd7cf --- /dev/null +++ b/tests/baselines/reference/exportStarForValues2.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export * from "file2" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues3.js b/tests/baselines/reference/exportStarForValues3.js new file mode 100644 index 00000000000..9efe5ccf8e5 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues3.js @@ -0,0 +1,50 @@ +//// [tests/cases/compiler/exportStarForValues3.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file1" +var x = 1; + +//// [file4.ts] +export interface C { x } +export * from "file2" +export * from "file3" +var x = 1; + +//// [file5.ts] +export * from "file4" +var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); +//// [file4.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); +//// [file5.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues3.symbols b/tests/baselines/reference/exportStarForValues3.symbols new file mode 100644 index 00000000000..a79aeb36588 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues3.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 2, 3)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 3)) + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : Symbol(C, Decl(file4.ts, 0, 0)) +>x : Symbol(x, Decl(file4.ts, 0, 20)) + +export * from "file2" +export * from "file3" +var x = 1; +>x : Symbol(x, Decl(file4.ts, 3, 3)) + +=== tests/cases/compiler/file5.ts === +export * from "file4" +var x = 1; +>x : Symbol(x, Decl(file5.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValues3.types b/tests/baselines/reference/exportStarForValues3.types new file mode 100644 index 00000000000..d2ee5ebb1d4 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues3.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file1" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : C +>x : any + +export * from "file2" +export * from "file3" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file5.ts === +export * from "file4" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues4.js b/tests/baselines/reference/exportStarForValues4.js new file mode 100644 index 00000000000..34b13bb00f3 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues4.js @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/exportStarForValues4.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +export * from "file3" +var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file2" +var x = 1; + + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues4.symbols b/tests/baselines/reference/exportStarForValues4.symbols new file mode 100644 index 00000000000..465d6ed3237 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues4.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +export * from "file3" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 3, 3)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file2" +var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 3)) + diff --git a/tests/baselines/reference/exportStarForValues4.types b/tests/baselines/reference/exportStarForValues4.types new file mode 100644 index 00000000000..b381f9461e8 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues4.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +export * from "file3" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file2" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues5.js b/tests/baselines/reference/exportStarForValues5.js new file mode 100644 index 00000000000..dc4d4c8b68e --- /dev/null +++ b/tests/baselines/reference/exportStarForValues5.js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/exportStarForValues5.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +export var x; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); diff --git a/tests/baselines/reference/exportStarForValues5.symbols b/tests/baselines/reference/exportStarForValues5.symbols new file mode 100644 index 00000000000..a2950afa73f --- /dev/null +++ b/tests/baselines/reference/exportStarForValues5.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x; +>x : Symbol(x, Decl(file2.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues5.types b/tests/baselines/reference/exportStarForValues5.types new file mode 100644 index 00000000000..9edfc88289a --- /dev/null +++ b/tests/baselines/reference/exportStarForValues5.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x; +>x : any + diff --git a/tests/baselines/reference/exportStarForValues6.js b/tests/baselines/reference/exportStarForValues6.js new file mode 100644 index 00000000000..69357d87ee0 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues6.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/exportStarForValues6.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +export var x = 1; + +//// [file1.js] +System.register([], function(exports_1) { + "use strict"; + return { + setters:[], + execute: function() { + } + } +}); +//// [file2.js] +System.register([], function(exports_1) { + "use strict"; + var x; + return { + setters:[], + execute: function() { + exports_1("x", x = 1); + } + } +}); diff --git a/tests/baselines/reference/exportStarForValues6.symbols b/tests/baselines/reference/exportStarForValues6.symbols new file mode 100644 index 00000000000..c57baf301dd --- /dev/null +++ b/tests/baselines/reference/exportStarForValues6.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues6.types b/tests/baselines/reference/exportStarForValues6.types new file mode 100644 index 00000000000..4fe38a45d02 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues6.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues7.js b/tests/baselines/reference/exportStarForValues7.js new file mode 100644 index 00000000000..39a152fdc89 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues7.js @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/exportStarForValues7.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +export var x = 1; + +//// [file3.ts] +export * from "file2" +export var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [file3.js] +define(["require", "exports", "file2"], function (require, exports, file2_1) { + "use strict"; + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file2_1); + exports.x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues7.symbols b/tests/baselines/reference/exportStarForValues7.symbols new file mode 100644 index 00000000000..b59f2890047 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues7.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 10)) + +=== tests/cases/compiler/file3.ts === +export * from "file2" +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues7.types b/tests/baselines/reference/exportStarForValues7.types new file mode 100644 index 00000000000..d37661320d6 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues7.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export * from "file2" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues8.js b/tests/baselines/reference/exportStarForValues8.js new file mode 100644 index 00000000000..f8e7678a40c --- /dev/null +++ b/tests/baselines/reference/exportStarForValues8.js @@ -0,0 +1,59 @@ +//// [tests/cases/compiler/exportStarForValues8.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +export var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file1" +export var x = 1; + +//// [file4.ts] +export interface C { x } +export * from "file2" +export * from "file3" +export var x = 1; + +//// [file5.ts] +export * from "file4" +export var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [file4.js] +define(["require", "exports", "file2", "file3"], function (require, exports, file2_1, file3_1) { + "use strict"; + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file2_1); + __export(file3_1); + exports.x = 1; +}); +//// [file5.js] +define(["require", "exports", "file4"], function (require, exports, file4_1) { + "use strict"; + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file4_1); + exports.x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues8.symbols b/tests/baselines/reference/exportStarForValues8.symbols new file mode 100644 index 00000000000..be958ecabe8 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues8.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 2, 10)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 10)) + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : Symbol(C, Decl(file4.ts, 0, 0)) +>x : Symbol(x, Decl(file4.ts, 0, 20)) + +export * from "file2" +export * from "file3" +export var x = 1; +>x : Symbol(x, Decl(file4.ts, 3, 10)) + +=== tests/cases/compiler/file5.ts === +export * from "file4" +export var x = 1; +>x : Symbol(x, Decl(file5.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues8.types b/tests/baselines/reference/exportStarForValues8.types new file mode 100644 index 00000000000..9cc1484eecb --- /dev/null +++ b/tests/baselines/reference/exportStarForValues8.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file1" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : C +>x : any + +export * from "file2" +export * from "file3" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file5.ts === +export * from "file4" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues9.js b/tests/baselines/reference/exportStarForValues9.js new file mode 100644 index 00000000000..e057e4d4027 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues9.js @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/exportStarForValues9.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +export * from "file3" +export var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file2" +export var x = 1; + + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file3.js] +define(["require", "exports", "file2"], function (require, exports, file2_1) { + "use strict"; + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file2_1); + exports.x = 1; +}); +//// [file2.js] +define(["require", "exports", "file3"], function (require, exports, file3_1) { + "use strict"; + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file3_1); + exports.x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues9.symbols b/tests/baselines/reference/exportStarForValues9.symbols new file mode 100644 index 00000000000..0684c9e7b7c --- /dev/null +++ b/tests/baselines/reference/exportStarForValues9.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +export * from "file3" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 3, 10)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file2" +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 10)) + diff --git a/tests/baselines/reference/exportStarForValues9.types b/tests/baselines/reference/exportStarForValues9.types new file mode 100644 index 00000000000..3cf250ec50b --- /dev/null +++ b/tests/baselines/reference/exportStarForValues9.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +export * from "file3" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file2" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValuesInSystem.js b/tests/baselines/reference/exportStarForValuesInSystem.js new file mode 100644 index 00000000000..a33465f7e2e --- /dev/null +++ b/tests/baselines/reference/exportStarForValuesInSystem.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/exportStarForValuesInSystem.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +var x = 1; + +//// [file1.js] +System.register([], function(exports_1) { + "use strict"; + return { + setters:[], + execute: function() { + } + } +}); +//// [file2.js] +System.register([], function(exports_1) { + "use strict"; + var x; + return { + setters:[], + execute: function() { + x = 1; + } + } +}); diff --git a/tests/baselines/reference/exportStarForValuesInSystem.symbols b/tests/baselines/reference/exportStarForValuesInSystem.symbols new file mode 100644 index 00000000000..c9ef9830c60 --- /dev/null +++ b/tests/baselines/reference/exportStarForValuesInSystem.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValuesInSystem.types b/tests/baselines/reference/exportStarForValuesInSystem.types new file mode 100644 index 00000000000..36d07741e10 --- /dev/null +++ b/tests/baselines/reference/exportStarForValuesInSystem.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt index 64874c767ee..e2ffd4ec372 100644 --- a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt +++ b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts (1 errors) ==== @@ -6,5 +6,5 @@ tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: // Not on line 0 because we want to verify the error is placed in the appropriate location. export module M { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/genericArrayExtenstions.errors.txt b/tests/baselines/reference/genericArrayExtenstions.errors.txt index f3035497910..7b332366fed 100644 --- a/tests/baselines/reference/genericArrayExtenstions.errors.txt +++ b/tests/baselines/reference/genericArrayExtenstions.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS2420: Class 'ObservableArray' incorrectly implements interface 'T[]'. Property 'length' is missing in type 'ObservableArray'. @@ -6,7 +6,7 @@ tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS2420: Class 'Obse ==== tests/cases/compiler/genericArrayExtenstions.ts (2 errors) ==== export declare class ObservableArray implements Array { // MS.Entertainment.ObservableArray ~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~~~~~ !!! error TS2420: Class 'ObservableArray' incorrectly implements interface 'T[]'. !!! error TS2420: Property 'length' is missing in type 'ObservableArray'. diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt index d12854648e5..56d1549f853 100644 --- a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt +++ b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts (0 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts( ==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts (1 errors) ==== export module m { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export function foo() { } } \ No newline at end of file diff --git a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt index 74f532d0c1e..34cfe02305f 100644 --- a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt +++ b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,20): error TS2307: Cannot find module 'externalModule'. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): error TS2307: Cannot find module 'externalModule'. @@ -7,7 +7,7 @@ tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): er ==== tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts (4 errors) ==== import b = require("externalModule"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'externalModule'. declare module "m1" { diff --git a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt index 13991aea7f7..9e3d012aeb6 100644 --- a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2305: Module 'x' has no exported member 'c'. @@ -10,7 +10,7 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2305: Modul } declare export import a = x.c; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~ !!! error TS1029: 'export' modifier must precede 'declare' modifier. ~ diff --git a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt index 3be5f99823a..7e67c6325e0 100644 --- a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt @@ -1,5 +1,5 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file. @@ -7,6 +7,6 @@ tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .t ==== tests/cases/compiler/a.js (2 errors) ==== export = b; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS8003: 'export=' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/jsxParsingError1.errors.txt b/tests/baselines/reference/jsxParsingError1.errors.txt new file mode 100644 index 00000000000..e769947dfa6 --- /dev/null +++ b/tests/baselines/reference/jsxParsingError1.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/jsx/file.tsx(12,36): error TS1005: '}' expected. +tests/cases/conformance/jsx/file.tsx(12,44): error TS1003: Identifier expected. +tests/cases/conformance/jsx/file.tsx(12,46): error TS1161: Unterminated regular expression literal. + + +==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== + + declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + + // This should be a parse error + const class1 = "foo"; + const class2 = "bar"; + const elem =
; + ~ +!!! error TS1005: '}' expected. + ~ +!!! error TS1003: Identifier expected. + +!!! error TS1161: Unterminated regular expression literal. + \ No newline at end of file diff --git a/tests/baselines/reference/jsxParsingError1.js b/tests/baselines/reference/jsxParsingError1.js new file mode 100644 index 00000000000..14b60afdde8 --- /dev/null +++ b/tests/baselines/reference/jsxParsingError1.js @@ -0,0 +1,21 @@ +//// [file.tsx] + +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} + +// This should be a parse error +const class1 = "foo"; +const class2 = "bar"; +const elem =
; + + +//// [file.jsx] +// This should be a parse error +var class1 = "foo"; +var class2 = "bar"; +var elem =
; +/>;; diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt index d9b7fa55d71..a39c1c4d91a 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/mergedModuleDeclarationCodeGen.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/mergedModuleDeclarationCodeGen.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/mergedModuleDeclarationCodeGen.ts (1 errors) ==== export module X { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export module Y { class A { constructor(Y: any) { diff --git a/tests/baselines/reference/modifiersInObjectLiterals.errors.txt b/tests/baselines/reference/modifiersInObjectLiterals.errors.txt new file mode 100644 index 00000000000..25382123390 --- /dev/null +++ b/tests/baselines/reference/modifiersInObjectLiterals.errors.txt @@ -0,0 +1,24 @@ +tests/cases/compiler/modifiersInObjectLiterals.ts(2,2): error TS1042: 'public' modifier cannot be used here. +tests/cases/compiler/modifiersInObjectLiterals.ts(3,2): error TS1042: 'private' modifier cannot be used here. +tests/cases/compiler/modifiersInObjectLiterals.ts(4,2): error TS1042: 'protected' modifier cannot be used here. +tests/cases/compiler/modifiersInObjectLiterals.ts(5,2): error TS1042: 'abstract' modifier cannot be used here. + + +==== tests/cases/compiler/modifiersInObjectLiterals.ts (4 errors) ==== + let data = { + public foo: 'hey', + ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. + private bar: 'nay', + ~~~~~~~ +!!! error TS1042: 'private' modifier cannot be used here. + protected baz: 'oh my', + ~~~~~~~~~ +!!! error TS1042: 'protected' modifier cannot be used here. + abstract noWay: 'yes' + ~~~~~~~~ +!!! error TS1042: 'abstract' modifier cannot be used here. + }; + + data.foo + data.bar + data.baz + data.noWay + \ No newline at end of file diff --git a/tests/baselines/reference/modifiersInObjectLiterals.js b/tests/baselines/reference/modifiersInObjectLiterals.js new file mode 100644 index 00000000000..0a59b13c21e --- /dev/null +++ b/tests/baselines/reference/modifiersInObjectLiterals.js @@ -0,0 +1,19 @@ +//// [modifiersInObjectLiterals.ts] +let data = { + public foo: 'hey', + private bar: 'nay', + protected baz: 'oh my', + abstract noWay: 'yes' +}; + +data.foo + data.bar + data.baz + data.noWay + + +//// [modifiersInObjectLiterals.js] +var data = { + foo: 'hey', + bar: 'nay', + baz: 'oh my', + noWay: 'yes' +}; +data.foo + data.bar + data.baz + data.noWay; diff --git a/tests/baselines/reference/moduleElementsInWrongContext.js b/tests/baselines/reference/moduleElementsInWrongContext.js index 635da02bdf2..df4935f9e19 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext.js +++ b/tests/baselines/reference/moduleElementsInWrongContext.js @@ -34,7 +34,6 @@ { var v; function foo() { } - __export(require("ambient")); exports["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleElementsInWrongContext2.js b/tests/baselines/reference/moduleElementsInWrongContext2.js index fdf1222e549..b923bc7861e 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext2.js +++ b/tests/baselines/reference/moduleElementsInWrongContext2.js @@ -34,7 +34,6 @@ function blah () { function blah() { var v; function foo() { } - __export(require("ambient")); exports["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleElementsInWrongContext3.js b/tests/baselines/reference/moduleElementsInWrongContext3.js index d464d9d31b1..2fa0b60dce4 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext3.js +++ b/tests/baselines/reference/moduleElementsInWrongContext3.js @@ -37,7 +37,6 @@ var P; { var v; function foo() { } - __export(require("ambient")); P["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleScoping.errors.txt b/tests/baselines/reference/moduleScoping.errors.txt index 21471bc93a5..961715f2e71 100644 --- a/tests/baselines/reference/moduleScoping.errors.txt +++ b/tests/baselines/reference/moduleScoping.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/file1.ts (0 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot comp ==== tests/cases/conformance/externalModules/file3.ts (1 errors) ==== export var v3 = true; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. var v2 = [1,2,3]; // Module scope. Should not appear in global scope ==== tests/cases/conformance/externalModules/file4.ts (0 errors) ==== diff --git a/tests/baselines/reference/nonMergedOverloads.errors.txt b/tests/baselines/reference/nonMergedOverloads.errors.txt index 9a38ebdc3b3..f5fb58247da 100644 --- a/tests/baselines/reference/nonMergedOverloads.errors.txt +++ b/tests/baselines/reference/nonMergedOverloads.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/nonMergedOverloads.ts(1,5): error TS2300: Duplicate identifier 'f'. -tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS2300: Duplicate identifier 'f'. tests/cases/compiler/nonMergedOverloads.ts(4,17): error TS2300: Duplicate identifier 'f'. @@ -11,7 +11,7 @@ tests/cases/compiler/nonMergedOverloads.ts(4,17): error TS2300: Duplicate identi export function f(); ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~ !!! error TS2300: Duplicate identifier 'f'. export function f() { diff --git a/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt b/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt index 9e739194f54..182eab1b4cf 100644 --- a/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt +++ b/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/objectLiteralMemberWithModifiers1.ts(1,11): error TS1042: 'public' modifier cannot be used here. tests/cases/compiler/objectLiteralMemberWithModifiers1.ts(1,11): error TS1184: Modifiers cannot appear here. -==== tests/cases/compiler/objectLiteralMemberWithModifiers1.ts (1 errors) ==== +==== tests/cases/compiler/objectLiteralMemberWithModifiers1.ts (2 errors) ==== var v = { public foo() { } } ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. + ~~~~~~ !!! error TS1184: Modifiers cannot appear here. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt b/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt index be2bea5e241..0d1822339b6 100644 --- a/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt +++ b/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,11): error TS1042: 'public' modifier cannot be used here. tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS2378: A 'get' accessor must return a value. -==== tests/cases/compiler/objectLiteralMemberWithModifiers2.ts (2 errors) ==== +==== tests/cases/compiler/objectLiteralMemberWithModifiers2.ts (3 errors) ==== var v = { public get foo() { } } + ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index 97527418337..85c450ef39f 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,28): error TS2304: Cannot find name 'DisplayPosition'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,45): error TS1137: Expression or comma expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,46): error TS1005: ';' expected. @@ -38,7 +38,7 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T ==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (35 errors) ==== export class Game { ~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); ~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'DisplayPosition'. diff --git a/tests/baselines/reference/parser509546.errors.txt b/tests/baselines/reference/parser509546.errors.txt index 6b98dc2aa30..65e524cb0e7 100644 --- a/tests/baselines/reference/parser509546.errors.txt +++ b/tests/baselines/reference/parser509546.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts (1 errors) ==== export class Logger { ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_1.errors.txt b/tests/baselines/reference/parser509546_1.errors.txt index 5987aadff24..1098adc1463 100644 --- a/tests/baselines/reference/parser509546_1.errors.txt +++ b/tests/baselines/reference/parser509546_1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts (1 errors) ==== export class Logger { ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_2.errors.txt b/tests/baselines/reference/parser509546_2.errors.txt index 617fec94321..ad551887dda 100644 --- a/tests/baselines/reference/parser509546_2.errors.txt +++ b/tests/baselines/reference/parser509546_2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,1 export class Logger { ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser618973.errors.txt b/tests/baselines/reference/parser618973.errors.txt index 95e08726661..b76aa15c858 100644 --- a/tests/baselines/reference/parser618973.errors.txt +++ b/tests/baselines/reference/parser618973.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,8): error TS1030: 'export' modifier already seen. -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts (2 errors) ==== @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21) ~~~~~~ !!! error TS1030: 'export' modifier already seen. ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public Bar() { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserAccessors10.errors.txt b/tests/baselines/reference/parserAccessors10.errors.txt index d6a2b99eaca..b309b5e3947 100644 --- a/tests/baselines/reference/parserAccessors10.errors.txt +++ b/tests/baselines/reference/parserAccessors10.errors.txt @@ -1,9 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts(2,3): error TS1042: 'public' modifier cannot be used here. tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts(2,14): error TS2378: A 'get' accessor must return a value. -==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts (2 errors) ==== var v = { public get foo() { } + ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. ~~~ !!! error TS2378: A 'get' accessor must return a value. }; \ No newline at end of file diff --git a/tests/baselines/reference/parserArgumentList1.errors.txt b/tests/baselines/reference/parserArgumentList1.errors.txt index 36d1a0fad37..01575cec0c4 100644 --- a/tests/baselines/reference/parserArgumentList1.errors.txt +++ b/tests/baselines/reference/parserArgumentList1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,35): error TS2304: Cannot find name 'HTMLElement'. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(2,42): error TS2304: Cannot find name '_classNameRegexp'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(2,42): error T ==== tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts (3 errors) ==== export function removeClass (node:HTMLElement, className:string) { ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2304: Cannot find name 'HTMLElement'. node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) { diff --git a/tests/baselines/reference/parserClass1.errors.txt b/tests/baselines/reference/parserClass1.errors.txt index da4fc8d870d..03ec87f66a6 100644 --- a/tests/baselines/reference/parserClass1.errors.txt +++ b/tests/baselines/reference/parserClass1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,40): error TS2304: Cannot find name 'ILogger'. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts (2 errors) ==== export class NullLogger implements ILogger { ~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. public information(): boolean { return false; } diff --git a/tests/baselines/reference/parserClass2.errors.txt b/tests/baselines/reference/parserClass2.errors.txt index 39476805e1d..ee67b262fe5 100644 --- a/tests/baselines/reference/parserClass2.errors.txt +++ b/tests/baselines/reference/parserClass2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,43): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(4,37): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(5,18): error TS2339: Property '_information' does not exist on type 'LoggerAdapter'. @@ -9,7 +9,7 @@ tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(5,1 export class LoggerAdapter implements ILogger { ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. constructor (public logger: ILogger) { diff --git a/tests/baselines/reference/parserEnum1.errors.txt b/tests/baselines/reference/parserEnum1.errors.txt index ca89c5fc104..dd8cd23fe2c 100644 --- a/tests/baselines/reference/parserEnum1.errors.txt +++ b/tests/baselines/reference/parserEnum1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts(3,17) export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. None = 0, IsIndexer = 1, IsStringIndexer = 1 << 1, diff --git a/tests/baselines/reference/parserEnum2.errors.txt b/tests/baselines/reference/parserEnum2.errors.txt index f8a841fd9ba..242b624ad88 100644 --- a/tests/baselines/reference/parserEnum2.errors.txt +++ b/tests/baselines/reference/parserEnum2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts(3,17) export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. None = 0, IsIndexer = 1, IsStringIndexer = 1 << 1, diff --git a/tests/baselines/reference/parserEnum3.errors.txt b/tests/baselines/reference/parserEnum3.errors.txt index 463f338159a..e0b3691dbde 100644 --- a/tests/baselines/reference/parserEnum3.errors.txt +++ b/tests/baselines/reference/parserEnum3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts (1 errors) ==== @@ -6,5 +6,5 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts(3,17) export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/parserEnum4.errors.txt b/tests/baselines/reference/parserEnum4.errors.txt index 9f2cd1d1862..9329b484c92 100644 --- a/tests/baselines/reference/parserEnum4.errors.txt +++ b/tests/baselines/reference/parserEnum4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(4,9): error TS1132: Enum member expected. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(4,9): export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. , ~ !!! error TS1132: Enum member expected. diff --git a/tests/baselines/reference/parserExportAssignment1.errors.txt b/tests/baselines/reference/parserExportAssignment1.errors.txt index cd153319f1a..cb989f655ce 100644 --- a/tests/baselines/reference/parserExportAssignment1.errors.txt +++ b/tests/baselines/reference/parserExportAssignment1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,10): error TS2304: Cannot find name 'foo'. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts (2 errors) ==== export = foo ~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment2.errors.txt b/tests/baselines/reference/parserExportAssignment2.errors.txt index 60eb0c1f43e..7e7fcbd950f 100644 --- a/tests/baselines/reference/parserExportAssignment2.errors.txt +++ b/tests/baselines/reference/parserExportAssignment2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,10): error TS2304: Cannot find name 'foo'. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts (2 errors) ==== export = foo; ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment3.errors.txt b/tests/baselines/reference/parserExportAssignment3.errors.txt index b1e94a27469..5e2ff747e2d 100644 --- a/tests/baselines/reference/parserExportAssignment3.errors.txt +++ b/tests/baselines/reference/parserExportAssignment3.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,9): error TS1109: Expression expected. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts (2 errors) ==== export = ~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment4.errors.txt b/tests/baselines/reference/parserExportAssignment4.errors.txt index 93e311bdb23..10830b9b977 100644 --- a/tests/baselines/reference/parserExportAssignment4.errors.txt +++ b/tests/baselines/reference/parserExportAssignment4.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,10): error TS1109: Expression expected. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts (2 errors) ==== export = ; ~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment7.errors.txt b/tests/baselines/reference/parserExportAssignment7.errors.txt index 7e54f2a4bce..c4ecd785484 100644 --- a/tests/baselines/reference/parserExportAssignment7.errors.txt +++ b/tests/baselines/reference/parserExportAssignment7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignm ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts (3 errors) ==== export class C { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } export = B; diff --git a/tests/baselines/reference/parserExportAssignment8.errors.txt b/tests/baselines/reference/parserExportAssignment8.errors.txt index 71b37c99db7..39ccc32e495 100644 --- a/tests/baselines/reference/parserExportAssignment8.errors.txt +++ b/tests/baselines/reference/parserExportAssignment8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignm ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts (3 errors) ==== export = B; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~ diff --git a/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt index ab6985c5ab1..6820ecdd48c 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,8): error TS1030: 'export' modifier already seen. -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,25): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,25): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts (2 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterface ~~~~~~ !!! error TS1030: 'export' modifier already seen. ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt index 344a5d9deb8..ecd59ae29e8 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts (1 errors) ==== export interface I { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt index 973920e3584..c73c52ddd35 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(2,4): error TS1184: Modifiers cannot appear here. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts (2 errors) ==== export function foo() { ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var x = this; ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt index 7a3fb004225..a480a0c4330 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(2,4): error TS1184: Modifiers cannot appear here. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts (2 errors) ==== export function foo() { ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export function bar() { ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/tests/baselines/reference/parserModule1.errors.txt b/tests/baselines/reference/parserModule1.errors.txt index 3a145493dd9..dc5c9c2dd35 100644 --- a/tests/baselines/reference/parserModule1.errors.txt +++ b/tests/baselines/reference/parserModule1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts(1,19): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts(1,19): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts (1 errors) ==== export module CompilerDiagnostics { ~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var debug = false; export interface IDiagnosticWriter { Alert(output: string): void; diff --git a/tests/baselines/reference/relativePathToDeclarationFile.errors.txt b/tests/baselines/reference/relativePathToDeclarationFile.errors.txt index 041dd5c3a8f..0431c3a5bfa 100644 --- a/tests/baselines/reference/relativePathToDeclarationFile.errors.txt +++ b/tests/baselines/reference/relativePathToDeclarationFile.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/test/foo.d.ts(1,23): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/test/foo.d.ts(1,23): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/test/file1.ts (0 errors) ==== @@ -13,7 +13,7 @@ tests/cases/conformance/externalModules/test/foo.d.ts(1,23): error TS1148: Canno ==== tests/cases/conformance/externalModules/test/foo.d.ts (1 errors) ==== export declare module M2 { ~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var x: boolean; } diff --git a/tests/baselines/reference/reservedWords2.errors.txt b/tests/baselines/reference/reservedWords2.errors.txt index d6e2d04073d..fa89df3af7a 100644 --- a/tests/baselines/reference/reservedWords2.errors.txt +++ b/tests/baselines/reference/reservedWords2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/reservedWords2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/reservedWords2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/reservedWords2.ts(1,8): error TS1109: Expression expected. tests/cases/compiler/reservedWords2.ts(1,14): error TS1005: '(' expected. tests/cases/compiler/reservedWords2.ts(1,16): error TS2304: Cannot find name 'require'. @@ -35,7 +35,7 @@ tests/cases/compiler/reservedWords2.ts(10,6): error TS1003: Identifier expected. ==== tests/cases/compiler/reservedWords2.ts (32 errors) ==== import while = require("dfdf"); ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~ !!! error TS1109: Expression expected. ~ diff --git a/tests/baselines/reference/scannerClass2.errors.txt b/tests/baselines/reference/scannerClass2.errors.txt index 74b62602dad..d808f6fdd59 100644 --- a/tests/baselines/reference/scannerClass2.errors.txt +++ b/tests/baselines/reference/scannerClass2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,43): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(4,37): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(5,18): error TS2339: Property '_information' does not exist on type 'LoggerAdapter'. @@ -9,7 +9,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(5,18): error TS2339 export class LoggerAdapter implements ILogger { ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. constructor (public logger: ILogger) { diff --git a/tests/baselines/reference/scannerEnum1.errors.txt b/tests/baselines/reference/scannerEnum1.errors.txt index 64d7508980f..d0bbf16743c 100644 --- a/tests/baselines/reference/scannerEnum1.errors.txt +++ b/tests/baselines/reference/scannerEnum1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts (1 errors) ==== export enum CodeGenTarget { ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ES3 = 0, ES5 = 1, } \ No newline at end of file diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt index 2aa474d4cdc..a1afdea661b 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS2507: Type 'any' is not a constructor function type. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(44,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(45,9): error TS2332: 'this' cannot be referenced in current location. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (8 errors) ==== @@ -72,4 +72,4 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod export = this; // Should be an error ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. \ No newline at end of file +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. \ No newline at end of file diff --git a/tests/baselines/reference/tsxPreserveEmit1.js b/tests/baselines/reference/tsxPreserveEmit1.js index 894d0c3d698..7ac6c18ebca 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.js +++ b/tests/baselines/reference/tsxPreserveEmit1.js @@ -22,12 +22,28 @@ import ReactRouter = require('react-router'); import Route = ReactRouter.Route; -var routes = ; +var routes1 = ; + +module M { + export var X: any; +} +module M { + // Should emit 'M.X' in both opening and closing tags + var y = ; +} //// [test.jsx] define(["require", "exports", 'react-router'], function (require, exports, ReactRouter) { "use strict"; var Route = ReactRouter.Route; - var routes = ; + var routes1 = ; + var M; + (function (M) { + })(M || (M = {})); + var M; + (function (M) { + // Should emit 'M.X' in both opening and closing tags + var y = ; + })(M || (M = {})); }); diff --git a/tests/baselines/reference/tsxPreserveEmit1.symbols b/tests/baselines/reference/tsxPreserveEmit1.symbols index 6dcf4d9ac49..53707b86104 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.symbols +++ b/tests/baselines/reference/tsxPreserveEmit1.symbols @@ -11,10 +11,26 @@ import Route = ReactRouter.Route; >ReactRouter : Symbol(ReactRouter, Decl(react.d.ts, 4, 1)) >Route : Symbol(ReactRouter.Route, Decl(react.d.ts, 7, 4)) -var routes = ; ->routes : Symbol(routes, Decl(test.tsx, 6, 3)) +var routes1 = ; +>routes1 : Symbol(routes1, Decl(test.tsx, 6, 3)) >Route : Symbol(Route, Decl(test.tsx, 2, 45)) +module M { +>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1)) + + export var X: any; +>X : Symbol(X, Decl(test.tsx, 9, 11)) +} +module M { +>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1)) + + // Should emit 'M.X' in both opening and closing tags + var y = ; +>y : Symbol(y, Decl(test.tsx, 13, 4)) +>X : Symbol(X, Decl(test.tsx, 9, 11)) +>X : Symbol(X, Decl(test.tsx, 9, 11)) +} + === tests/cases/conformance/jsx/react.d.ts === declare module 'react' { diff --git a/tests/baselines/reference/tsxPreserveEmit1.types b/tests/baselines/reference/tsxPreserveEmit1.types index ea64e2d2e94..26da75b39e4 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.types +++ b/tests/baselines/reference/tsxPreserveEmit1.types @@ -11,11 +11,28 @@ import Route = ReactRouter.Route; >ReactRouter : typeof ReactRouter >Route : any -var routes = ; ->routes : any +var routes1 = ; +>routes1 : any > : any >Route : any +module M { +>M : typeof M + + export var X: any; +>X : any +} +module M { +>M : typeof M + + // Should emit 'M.X' in both opening and closing tags + var y = ; +>y : any +> : any +>X : any +>X : any +} + === tests/cases/conformance/jsx/react.d.ts === declare module 'react' { diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt index 49f3ab6bac4..cced3116b5e 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/jsx/file.tsx(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/jsx/file.tsx(20,16): error TS2339: Property 'ref' does not exist on type 'IntrinsicAttributes & { name?: string; }'. tests/cases/conformance/jsx/file.tsx(26,42): error TS2339: Property 'subtr' does not exist on type 'string'. tests/cases/conformance/jsx/file.tsx(28,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'. @@ -9,7 +9,7 @@ tests/cases/conformance/jsx/file.tsx(36,26): error TS2339: Property 'propertyNot import React = require('react'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. function Greet(x: {name?: string}) { return
Hello, {x}
; diff --git a/tests/baselines/reference/typeofANonExportedType.errors.txt b/tests/baselines/reference/typeofANonExportedType.errors.txt index 0fb239f6aee..2399938dcfc 100644 --- a/tests/baselines/reference/typeofANonExportedType.errors.txt +++ b/tests/baselines/reference/typeofANonExportedType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. @@ -8,7 +8,7 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType var x = 1; export var r1: typeof x; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. var y = { foo: '' }; export var r2: typeof y; class C { diff --git a/tests/baselines/reference/typeofAnExportedType.errors.txt b/tests/baselines/reference/typeofAnExportedType.errors.txt index 51dd7cf06b6..9740909bd59 100644 --- a/tests/baselines/reference/typeofAnExportedType.errors.txt +++ b/tests/baselines/reference/typeofAnExportedType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. @@ -7,7 +7,7 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.t ==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (4 errors) ==== export var x = 1; ~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var r1: typeof x; export var y = { foo: '' }; export var r2: typeof y; diff --git a/tests/cases/compiler/exportStarForValues.ts b/tests/cases/compiler/exportStarForValues.ts new file mode 100644 index 00000000000..3432548c528 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues.ts @@ -0,0 +1,8 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +var x; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues10.ts b/tests/cases/compiler/exportStarForValues10.ts new file mode 100644 index 00000000000..82cee772b18 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues10.ts @@ -0,0 +1,12 @@ +// @module: system + +// @filename: file0.ts +export var v = 1; + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file0"; +export * from "file1"; +var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues2.ts b/tests/cases/compiler/exportStarForValues2.ts new file mode 100644 index 00000000000..63a880cce0a --- /dev/null +++ b/tests/cases/compiler/exportStarForValues2.ts @@ -0,0 +1,12 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +var x = 1; + +// @filename: file3.ts +export * from "file2" +var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues3.ts b/tests/cases/compiler/exportStarForValues3.ts new file mode 100644 index 00000000000..f0c36db0bda --- /dev/null +++ b/tests/cases/compiler/exportStarForValues3.ts @@ -0,0 +1,24 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file1" +var x = 1; + +// @filename: file4.ts +export interface C { x } +export * from "file2" +export * from "file3" +var x = 1; + +// @filename: file5.ts +export * from "file4" +var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues4.ts b/tests/cases/compiler/exportStarForValues4.ts new file mode 100644 index 00000000000..d685ba1c8a3 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues4.ts @@ -0,0 +1,15 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +export * from "file3" +var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file2" +var x = 1; diff --git a/tests/cases/compiler/exportStarForValues5.ts b/tests/cases/compiler/exportStarForValues5.ts new file mode 100644 index 00000000000..cb716c72002 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues5.ts @@ -0,0 +1,8 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +export var x; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues6.ts b/tests/cases/compiler/exportStarForValues6.ts new file mode 100644 index 00000000000..a623e31f178 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues6.ts @@ -0,0 +1,8 @@ +// @module: system + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues7.ts b/tests/cases/compiler/exportStarForValues7.ts new file mode 100644 index 00000000000..c1343a44119 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues7.ts @@ -0,0 +1,12 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +export var x = 1; + +// @filename: file3.ts +export * from "file2" +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues8.ts b/tests/cases/compiler/exportStarForValues8.ts new file mode 100644 index 00000000000..0594f8b0877 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues8.ts @@ -0,0 +1,24 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +export var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file1" +export var x = 1; + +// @filename: file4.ts +export interface C { x } +export * from "file2" +export * from "file3" +export var x = 1; + +// @filename: file5.ts +export * from "file4" +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues9.ts b/tests/cases/compiler/exportStarForValues9.ts new file mode 100644 index 00000000000..53ffb1b7954 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues9.ts @@ -0,0 +1,15 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +export * from "file3" +export var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file2" +export var x = 1; diff --git a/tests/cases/compiler/exportStarForValuesInSystem.ts b/tests/cases/compiler/exportStarForValuesInSystem.ts new file mode 100644 index 00000000000..1f60e8dec6f --- /dev/null +++ b/tests/cases/compiler/exportStarForValuesInSystem.ts @@ -0,0 +1,8 @@ +// @module: system + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/modifiersInObjectLiterals.ts b/tests/cases/compiler/modifiersInObjectLiterals.ts new file mode 100644 index 00000000000..58fa64f82e9 --- /dev/null +++ b/tests/cases/compiler/modifiersInObjectLiterals.ts @@ -0,0 +1,8 @@ +let data = { + public foo: 'hey', + private bar: 'nay', + protected baz: 'oh my', + abstract noWay: 'yes' +}; + +data.foo + data.bar + data.baz + data.noWay diff --git a/tests/cases/conformance/jsx/jsxParsingError1.tsx b/tests/cases/conformance/jsx/jsxParsingError1.tsx new file mode 100644 index 00000000000..2668f04e885 --- /dev/null +++ b/tests/cases/conformance/jsx/jsxParsingError1.tsx @@ -0,0 +1,14 @@ +//@jsx: preserve + +//@filename: file.tsx +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} + +// This should be a parse error +const class1 = "foo"; +const class2 = "bar"; +const elem =
; diff --git a/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx b/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx index e75a1dbfde2..179a3116b43 100644 --- a/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx +++ b/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx @@ -23,4 +23,12 @@ import ReactRouter = require('react-router'); import Route = ReactRouter.Route; -var routes = ; +var routes1 = ; + +module M { + export var X: any; +} +module M { + // Should emit 'M.X' in both opening and closing tags + var y = ; +} diff --git a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts new file mode 100644 index 00000000000..06a1c24230c --- /dev/null +++ b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts @@ -0,0 +1,21 @@ +/// + +////interface I1 { +//// a(): void; +//// b(): void; +////} +//// +////var imp1: I1 { +//// a() {}, +//// /*0*/ +////} +//// +////var imp2: I1 { +//// a: () => {}, +//// /*1*/ +////} + +goTo.marker("0"); +verify.not.completionListContains("a"); +goTo.marker("1"); +verify.not.completionListContains("a"); diff --git a/tests/cases/fourslash/formattingFatArrowFunctions.ts b/tests/cases/fourslash/formattingFatArrowFunctions.ts index c540c2837e1..d4ce38dbd62 100644 --- a/tests/cases/fourslash/formattingFatArrowFunctions.ts +++ b/tests/cases/fourslash/formattingFatArrowFunctions.ts @@ -4,6 +4,7 @@ //// ( ) => 1 ;/*1*/ //// ( arg ) => 2 ;/*2*/ //// arg => 2 ;/*3*/ +//// arg=>2 ;/*3a*/ //// ( arg = 1 ) => 3 ;/*4*/ //// ( arg ? ) => 4 ;/*5*/ //// ( arg : number ) => 5 ;/*6*/ @@ -118,7 +119,9 @@ verify.currentLineContentIs("() => 1;"); goTo.marker("2"); verify.currentLineContentIs("(arg) => 2;"); goTo.marker("3"); -verify.currentLineContentIs("arg => 2;"); +verify.currentLineContentIs("arg => 2;"); +goTo.marker("3a"); +verify.currentLineContentIs("arg => 2;"); goTo.marker("4"); verify.currentLineContentIs("(arg = 1) => 3;"); goTo.marker("5"); diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts index 58c02dae183..198c39abe42 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts @@ -13,7 +13,7 @@ verify.getSemanticDiagnostics(`[ "code": 8003 }, { - "message": "Cannot compile modules unless the '--module' flag is provided.", + "message": "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.", "start": 0, "length": 11, "category": "error",