Merge branch 'master' of https://github.com/Microsoft/TypeScript into bug/25667-getmodifiedtime-has-wrong-return-type

This commit is contained in:
Alexander T committed 2018-07-20 10:18:22 +03:00
commit 8ae163a1cc
102 files changed
+1450 -245

No files matched your search

+3 -3
View File
@@ -16,10 +16,10 @@ Please fill in the *entire* template below.
-->
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:** 3.0.0-dev.201xxxxx
**TypeScript Version:** 3.1.0-dev.201xxxxx
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**
**Search Terms:**
**Code**
@@ -32,6 +32,6 @@ Please fill in the *entire* template below.
**Actual behavior:**
**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
**Related Issues:** <!-- Did you find other bugs that looked similar? -->
+1 -1
View File
@@ -817,7 +817,7 @@ function diagnosticsToString(diagnostics, pretty) {
* Concatenate a list of sourceFiles to a destinationFile
* @param {string} destinationFile
* @param {string[]} sourceFiles
* @param {string} extraContent
* @param {string=} extraContent
*/
function concatenateFiles(destinationFile, sourceFiles, extraContent) {
var temp = "temptemp";
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "3.0.0",
"version": "3.1.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+21 -5
View File
@@ -306,7 +306,7 @@ namespace ts {
}
function getDisplayName(node: Declaration): string {
return isNamedDeclaration(node) ? declarationNameToString(node.name) : unescapeLeadingUnderscores(getDeclarationName(node)!); // TODO: GH#18217
return isNamedDeclaration(node) ? declarationNameToString(node.name) : unescapeLeadingUnderscores(Debug.assertDefined(getDeclarationName(node)));
}
/**
@@ -383,9 +383,11 @@ namespace ts {
let message = symbol.flags & SymbolFlags.BlockScopedVariable
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
: Diagnostics.Duplicate_identifier_0;
let messageNeedsName = true;
if (symbol.flags & SymbolFlags.Enum || includes & SymbolFlags.Enum) {
message = Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
messageNeedsName = false;
}
if (symbol.declarations && symbol.declarations.length) {
@@ -394,6 +396,7 @@ namespace ts {
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
if (isDefaultExport) {
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName = false;
}
else {
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
@@ -403,14 +406,16 @@ namespace ts {
if (symbol.declarations && symbol.declarations.length &&
(node.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals)) {
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName = false;
}
}
}
forEach(symbol.declarations, declaration => {
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(declaration) || declaration, message, getDisplayName(declaration)));
});
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(node) || node, message, getDisplayName(node)));
const addError = (decl: Declaration): void => {
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(decl) || decl, message, messageNeedsName ? getDisplayName(decl) : undefined));
};
forEach(symbol.declarations, addError);
addError(node);
symbol = createSymbol(SymbolFlags.None, name);
}
@@ -1913,6 +1918,15 @@ namespace ts {
}
}
function checkStrictModeLabeledStatement(node: LabeledStatement) {
// Grammar checking for labeledStatement
if (inStrictMode && options.target! >= ScriptTarget.ES2015) {
if (isDeclarationStatement(node.statement) || isVariableStatement(node.statement)) {
errorOnFirstToken(node.label, Diagnostics.A_label_is_not_allowed_here);
}
}
}
function errorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any) {
const span = getSpanOfTokenAtPosition(file, node.pos);
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
@@ -2099,6 +2113,8 @@ namespace ts {
return checkStrictModePrefixUnaryExpression(<PrefixUnaryExpression>node);
case SyntaxKind.WithStatement:
return checkStrictModeWithStatement(<WithStatement>node);
case SyntaxKind.LabeledStatement:
return checkStrictModeLabeledStatement(<LabeledStatement>node);
case SyntaxKind.ThisType:
seenThisKeyword = true;
return;
+13 -3
View File
@@ -4714,6 +4714,10 @@ namespace ts {
// function/class/{} assignments are fresh declarations, not property assignments, so only add prototype assignments
const specialDeclaration = getAssignedJavascriptInitializer(symbol.valueDeclaration);
if (specialDeclaration) {
const tag = getJSDocTypeTag(specialDeclaration);
if (tag && tag.typeExpression) {
return getTypeFromTypeNode(tag.typeExpression);
}
return getWidenedLiteralType(checkExpressionCached(specialDeclaration));
}
const types: Type[] = [];
@@ -5081,7 +5085,7 @@ namespace ts {
}
function getJSInitializerType(decl: Node, symbol: Symbol, init: Expression | undefined): Type | undefined {
if (init && isInJavaScriptFile(init) && isObjectLiteralExpression(init)) {
if (init && isInJavaScriptFile(init) && isObjectLiteralExpression(init) && init.properties.length === 0) {
const exports = createSymbolTable();
while (isBinaryExpression(decl) || isPropertyAccessExpression(decl)) {
const s = getSymbolOfNode(decl);
@@ -11182,7 +11186,8 @@ namespace ts {
if (reportErrors) {
const bestMatchingType =
findMatchingDiscriminantType(source, target) ||
findMatchingTypeReferenceOrTypeAliasReference(source, target);
findMatchingTypeReferenceOrTypeAliasReference(source, target) ||
findBestTypeForObjectLiteral(source, target);
isRelatedTo(source, bestMatchingType || targetTypes[targetTypes.length - 1], /*reportErrors*/ true);
}
@@ -11207,6 +11212,11 @@ namespace ts {
}
}
function findBestTypeForObjectLiteral(source: Type, unionTarget: UnionOrIntersectionType) {
if (getObjectFlags(source) & ObjectFlags.ObjectLiteral && forEachType(unionTarget, isArrayLikeType)) {
return find(unionTarget.types, t => !isArrayLikeType(t));
}
}
// Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly
function findMatchingDiscriminantType(source: Type, target: UnionOrIntersectionType) {
@@ -19083,7 +19093,7 @@ namespace ts {
else if (candidateForTypeArgumentError) {
checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression).typeArguments!, /*reportErrors*/ true, fallbackError);
}
else if (typeArguments && every(signatures, sig => length(sig.typeParameters) !== typeArguments!.length)) {
else if (typeArguments && every(signatures, sig => typeArguments!.length < getMinTypeArgumentCount(sig.typeParameters) || typeArguments!.length > length(sig.typeParameters))) {
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments));
}
else if (args) {
+1 -1
View File
@@ -1,7 +1,7 @@
namespace ts {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
export const versionMajorMinor = "3.0";
export const versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
export const version = `${versionMajorMinor}.0-dev`;
}
+4
View File
@@ -983,6 +983,10 @@
"category": "Error",
"code": 1343
},
"'A label is not allowed here.": {
"category": "Error",
"code": 1344
},
"Duplicate identifier '{0}'.": {
"category": "Error",
+18 -8
View File
@@ -494,9 +494,9 @@ namespace ts {
case SyntaxKind.JSDocSignature:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, (<SignatureDeclaration>node).typeParameters) ||
visitNodes(cbNode, cbNodes, (<SignatureDeclaration>node).parameters) ||
visitNode(cbNode, (<SignatureDeclaration>node).type);
forEach((<JSDocSignature>node).typeParameters, cbNode) ||
forEach((<JSDocSignature>node).parameters, cbNode) ||
visitNode(cbNode, (<JSDocSignature>node).type);
case SyntaxKind.JSDocTypeLiteral:
if ((node as JSDocTypeLiteral).jsDocPropertyTags) {
for (const tag of (node as JSDocTypeLiteral).jsDocPropertyTags!) {
@@ -1509,7 +1509,9 @@ namespace ts {
case ParsingContext.ArgumentExpressions:
return token() === SyntaxKind.DotDotDotToken || isStartOfExpression();
case ParsingContext.Parameters:
return isStartOfParameter();
return isStartOfParameter(/*isJSDocParameter*/ false);
case ParsingContext.JSDocParameters:
return isStartOfParameter(/*isJSDocParameter*/ true);
case ParsingContext.TypeArguments:
case ParsingContext.TupleElementTypes:
return token() === SyntaxKind.CommaToken || isStartOfType();
@@ -1612,6 +1614,7 @@ namespace ts {
case ParsingContext.TupleElementTypes:
case ParsingContext.ArrayBindingElements:
return token() === SyntaxKind.CloseBracketToken;
case ParsingContext.JSDocParameters:
case ParsingContext.Parameters:
case ParsingContext.RestProperties:
// Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery
@@ -1795,6 +1798,7 @@ namespace ts {
case ParsingContext.VariableDeclarations:
return isReusableVariableDeclaration(node);
case ParsingContext.JSDocParameters:
case ParsingContext.Parameters:
return isReusableParameter(node);
@@ -2009,6 +2013,7 @@ namespace ts {
case ParsingContext.ArgumentExpressions: return Diagnostics.Argument_expression_expected;
case ParsingContext.ObjectLiteralMembers: return Diagnostics.Property_assignment_expected;
case ParsingContext.ArrayLiteralMembers: return Diagnostics.Expression_or_comma_expected;
case ParsingContext.JSDocParameters: return Diagnostics.Parameter_declaration_expected;
case ParsingContext.Parameters: return Diagnostics.Parameter_declaration_expected;
case ParsingContext.TypeParameters: return Diagnostics.Type_parameter_declaration_expected;
case ParsingContext.TypeArguments: return Diagnostics.Type_argument_expected;
@@ -2430,12 +2435,12 @@ namespace ts {
return undefined;
}
function isStartOfParameter(): boolean {
function isStartOfParameter(isJSDocParameter: boolean): boolean {
return token() === SyntaxKind.DotDotDotToken ||
isIdentifierOrPattern() ||
isModifierKind(token()) ||
token() === SyntaxKind.AtToken ||
isStartOfType(/*inStartOfParameter*/ true);
isStartOfType(/*inStartOfParameter*/ !isJSDocParameter);
}
function parseParameter(): ParameterDeclaration {
@@ -2534,7 +2539,9 @@ namespace ts {
setYieldContext(!!(flags & SignatureFlags.Yield));
setAwaitContext(!!(flags & SignatureFlags.Await));
signature.parameters = parseDelimitedList(ParsingContext.Parameters, flags & SignatureFlags.JSDoc ? parseJSDocParameter : parseParameter);
signature.parameters = flags & SignatureFlags.JSDoc ?
parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) :
parseDelimitedList(ParsingContext.Parameters, parseParameter);
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
@@ -2960,6 +2967,8 @@ namespace ts {
case SyntaxKind.InferKeyword:
case SyntaxKind.ImportKeyword:
return true;
case SyntaxKind.FunctionKeyword:
return !inStartOfParameter;
case SyntaxKind.MinusToken:
return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral);
case SyntaxKind.OpenParenToken:
@@ -2973,7 +2982,7 @@ namespace ts {
function isStartOfParenthesizedOrFunctionType() {
nextToken();
return token() === SyntaxKind.CloseParenToken || isStartOfParameter() || isStartOfType();
return token() === SyntaxKind.CloseParenToken || isStartOfParameter(/*isJSDocParameter*/ false) || isStartOfType();
}
function parsePostfixTypeOrHigher(): TypeNode {
@@ -6255,6 +6264,7 @@ namespace ts {
JsxChildren, // Things between opening and closing JSX tags
ArrayLiteralMembers, // Members in array literal
Parameters, // Parameters in parameter list
JSDocParameters, // JSDoc parameters in parameter list of JSDoc function type
RestProperties, // Property names in a rest type list
TypeParameters, // Type parameters in type parameter list
TypeArguments, // Type arguments in type argument list
+1 -1
View File
@@ -2366,7 +2366,7 @@ namespace ts {
}
function verifyCompilerOptions() {
if (options.strictPropertyInitialization && !options.strictNullChecks) {
if (options.strictPropertyInitialization && !getStrictOptionValue(options, "strictNullChecks")) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
}
+1 -1
View File
@@ -2207,7 +2207,7 @@ namespace ts {
const statement = unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel);
return isIterationStatement(statement, /*lookInLabeledStatements*/ false)
? visitIterationStatement(statement, /*outermostLabeledStatement*/ node)
: restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node, convertedLoopState && resetLabel);
: restoreEnclosingLabel(visitNode(statement, visitor, isStatement, liftToBlock), node, convertedLoopState && resetLabel);
}
function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) {
+4 -3
View File
@@ -755,7 +755,7 @@ namespace ts {
export interface TypeParameterDeclaration extends NamedDeclaration {
kind: SyntaxKind.TypeParameter;
parent: DeclarationWithTypeParameters | InferTypeNode;
parent: DeclarationWithTypeParameterChildren | InferTypeNode;
name: Identifier;
constraint?: TypeNode;
default?: TypeNode;
@@ -2036,7 +2036,8 @@ namespace ts {
export type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
export type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
export type DeclarationWithTypeParameters = DeclarationWithTypeParameterChildren | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
export type DeclarationWithTypeParameterChildren = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
export interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
@@ -4361,7 +4362,7 @@ namespace ts {
strictFunctionTypes?: boolean; // Always combine with strict property
strictNullChecks?: boolean; // Always combine with strict property
strictPropertyInitialization?: boolean; // Always combine with strict property
/* @internal */ stripInternal?: boolean;
stripInternal?: boolean;
suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean;
/* @internal */ suppressOutputPathCheck?: boolean;
+15 -2
View File
@@ -2307,6 +2307,14 @@ Actual: ${stringify(fullActual)}`);
}
}
public verifyFormatDocumentChangesNothing(): void {
const { fileName } = this.activeFile;
const before = this.getFileContent(fileName);
this.formatDocument();
const after = this.getFileContent(fileName);
this.assertObjectsEqual(after, before);
}
public verifyTextAtCaretIs(text: string) {
const actual = this.getFileContent(this.activeFile.fileName).substring(this.currentCaretPosition, this.currentCaretPosition + text.length);
if (actual !== text) {
@@ -3357,9 +3365,9 @@ Actual: ${stringify(fullActual)}`);
this.cancellationToken.resetCancelled();
}
public getEditsForFileRename({ oldPath, newPath, newFileContents }: FourSlashInterface.GetEditsForFileRenameOptions): void {
public getEditsForFileRename({ oldPath, newPath, newFileContents, preferences }: FourSlashInterface.GetEditsForFileRenameOptions): void {
const test = (fileContents: { readonly [fileName: string]: string }, description: string): void => {
const changes = this.languageService.getEditsForFileRename(oldPath, newPath, this.formatCodeSettings, ts.emptyOptions);
const changes = this.languageService.getEditsForFileRename(oldPath, newPath, this.formatCodeSettings, preferences);
this.testNewFileContents(changes, fileContents, description);
};
@@ -4206,6 +4214,10 @@ namespace FourSlashInterface {
this.state.verifyCurrentFileContent(text);
}
public formatDocumentChangesNothing(): void {
this.state.verifyFormatDocumentChangesNothing();
}
public goToDefinitionIs(endMarkers: ArrayOrSingle<string>) {
this.state.verifyGoToDefinitionIs(endMarkers);
}
@@ -4878,6 +4890,7 @@ namespace FourSlashInterface {
readonly oldPath: string;
readonly newPath: string;
readonly newFileContents: { readonly [fileName: string]: string };
readonly preferences?: ts.UserPreferences;
}
export interface MoveToNewFileOptions {
+4 -4
View File
@@ -1125,15 +1125,15 @@ interface Array<T> {
* Returns a string representation of an array. The elements are converted to string using their toLocalString methods.
*/
toLocaleString(): string;
/**
* Removes the last element from an array and returns it.
*/
pop(): T | undefined;
/**
* Appends new elements to an array, and returns the new length of the array.
* @param items New elements of the Array.
*/
push(...items: T[]): number;
/**
* Removes the last element from an array and returns it.
*/
pop(): T | undefined;
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
@@ -487,7 +487,7 @@
<Str Cat="Text">
<Val><![CDATA[A non-dry build would build project '{0}']]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Bei einem Build mit dem Flag "-dry" würde das Projekt "{0}" erstellt.]]></Val>
<Val><![CDATA[Bei einem Build ohne das Flag "-dry" würde das Projekt "{0}" erstellt.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -496,7 +496,7 @@
<Str Cat="Text">
<Val><![CDATA[A non-dry build would delete the following files: {0}]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Bei einem Build mit dem Flag "-dry" würden die folgenden Dateien gelöscht: {0}]]></Val>
<Val><![CDATA[Bei einem Build ohne das Flag "-dry" würden die folgenden Dateien gelöscht: {0}]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -480,7 +480,7 @@
<Str Cat="Text">
<Val><![CDATA[A non-dry build would build project '{0}']]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Um build não -dry compilaria o projeto '{0}']]></Val>
<Val><![CDATA[Um build não -dry criaria o projeto '{0}']]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
+17 -46
View File
@@ -1433,7 +1433,7 @@ namespace ts.server {
return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file));
});
return simplifiedResult
? result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(project, action)) }))
? result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)) }))
: result;
}
@@ -1735,7 +1735,7 @@ namespace ts.server {
const renameScriptInfo = project.getScriptInfoForNormalizedPath(toNormalizedPath(renameFilename))!;
mappedRenameLocation = getLocationInNewDocument(getSnapshotText(renameScriptInfo.getSnapshot()), renameFilename, renameLocation, edits);
}
return { renameLocation: mappedRenameLocation, renameFilename, edits: this.mapTextChangesToCodeEdits(project, edits) };
return { renameLocation: mappedRenameLocation, renameFilename, edits: this.mapTextChangesToCodeEdits(edits) };
}
else {
return result;
@@ -1747,7 +1747,7 @@ namespace ts.server {
const { file, project } = this.getFileAndProject(scope.args);
const changes = project.getLanguageService().organizeImports({ type: "file", fileName: file }, this.getFormatOptions(file), this.getPreferences(file));
if (simplifiedResult) {
return this.mapTextChangesToCodeEdits(project, changes);
return this.mapTextChangesToCodeEdits(changes);
}
else {
return changes;
@@ -1763,7 +1763,7 @@ namespace ts.server {
this.projectService,
project => project.getLanguageService().getEditsForFileRename(oldPath, newPath, formatOptions, preferences),
(a, b) => a.fileName === b.fileName);
return simplifiedResult ? changes.map(c => this.mapTextChangeToCodeEditUsingScriptInfoOrConfigFile(c)) : changes;
return simplifiedResult ? changes.map(c => this.mapTextChangeToCodeEdit(c)) : changes;
}
private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.CodeFixAction> | ReadonlyArray<CodeFixAction> | undefined {
@@ -1776,7 +1776,7 @@ namespace ts.server {
const { startPosition, endPosition } = this.getStartAndEndPosition(args, scriptInfo);
const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes!, this.getFormatOptions(file), this.getPreferences(file));
return simplifiedResult ? codeActions.map(codeAction => this.mapCodeFixAction(project, codeAction)) : codeActions;
return simplifiedResult ? codeActions.map(codeAction => this.mapCodeFixAction(codeAction)) : codeActions;
}
private getCombinedCodeFix({ scope, fixId }: protocol.GetCombinedCodeFixRequestArgs, simplifiedResult: boolean): protocol.CombinedCodeActions | CombinedCodeActions {
@@ -1784,7 +1784,7 @@ namespace ts.server {
const { file, project } = this.getFileAndProject(scope.args);
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId, this.getFormatOptions(file), this.getPreferences(file));
if (simplifiedResult) {
return { changes: this.mapTextChangesToCodeEdits(project, res.changes), commands: res.commands };
return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
}
else {
return res;
@@ -1824,28 +1824,20 @@ namespace ts.server {
return { startPosition, endPosition };
}
private mapCodeAction(project: Project, { description, changes, commands }: CodeAction): protocol.CodeAction {
return { description, changes: this.mapTextChangesToCodeEdits(project, changes), commands };
private mapCodeAction({ description, changes, commands }: CodeAction): protocol.CodeAction {
return { description, changes: this.mapTextChangesToCodeEdits(changes), commands };
}
private mapCodeFixAction(project: Project, { fixName, description, changes, commands, fixId, fixAllDescription }: CodeFixAction): protocol.CodeFixAction {
return { fixName, description, changes: this.mapTextChangesToCodeEdits(project, changes), commands, fixId, fixAllDescription };
private mapCodeFixAction({ fixName, description, changes, commands, fixId, fixAllDescription }: CodeFixAction): protocol.CodeFixAction {
return { fixName, description, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId, fixAllDescription };
}
private mapTextChangesToCodeEdits(project: Project, textChanges: ReadonlyArray<FileTextChanges>): protocol.FileCodeEdits[] {
return textChanges.map(change => this.mapTextChangeToCodeEdit(project, change));
private mapTextChangesToCodeEdits(textChanges: ReadonlyArray<FileTextChanges>): protocol.FileCodeEdits[] {
return textChanges.map(change => this.mapTextChangeToCodeEdit(change));
}
private mapTextChangeToCodeEdit(project: Project, change: FileTextChanges): protocol.FileCodeEdits {
return mapTextChangesToCodeEditsForFile(change, project.getSourceFileOrConfigFile(this.normalizePath(change.fileName)));
}
private mapTextChangeToCodeEditUsingScriptInfoOrConfigFile(change: FileTextChanges): protocol.FileCodeEdits {
return mapTextChangesToCodeEditsUsingScriptInfoOrConfig(change, this.projectService.getScriptInfoOrConfig(this.normalizePath(change.fileName)));
}
private normalizePath(fileName: string) {
return normalizedPathToPath(toNormalizedPath(fileName), this.host.getCurrentDirectory(), fileName => this.getCanonicalFileName(fileName));
private mapTextChangeToCodeEdit(change: FileTextChanges): protocol.FileCodeEdits {
return mapTextChangesToCodeEdits(change, this.projectService.getScriptInfoOrConfig(change.fileName));
}
private convertTextChangeToCodeEdit(change: TextChange, scriptInfo: ScriptInfo): protocol.CodeEdit {
@@ -2357,35 +2349,14 @@ namespace ts.server {
return { file: fileName, start: scriptInfo.positionToLineOffset(textSpan.start), end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan)) };
}
function mapTextChangesToCodeEditsForFile(textChanges: FileTextChanges, sourceFile: SourceFile | undefined): protocol.FileCodeEdits {
Debug.assert(!!textChanges.isNewFile === !sourceFile, "Expected isNewFile for (only) new files", () => JSON.stringify({ isNewFile: !!textChanges.isNewFile, hasSourceFile: !!sourceFile }));
if (sourceFile) {
return {
fileName: textChanges.fileName,
textChanges: textChanges.textChanges.map(textChange => convertTextChangeToCodeEdit(textChange, sourceFile)),
};
}
else {
return convertNewFileTextChangeToCodeEdit(textChanges);
}
}
function mapTextChangesToCodeEditsUsingScriptInfoOrConfig(textChanges: FileTextChanges, scriptInfo: ScriptInfoOrConfig | undefined): protocol.FileCodeEdits {
function mapTextChangesToCodeEdits(textChanges: FileTextChanges, scriptInfo: ScriptInfoOrConfig | undefined): protocol.FileCodeEdits {
Debug.assert(!!textChanges.isNewFile === !scriptInfo, "Expected isNewFile for (only) new files", () => JSON.stringify({ isNewFile: !!textChanges.isNewFile, hasScriptInfo: !!scriptInfo }));
return scriptInfo
? { fileName: textChanges.fileName, textChanges: textChanges.textChanges.map(textChange => convertTextChangeToCodeEditUsingScriptInfoOrConfig(textChange, scriptInfo)) }
? { fileName: textChanges.fileName, textChanges: textChanges.textChanges.map(textChange => convertTextChangeToCodeEdit(textChange, scriptInfo)) }
: convertNewFileTextChangeToCodeEdit(textChanges);
}
function convertTextChangeToCodeEdit(change: TextChange, sourceFile: SourceFile): protocol.CodeEdit {
return {
start: convertToLocation(sourceFile.getLineAndCharacterOfPosition(change.span.start)),
end: convertToLocation(sourceFile.getLineAndCharacterOfPosition(change.span.start + change.span.length)),
newText: change.newText ? change.newText : "",
};
}
function convertTextChangeToCodeEditUsingScriptInfoOrConfig(change: TextChange, scriptInfo: ScriptInfoOrConfig): protocol.CodeEdit {
function convertTextChangeToCodeEdit(change: TextChange, scriptInfo: ScriptInfoOrConfig): protocol.CodeEdit {
return { start: positionToLineOffset(scriptInfo, change.span.start), end: positionToLineOffset(scriptInfo, textSpanEnd(change.span)), newText: change.newText };
}
+1 -1
View File
@@ -482,7 +482,7 @@ namespace ts.codefix {
}
function addNamespaceQualifier(changes: textChanges.ChangeTracker, sourceFile: SourceFile, { namespacePrefix, symbolToken }: FixUseNamespaceImport): void {
changes.replaceNode(sourceFile, symbolToken, createPropertyAccess(createIdentifier(namespacePrefix), symbolToken));
changes.replaceNode(sourceFile, symbolToken, createPropertyAccess(createIdentifier(namespacePrefix), createIdentifier(symbolToken.text)));
}
interface ImportsCollection {
+18 -16
View File
@@ -921,6 +921,9 @@ namespace ts.Completions {
case SyntaxKind.QualifiedName:
node = (parent as QualifiedName).left;
break;
case SyntaxKind.ModuleDeclaration:
node = (parent as ModuleDeclaration).name;
break;
case SyntaxKind.ImportType:
case SyntaxKind.MetaProperty:
node = parent;
@@ -1062,6 +1065,8 @@ namespace ts.Completions {
const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node);
const allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker));
if (isEntityName(node) || isImportType) {
const isNamespaceName = isModuleDeclaration(node.parent);
if (isNamespaceName) isNewIdentifierLocation = true;
let symbol = typeChecker.getSymbolAtLocation(node);
if (symbol) {
symbol = skipAlias(symbol, typeChecker);
@@ -1071,13 +1076,17 @@ namespace ts.Completions {
const exportedSymbols = Debug.assertEachDefined(typeChecker.getExportsOfModule(symbol), "getExportsOfModule() should all be defined");
const isValidValueAccess = (symbol: Symbol) => typeChecker.isValidPropertyAccess(isImportType ? <ImportTypeNode>node : <PropertyAccessExpression>(node.parent), symbol.name);
const isValidTypeAccess = (symbol: Symbol) => symbolCanBeReferencedAtTypeLocation(symbol);
const isValidAccess = allowTypeOrValue ?
// Any kind is allowed when dotting off namespace in internal import equals declaration
(symbol: Symbol) => isValidTypeAccess(symbol) || isValidValueAccess(symbol) :
isTypeLocation ? isValidTypeAccess : isValidValueAccess;
for (const symbol of exportedSymbols) {
if (isValidAccess(symbol)) {
symbols.push(symbol);
const isValidAccess: (symbol: Symbol) => boolean =
isNamespaceName
// At `namespace N.M/**/`, if this is the only declaration of `M`, don't include `M` as a completion.
? symbol => !!(symbol.flags & SymbolFlags.Namespace) && !symbol.declarations.every(d => d.parent === node.parent)
: allowTypeOrValue ?
// Any kind is allowed when dotting off namespace in internal import equals declaration
symbol => isValidTypeAccess(symbol) || isValidValueAccess(symbol) :
isTypeLocation ? isValidTypeAccess : isValidValueAccess;
for (const exportedSymbol of exportedSymbols) {
if (isValidAccess(exportedSymbol)) {
symbols.push(exportedSymbol);
}
}
@@ -1461,7 +1470,8 @@ namespace ts.Completions {
function isNewIdentifierDefinitionLocation(previousToken: Node | undefined): boolean {
if (previousToken) {
const containingNodeKind = previousToken.parent.kind;
switch (previousToken.kind) {
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(previousToken)) {
case SyntaxKind.CommaToken:
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -1507,14 +1517,6 @@ namespace ts.Completions {
case SyntaxKind.ProtectedKeyword:
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
}
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(previousToken)) {
case SyntaxKind.PublicKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.PrivateKeyword:
return true;
}
}
return false;
+15 -12
View File
@@ -717,7 +717,6 @@ namespace ts.formatting {
Debug.assert(isNodeArray(nodes));
const listStartToken = getOpenTokenForList(parent, nodes);
const listEndToken = getCloseTokenForOpenToken(listStartToken);
let listDynamicIndentation = parentDynamicIndentation;
let startLine = parentStartLine;
@@ -752,17 +751,21 @@ namespace ts.formatting {
inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListItem*/ true, /*isFirstListItem*/ i === 0);
}
if (listEndToken !== SyntaxKind.Unknown) {
if (formattingScanner.isOnToken()) {
const tokenInfo = formattingScanner.readTokenInfo(parent);
// consume the list end token only if it is still belong to the parent
// there might be the case when current token matches end token but does not considered as one
// function (x: function) <--
// without this check close paren will be interpreted as list end token for function expression which is wrong
if (tokenInfo.token.kind === listEndToken && rangeContainsRange(parent, tokenInfo.token)) {
// consume list end token
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
}
const listEndToken = getCloseTokenForOpenToken(listStartToken);
if (listEndToken !== SyntaxKind.Unknown && formattingScanner.isOnToken()) {
let tokenInfo = formattingScanner.readTokenInfo(parent);
if (tokenInfo.token.kind === SyntaxKind.CommaToken && isCallLikeExpression(parent)) {
formattingScanner.advance();
tokenInfo = formattingScanner.readTokenInfo(parent);
}
// consume the list end token only if it is still belong to the parent
// there might be the case when current token matches end token but does not considered as one
// function (x: function) <--
// without this check close paren will be interpreted as list end token for function expression which is wrong
if (tokenInfo.token.kind === listEndToken && rangeContainsRange(parent, tokenInfo.token)) {
// consume list end token
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
}
}
}
+2 -9
View File
@@ -579,17 +579,10 @@ namespace ts.formatting {
function isControlFlowEndingStatement(kind: SyntaxKind, parent: TextRangeWithKind): boolean {
switch (kind) {
case SyntaxKind.ReturnStatement:
case SyntaxKind.ThrowStatement: {
if (parent.kind !== SyntaxKind.Block) {
return true;
}
const grandParent = (parent as Node).parent;
// In a function, we may want to write inner functions after this.
return !(grandParent && grandParent.kind === SyntaxKind.FunctionExpression || grandParent.kind === SyntaxKind.FunctionDeclaration);
}
case SyntaxKind.ThrowStatement:
case SyntaxKind.ContinueStatement:
case SyntaxKind.BreakStatement:
return true;
return parent.kind !== SyntaxKind.Block;
default:
return false;
}
+5 -5
View File
@@ -11,7 +11,7 @@ namespace ts.JsDoc {
"borrows",
"callback",
"class",
"classDesc",
"classdesc",
"constant",
"constructor",
"constructs",
@@ -28,16 +28,16 @@ namespace ts.JsDoc {
"external",
"field",
"file",
"fileOverview",
"fileoverview",
"fires",
"function",
"generator",
"global",
"hideConstructor",
"hideconstructor",
"host",
"ignore",
"implements",
"inheritDoc",
"inheritdoc",
"inner",
"instance",
"interface",
@@ -46,7 +46,7 @@ namespace ts.JsDoc {
"license",
"listens",
"member",
"memberOf",
"memberof",
"method",
"mixes",
"module",
+16 -9
View File
@@ -133,7 +133,7 @@ namespace ts.NavigationBar {
/** Call after calling `startNode` and adding children to it. */
function endNode(): void {
if (parent.children) {
mergeChildren(parent.children);
mergeChildren(parent.children, parent);
sortChildren(parent.children);
}
parent = parentsStack.pop()!;
@@ -304,7 +304,7 @@ namespace ts.NavigationBar {
}
/** Merge declarations of the same kind. */
function mergeChildren(children: NavigationBarNode[]): void {
function mergeChildren(children: NavigationBarNode[], node: NavigationBarNode): void {
const nameToItems = createMap<NavigationBarNode | NavigationBarNode[]>();
filterMutate(children, child => {
const declName = getNameOfDeclaration(<Declaration>child.node);
@@ -322,7 +322,7 @@ namespace ts.NavigationBar {
if (itemsWithSameName instanceof Array) {
for (const itemWithSameName of itemsWithSameName) {
if (tryMerge(itemWithSameName, child)) {
if (tryMerge(itemWithSameName, child, node)) {
return false;
}
}
@@ -331,7 +331,7 @@ namespace ts.NavigationBar {
}
else {
const itemWithSameName = itemsWithSameName;
if (tryMerge(itemWithSameName, child)) {
if (tryMerge(itemWithSameName, child, node)) {
return false;
}
nameToItems.set(name, [itemWithSameName, child]);
@@ -340,8 +340,8 @@ namespace ts.NavigationBar {
});
}
function tryMerge(a: NavigationBarNode, b: NavigationBarNode): boolean {
if (shouldReallyMerge(a.node, b.node)) {
function tryMerge(a: NavigationBarNode, b: NavigationBarNode, parent: NavigationBarNode): boolean {
if (shouldReallyMerge(a.node, b.node, parent)) {
merge(a, b);
return true;
}
@@ -349,8 +349,8 @@ namespace ts.NavigationBar {
}
/** a and b have the same name, but they may not be mergeable. */
function shouldReallyMerge(a: Node, b: Node): boolean {
if (a.kind !== b.kind) {
function shouldReallyMerge(a: Node, b: Node, parent: NavigationBarNode): boolean {
if (a.kind !== b.kind || a.parent !== b.parent && !(isOwnChild(a, parent) && isOwnChild(b, parent))) {
return false;
}
switch (a.kind) {
@@ -366,6 +366,13 @@ namespace ts.NavigationBar {
}
}
// We want to merge own children like `I` in in `module A { interface I {} } module A { interface I {} }`
// We don't want to merge unrelated children like `m` in `const o = { a: { m() {} }, b: { m() {} } };`
function isOwnChild(n: Node, parent: NavigationBarNode): boolean {
const par = isModuleBlock(n.parent) ? n.parent.parent : n.parent;
return par === parent.node || contains(parent.additionalNodes, par);
}
// We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a: ModuleDeclaration, b: ModuleDeclaration): boolean {
@@ -383,7 +390,7 @@ namespace ts.NavigationBar {
target.children = concatenate(target.children, source.children);
if (target.children) {
mergeChildren(target.children);
mergeChildren(target.children, target);
sortChildren(target.children);
}
}
@@ -515,6 +515,10 @@ namespace ts.projectSystem {
return session.executeCommand(makeSessionRequest(command, args)).response as TResponse["body"];
}
export function executeSessionRequestNoResponse<TRequest extends protocol.Request>(session: server.Session, command: TRequest["command"], args: TRequest["arguments"]): void {
session.executeCommand(makeSessionRequest(command, args));
}
export function openFilesForSession(files: ReadonlyArray<File | { readonly file: File | string, readonly projectRootPath: string }>, session: server.Session): void {
for (const file of files) {
session.executeCommand(makeSessionRequest<protocol.OpenRequestArgs>(CommandNames.Open,
@@ -9256,6 +9260,50 @@ export function Test2() {
});
});
describe("Untitled files", () => {
it("Can convert positions to locations", () => {
const aTs: File = { path: "/proj/a.ts", content: "" };
const tsconfig: File = { path: "/proj/tsconfig.json", content: "{}" };
const session = createSession(createServerHost([aTs, tsconfig]));
openFilesForSession([aTs], session);
const untitledFile = "untitled:^Untitled-1";
executeSessionRequestNoResponse<protocol.OpenRequest>(session, protocol.CommandTypes.Open, {
file: untitledFile,
fileContent: "let foo = 1;\nfooo/**/",
scriptKindName: "TS",
projectRootPath: "/proj",
});
const response = executeSessionRequest<protocol.CodeFixRequest, protocol.CodeFixResponse>(session, protocol.CommandTypes.GetCodeFixes, {
file: untitledFile,
startLine: 2,
startOffset: 1,
endLine: 2,
endOffset: 5,
errorCodes: [Diagnostics.Cannot_find_name_0_Did_you_mean_1.code],
});
assert.deepEqual<ReadonlyArray<protocol.CodeFixAction> | undefined>(response, [
{
description: "Change spelling to 'foo'",
fixAllDescription: "Fix all detected spelling errors",
fixId: "fixSpelling",
fixName: "spelling",
changes: [{
fileName: untitledFile,
textChanges: [{
start: { line: 2, offset: 1 },
end: { line: 2, offset: 5 },
newText: "foo",
}],
}],
commands: undefined,
},
]);
});
});
function makeReferenceItem(file: File, isDefinition: boolean, text: string, lineText: string, options?: SpanFromSubstringOptions): protocol.ReferencesResponseItem {
return {
...protocolFileSpanFromSubstring(file, text, options),
+5 -5
View File
@@ -14,7 +14,7 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
const versionMajorMinor = "3.0";
const versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -545,7 +545,7 @@ declare namespace ts {
}
interface TypeParameterDeclaration extends NamedDeclaration {
kind: SyntaxKind.TypeParameter;
parent: DeclarationWithTypeParameters | InferTypeNode;
parent: DeclarationWithTypeParameterChildren | InferTypeNode;
name: Identifier;
constraint?: TypeNode;
default?: TypeNode;
@@ -1317,7 +1317,8 @@ declare namespace ts {
block: Block;
}
type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
type DeclarationWithTypeParameters = DeclarationWithTypeParameterChildren | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
type DeclarationWithTypeParameterChildren = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
name?: Identifier;
@@ -2480,6 +2481,7 @@ declare namespace ts {
strictFunctionTypes?: boolean;
strictNullChecks?: boolean;
strictPropertyInitialization?: boolean;
stripInternal?: boolean;
suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget;
@@ -8893,8 +8895,6 @@ declare namespace ts.server {
private mapCodeFixAction;
private mapTextChangesToCodeEdits;
private mapTextChangeToCodeEdit;
private mapTextChangeToCodeEditUsingScriptInfoOrConfigFile;
private normalizePath;
private convertTextChangeToCodeEdit;
private getBraceMatching;
private getDiagnosticsForProject;
+5 -3
View File
@@ -14,7 +14,7 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
const versionMajorMinor = "3.0";
const versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -545,7 +545,7 @@ declare namespace ts {
}
interface TypeParameterDeclaration extends NamedDeclaration {
kind: SyntaxKind.TypeParameter;
parent: DeclarationWithTypeParameters | InferTypeNode;
parent: DeclarationWithTypeParameterChildren | InferTypeNode;
name: Identifier;
constraint?: TypeNode;
default?: TypeNode;
@@ -1317,7 +1317,8 @@ declare namespace ts {
block: Block;
}
type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
type DeclarationWithTypeParameters = DeclarationWithTypeParameterChildren | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
type DeclarationWithTypeParameterChildren = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
name?: Identifier;
@@ -2480,6 +2481,7 @@ declare namespace ts {
strictFunctionTypes?: boolean;
strictNullChecks?: boolean;
strictPropertyInitialization?: boolean;
stripInternal?: boolean;
suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget;
@@ -21,7 +21,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'.
Property 'push' is missing in type '{ 0: string; 1: number; length: 2; }'.
Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'.
Types of property 'length' are incompatible.
Type '2' is not assignable to type '1'.
@@ -29,14 +29,14 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error
Types of property 'length' are incompatible.
Type '2' is not assignable to type '1'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'.
Property 'push' is missing in type '{ 0: string; 1: number; length: 2; }'.
Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(31,5): error TS2322: Type 'StrNum' is not assignable to type '[number, string]'.
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, string]'.
Property 'push' is missing in type '{ 0: string; 1: number; length: 2; }'.
Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'.
==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (19 errors) ====
@@ -102,7 +102,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
var l3: [number] = z;
~~
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'.
!!! error TS2322: Property 'push' is missing in type '{ 0: string; 1: number; length: 2; }'.
!!! error TS2322: Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'.
var m1: [string] = x;
~~
!!! error TS2322: Type '[string, number]' is not assignable to type '[string]'.
@@ -116,7 +116,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
var m3: [string] = z;
~~
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'.
!!! error TS2322: Property 'push' is missing in type '{ 0: string; 1: number; length: 2; }'.
!!! error TS2322: Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'.
var n1: [number, string] = x;
~~
!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
@@ -129,7 +129,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
var n3: [number, string] = z;
~~
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, string]'.
!!! error TS2322: Property 'push' is missing in type '{ 0: string; 1: number; length: 2; }'.
!!! error TS2322: Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'.
var o1: [string, number] = x;
var o2: [string, number] = y;
var o3: [string, number] = y;
@@ -34,7 +34,7 @@ tests/cases/compiler/arrayAssignmentTest1.ts(77,1): error TS2322: Type 'I1[]' is
Type 'I1' is not assignable to type 'C3'.
Property 'CM3M1' is missing in type 'I1'.
tests/cases/compiler/arrayAssignmentTest1.ts(79,1): error TS2322: Type '() => C1' is not assignable to type 'any[]'.
Property 'push' is missing in type '() => C1'.
Property 'pop' is missing in type '() => C1'.
tests/cases/compiler/arrayAssignmentTest1.ts(80,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'.
Property 'length' is missing in type '{ one: number; }'.
tests/cases/compiler/arrayAssignmentTest1.ts(82,1): error TS2322: Type 'C1' is not assignable to type 'any[]'.
@@ -177,7 +177,7 @@ tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is n
arr_any = f1; // should be an error - is
~~~~~~~
!!! error TS2322: Type '() => C1' is not assignable to type 'any[]'.
!!! error TS2322: Property 'push' is missing in type '() => C1'.
!!! error TS2322: Property 'pop' is missing in type '() => C1'.
arr_any = o1; // should be an error - is
~~~~~~~
!!! error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'.
@@ -8,9 +8,9 @@ tests/cases/compiler/arrayAssignmentTest2.ts(49,1): error TS2322: Type 'I1[]' is
Type 'I1' is not assignable to type 'C3'.
Property 'CM3M1' is missing in type 'I1'.
tests/cases/compiler/arrayAssignmentTest2.ts(51,1): error TS2322: Type '() => C1' is not assignable to type 'any[]'.
Property 'push' is missing in type '() => C1'.
Property 'pop' is missing in type '() => C1'.
tests/cases/compiler/arrayAssignmentTest2.ts(52,1): error TS2322: Type '() => any' is not assignable to type 'any[]'.
Property 'push' is missing in type '() => any'.
Property 'pop' is missing in type '() => any'.
tests/cases/compiler/arrayAssignmentTest2.ts(53,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'.
Property 'length' is missing in type '{ one: number; }'.
tests/cases/compiler/arrayAssignmentTest2.ts(55,1): error TS2322: Type 'C1' is not assignable to type 'any[]'.
@@ -89,11 +89,11 @@ tests/cases/compiler/arrayAssignmentTest2.ts(58,1): error TS2322: Type 'I1' is n
arr_any = f1; // should be an error - is
~~~~~~~
!!! error TS2322: Type '() => C1' is not assignable to type 'any[]'.
!!! error TS2322: Property 'push' is missing in type '() => C1'.
!!! error TS2322: Property 'pop' is missing in type '() => C1'.
arr_any = function () { return null;} // should be an error - is
~~~~~~~
!!! error TS2322: Type '() => any' is not assignable to type 'any[]'.
!!! error TS2322: Property 'push' is missing in type '() => any'.
!!! error TS2322: Property 'pop' is missing in type '() => any'.
arr_any = o1; // should be an error - is
~~~~~~~
!!! error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'.
@@ -1,5 +1,5 @@
tests/cases/compiler/arrayAssignmentTest4.ts(22,1): error TS2322: Type '() => any' is not assignable to type 'any[]'.
Property 'push' is missing in type '() => any'.
Property 'pop' is missing in type '() => any'.
tests/cases/compiler/arrayAssignmentTest4.ts(23,1): error TS2322: Type 'C3' is not assignable to type 'any[]'.
Property 'length' is missing in type 'C3'.
@@ -29,7 +29,7 @@ tests/cases/compiler/arrayAssignmentTest4.ts(23,1): error TS2322: Type 'C3' is n
arr_any = function () { return null;} // should be an error - is
~~~~~~~
!!! error TS2322: Type '() => any' is not assignable to type 'any[]'.
!!! error TS2322: Property 'push' is missing in type '() => any'.
!!! error TS2322: Property 'pop' is missing in type '() => any'.
arr_any = c3; // should be an error - is
~~~~~~~
!!! error TS2322: Type 'C3' is not assignable to type 'any[]'.
@@ -11,12 +11,10 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'.
Property '0' is missing in type 'number[]'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
Types of property 'push' are incompatible.
Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
Types of parameters 'items' and 'items' are incompatible.
Type 'Number' is not assignable to type 'string | number'.
Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Types of property 'pop' are incompatible.
Type '() => string | number' is not assignable to type '() => Number'.
Type 'string | number' is not assignable to type 'Number'.
Type 'string' is not assignable to type 'Number'.
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (8 errors) ====
@@ -75,10 +73,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[]
~~
!!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
!!! error TS2322: Types of property 'push' are incompatible.
!!! error TS2322: Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
!!! error TS2322: Types of parameters 'items' and 'items' are incompatible.
!!! error TS2322: Type 'Number' is not assignable to type 'string | number'.
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
!!! error TS2322: 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => Number'.
!!! error TS2322: Type 'string | number' is not assignable to type 'Number'.
!!! error TS2322: Type 'string' is not assignable to type 'Number'.
@@ -86,9 +86,9 @@ A.prototype = B.prototype = {
>A : typeof A
>prototype : { [x: string]: any; m(n: number): number; }
>B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; }
>B.prototype : { [x: string]: any; }
>B.prototype : { [x: string]: any; m(n: number): number; }
>B : typeof B
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; m(n: number): number; }
>{ /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; }
/** @param {number} n */
@@ -1,9 +1,8 @@
tests/cases/conformance/salsa/mod.js(5,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
tests/cases/conformance/salsa/test.js(52,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
tests/cases/conformance/salsa/test.js(70,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
==== tests/cases/conformance/salsa/test.js (2 errors) ====
==== tests/cases/conformance/salsa/test.js (1 errors) ====
/** @typedef {{
status: 'done'
m(n: number): void
@@ -76,13 +75,11 @@ tests/cases/conformance/salsa/test.js(70,7): error TS7006: Parameter 'n' implici
F.prototype = {
status: "done",
m(n) { }
~
!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
}
==== tests/cases/conformance/salsa/mod.js (1 errors) ====
// module.exports assignment
/** @type {{ status: 'done' }} */
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
status: "done",
m(n) { }
@@ -158,7 +158,7 @@ F.prototype = {
=== tests/cases/conformance/salsa/mod.js ===
// module.exports assignment
/** @type {{ status: 'done' }} */
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
>module : Symbol(export=, Decl(mod.js, 0, 0))
>exports : Symbol(export=, Decl(mod.js, 0, 0))
@@ -172,24 +172,24 @@ function F() {
}
/** @type {DoneStatus} */
F.prototype = {
>F.prototype = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
>F.prototype : { [x: string]: any; }
>F.prototype = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
>F.prototype : { status: "done"; m(n: number): void; }
>F : typeof F
>prototype : { [x: string]: any; }
>{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
>prototype : { status: "done"; m(n: number): void; }
>{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
status: "done",
>status : string
>status : "done"
>"done" : "done"
m(n) { }
>m : (n: any) => void
>n : any
>m : (n: number) => void
>n : number
}
=== tests/cases/conformance/salsa/mod.js ===
// module.exports assignment
/** @type {{ status: 'done' }} */
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
>module.exports = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
>module.exports : any
@@ -0,0 +1,12 @@
tests/cases/compiler/duplicateDefaultExport.ts(1,1): error TS2528: A module cannot have multiple default exports.
tests/cases/compiler/duplicateDefaultExport.ts(2,1): error TS2528: A module cannot have multiple default exports.
==== tests/cases/compiler/duplicateDefaultExport.ts (2 errors) ====
export default 0;
~~~~~~~~~~~~~~~~~
!!! error TS2528: A module cannot have multiple default exports.
export default function() {}
~~~~~~
!!! error TS2528: A module cannot have multiple default exports.
@@ -0,0 +1,11 @@
//// [duplicateDefaultExport.ts]
export default 0;
export default function() {}
//// [duplicateDefaultExport.js]
"use strict";
exports.__esModule = true;
exports["default"] = 0;
function default_1() { }
exports["default"] = default_1;
@@ -0,0 +1,5 @@
=== tests/cases/compiler/duplicateDefaultExport.ts ===
export default 0;
No type information for this code.export default function() {}
No type information for this code.
No type information for this code.
@@ -0,0 +1,5 @@
=== tests/cases/compiler/duplicateDefaultExport.ts ===
export default 0;
No type information for this code.export default function() {}
No type information for this code.
No type information for this code.
@@ -0,0 +1,9 @@
=== tests/cases/conformance/jsdoc/paren.js ===
/** @type {function((string), function((string)): string): string} */
var x = (s, id) => id(s)
>x : Symbol(x, Decl(paren.js, 1, 3))
>s : Symbol(s, Decl(paren.js, 1, 9))
>id : Symbol(id, Decl(paren.js, 1, 11))
>id : Symbol(id, Decl(paren.js, 1, 11))
>s : Symbol(s, Decl(paren.js, 1, 9))
@@ -0,0 +1,11 @@
=== tests/cases/conformance/jsdoc/paren.js ===
/** @type {function((string), function((string)): string): string} */
var x = (s, id) => id(s)
>x : (arg0: string, arg1: (arg0: string) => string) => string
>(s, id) => id(s) : (s: string, id: (arg0: string) => string) => string
>s : string
>id : (arg0: string) => string
>id(s) : string
>id : (arg0: string) => string
>s : string
@@ -0,0 +1,9 @@
=== tests/cases/conformance/jsdoc/paren.js ===
/** @type {function((string)): string} */
var x = s => s.toString()
>x : Symbol(x, Decl(paren.js, 1, 3))
>s : Symbol(s, Decl(paren.js, 1, 7))
>s.toString : Symbol(String.toString, Decl(lib.es5.d.ts, --, --))
>s : Symbol(s, Decl(paren.js, 1, 7))
>toString : Symbol(String.toString, Decl(lib.es5.d.ts, --, --))
@@ -0,0 +1,11 @@
=== tests/cases/conformance/jsdoc/paren.js ===
/** @type {function((string)): string} */
var x = s => s.toString()
>x : (arg0: string) => string
>s => s.toString() : (s: string) => string
>s : string
>s.toString() : string
>s.toString : () => string
>s : string
>toString : () => string
@@ -88,7 +88,7 @@ type K10 = keyof Shape; // "name" | "width" | "height" | "visible"
>Shape : Shape
type K11 = keyof Shape[]; // "length" | "toString" | ...
>K11 : number | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
>K11 : number | "length" | "toString" | "toLocaleString" | "pop" | "push" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
>Shape : Shape
type K12 = keyof Dictionary<Shape>; // string
@@ -108,7 +108,7 @@ type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ...
>E : E
type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ...
>K16 : number | "0" | "1" | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
>K16 : number | "0" | "1" | "length" | "toString" | "toLocaleString" | "pop" | "push" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
type K17 = keyof (Shape | Item); // "name"
>K17 : "name"
@@ -0,0 +1,23 @@
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel.ts(11,8): error TS1235: A namespace declaration is only allowed in a namespace or module.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel.ts(12,8): error TS1235: A namespace declaration is only allowed in a namespace or module.
==== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel.ts (2 errors) ====
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
~~~~~~
!!! error TS1235: A namespace declaration is only allowed in a namespace or module.
label: namespace N {}
~~~~~~~~~
!!! error TS1235: A namespace declaration is only allowed in a namespace or module.
label: type T = {}
@@ -0,0 +1,80 @@
//// [labeledStatementWithLabel.ts]
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
label: namespace N {}
label: type T = {}
//// [labeledStatementWithLabel.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
label: function fn() { }
label: function gen() { return __generator(this, function (_a) {
return [2 /*return*/];
}); }
label: function gen1() {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); });
}
label: {
var E;
(function (E) {
})(E || (E = {}));
}
label:
label: {
var C = /** @class */ (function () {
function C() {
}
return C;
}());
}
label: var a = 1;
label: var b = 1;
label: var c = 1;
label:
label:
label:
@@ -0,0 +1,37 @@
=== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel.ts ===
label: function fn() { }
>fn : Symbol(fn, Decl(labeledStatementWithLabel.ts, 0, 6))
label: function* gen() { }
>gen : Symbol(gen, Decl(labeledStatementWithLabel.ts, 1, 6))
label: async function gen1() { }
>gen1 : Symbol(gen1, Decl(labeledStatementWithLabel.ts, 2, 6))
label: enum E {}
>E : Symbol(E, Decl(labeledStatementWithLabel.ts, 3, 6))
label: interface I {}
>I : Symbol(I, Decl(labeledStatementWithLabel.ts, 4, 6))
label: class C { }
>C : Symbol(C, Decl(labeledStatementWithLabel.ts, 5, 6))
label: var a = 1;
>a : Symbol(a, Decl(labeledStatementWithLabel.ts, 6, 10))
label: let b = 1;
>b : Symbol(b, Decl(labeledStatementWithLabel.ts, 7, 10))
label: const c = 1;
>c : Symbol(c, Decl(labeledStatementWithLabel.ts, 8, 12))
label: module M { }
>M : Symbol(M, Decl(labeledStatementWithLabel.ts, 10, 6))
label: namespace N {}
>N : Symbol(N, Decl(labeledStatementWithLabel.ts, 11, 6))
label: type T = {}
>T : Symbol(T, Decl(labeledStatementWithLabel.ts, 12, 6))
@@ -0,0 +1,52 @@
=== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel.ts ===
label: function fn() { }
>label : any
>fn : () => void
label: function* gen() { }
>label : any
>gen : () => IterableIterator<any>
label: async function gen1() { }
>label : any
>gen1 : () => Promise<void>
label: enum E {}
>label : any
>E : E
label: interface I {}
>label : any
>I : I
label: class C { }
>label : any
>C : C
label: var a = 1;
>label : any
>a : number
>1 : 1
label: let b = 1;
>label : any
>b : number
>1 : 1
label: const c = 1;
>label : any
>c : 1
>1 : 1
label: module M { }
>label : any
>M : any
label: namespace N {}
>label : any
>N : any
label: type T = {}
>label : any
>T : {}
@@ -0,0 +1,23 @@
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_es2015.ts(11,8): error TS1235: A namespace declaration is only allowed in a namespace or module.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_es2015.ts(12,8): error TS1235: A namespace declaration is only allowed in a namespace or module.
==== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_es2015.ts (2 errors) ====
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
~~~~~~
!!! error TS1235: A namespace declaration is only allowed in a namespace or module.
label: namespace N {}
~~~~~~~~~
!!! error TS1235: A namespace declaration is only allowed in a namespace or module.
label: type T = {}
@@ -0,0 +1,44 @@
//// [labeledStatementWithLabel_es2015.ts]
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
label: namespace N {}
label: type T = {}
//// [labeledStatementWithLabel_es2015.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
label: function fn() { }
label: function* gen() { }
label: function gen1() {
return __awaiter(this, void 0, void 0, function* () { });
}
label: {
var E;
(function (E) {
})(E || (E = {}));
}
label:
label: class C {
}
label: var a = 1;
label: let b = 1;
label: const c = 1;
label:
label:
label:
@@ -0,0 +1,37 @@
=== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_es2015.ts ===
label: function fn() { }
>fn : Symbol(fn, Decl(labeledStatementWithLabel_es2015.ts, 0, 6))
label: function* gen() { }
>gen : Symbol(gen, Decl(labeledStatementWithLabel_es2015.ts, 1, 6))
label: async function gen1() { }
>gen1 : Symbol(gen1, Decl(labeledStatementWithLabel_es2015.ts, 2, 6))
label: enum E {}
>E : Symbol(E, Decl(labeledStatementWithLabel_es2015.ts, 3, 6))
label: interface I {}
>I : Symbol(I, Decl(labeledStatementWithLabel_es2015.ts, 4, 6))
label: class C { }
>C : Symbol(C, Decl(labeledStatementWithLabel_es2015.ts, 5, 6))
label: var a = 1;
>a : Symbol(a, Decl(labeledStatementWithLabel_es2015.ts, 6, 10))
label: let b = 1;
>b : Symbol(b, Decl(labeledStatementWithLabel_es2015.ts, 7, 10))
label: const c = 1;
>c : Symbol(c, Decl(labeledStatementWithLabel_es2015.ts, 8, 12))
label: module M { }
>M : Symbol(M, Decl(labeledStatementWithLabel_es2015.ts, 10, 6))
label: namespace N {}
>N : Symbol(N, Decl(labeledStatementWithLabel_es2015.ts, 11, 6))
label: type T = {}
>T : Symbol(T, Decl(labeledStatementWithLabel_es2015.ts, 12, 6))
@@ -0,0 +1,52 @@
=== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_es2015.ts ===
label: function fn() { }
>label : any
>fn : () => void
label: function* gen() { }
>label : any
>gen : () => IterableIterator<any>
label: async function gen1() { }
>label : any
>gen1 : () => Promise<void>
label: enum E {}
>label : any
>E : E
label: interface I {}
>label : any
>I : I
label: class C { }
>label : any
>C : C
label: var a = 1;
>label : any
>a : number
>1 : 1
label: let b = 1;
>label : any
>b : number
>1 : 1
label: const c = 1;
>label : any
>c : 1
>1 : 1
label: module M { }
>label : any
>M : any
label: namespace N {}
>label : any
>N : any
label: type T = {}
>label : any
>T : {}
@@ -0,0 +1,60 @@
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(2,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(3,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(4,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(5,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(6,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(7,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(8,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(9,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(10,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(12,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(12,8): error TS1235: A namespace declaration is only allowed in a namespace or module.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(13,1): error TS1344: 'A label is not allowed here.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(13,8): error TS1235: A namespace declaration is only allowed in a namespace or module.
tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts(14,1): error TS1344: 'A label is not allowed here.
==== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts (14 errors) ====
"use strict"
label: function fn() { }
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: function* gen() { }
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: async function gen1() { }
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: enum E {}
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: interface I {}
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: class C { }
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: var a = 1;
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: let b = 1;
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: const c = 1;
~~~~~
!!! error TS1344: 'A label is not allowed here.
label: module M { }
~~~~~
!!! error TS1344: 'A label is not allowed here.
~~~~~~
!!! error TS1235: A namespace declaration is only allowed in a namespace or module.
label: namespace N {}
~~~~~
!!! error TS1344: 'A label is not allowed here.
~~~~~~~~~
!!! error TS1235: A namespace declaration is only allowed in a namespace or module.
label: type T = {}
~~~~~
!!! error TS1344: 'A label is not allowed here.
@@ -0,0 +1,46 @@
//// [labeledStatementWithLabel_strict.ts]
"use strict"
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
label: namespace N {}
label: type T = {}
//// [labeledStatementWithLabel_strict.js]
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
label: function fn() { }
label: function* gen() { }
label: function gen1() {
return __awaiter(this, void 0, void 0, function* () { });
}
label: {
var E;
(function (E) {
})(E || (E = {}));
}
label:
label: class C {
}
label: var a = 1;
label: let b = 1;
label: const c = 1;
label:
label:
label:
@@ -0,0 +1,38 @@
=== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts ===
"use strict"
label: function fn() { }
>fn : Symbol(fn, Decl(labeledStatementWithLabel_strict.ts, 1, 6))
label: function* gen() { }
>gen : Symbol(gen, Decl(labeledStatementWithLabel_strict.ts, 2, 6))
label: async function gen1() { }
>gen1 : Symbol(gen1, Decl(labeledStatementWithLabel_strict.ts, 3, 6))
label: enum E {}
>E : Symbol(E, Decl(labeledStatementWithLabel_strict.ts, 4, 6))
label: interface I {}
>I : Symbol(I, Decl(labeledStatementWithLabel_strict.ts, 5, 6))
label: class C { }
>C : Symbol(C, Decl(labeledStatementWithLabel_strict.ts, 6, 6))
label: var a = 1;
>a : Symbol(a, Decl(labeledStatementWithLabel_strict.ts, 7, 10))
label: let b = 1;
>b : Symbol(b, Decl(labeledStatementWithLabel_strict.ts, 8, 10))
label: const c = 1;
>c : Symbol(c, Decl(labeledStatementWithLabel_strict.ts, 9, 12))
label: module M { }
>M : Symbol(M, Decl(labeledStatementWithLabel_strict.ts, 11, 6))
label: namespace N {}
>N : Symbol(N, Decl(labeledStatementWithLabel_strict.ts, 12, 6))
label: type T = {}
>T : Symbol(T, Decl(labeledStatementWithLabel_strict.ts, 13, 6))
@@ -0,0 +1,55 @@
=== tests/cases/conformance/statements/labeledStatements/labeledStatementWithLabel_strict.ts ===
"use strict"
>"use strict" : "use strict"
label: function fn() { }
>label : any
>fn : () => void
label: function* gen() { }
>label : any
>gen : () => IterableIterator<any>
label: async function gen1() { }
>label : any
>gen1 : () => Promise<void>
label: enum E {}
>label : any
>E : E
label: interface I {}
>label : any
>I : I
label: class C { }
>label : any
>C : C
label: var a = 1;
>label : any
>a : number
>1 : 1
label: let b = 1;
>label : any
>b : number
>1 : 1
label: const c = 1;
>label : any
>c : 1
>1 : 1
label: module M { }
>label : any
>M : any
label: namespace N {}
>label : any
>N : any
label: type T = {}
>label : any
>T : {}
@@ -0,0 +1,46 @@
tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts(10,9): error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'.
Types of property 'pop' are incompatible.
Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'.
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'.
Types of property 'pop' are incompatible.
Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'.
Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'.
Types of property 'pop' are incompatible.
Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'.
Type '{ foo: string; jj: number; }' is not assignable to type 'Style'.
Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
==== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts (1 errors) ====
type Style = StyleBase | StyleArray;
interface StyleArray extends Array<Style> {}
interface StyleBase {
foo: string;
}
const blah: Style = [
[[{
foo: 'asdf',
jj: 1 // intentional error
~~~~~
!!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }' is not assignable to type 'Style'.
!!! error TS2322: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
}]]
];
@@ -0,0 +1,23 @@
//// [nestedRecursiveArraysOrObjectsError01.ts]
type Style = StyleBase | StyleArray;
interface StyleArray extends Array<Style> {}
interface StyleBase {
foo: string;
}
const blah: Style = [
[[{
foo: 'asdf',
jj: 1 // intentional error
}]]
];
//// [nestedRecursiveArraysOrObjectsError01.js]
var blah = [
[[{
foo: 'asdf',
jj: 1 // intentional error
}]]
];
@@ -0,0 +1,33 @@
=== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts ===
type Style = StyleBase | StyleArray;
>Style : Symbol(Style, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 0))
>StyleBase : Symbol(StyleBase, Decl(nestedRecursiveArraysOrObjectsError01.ts, 1, 44))
>StyleArray : Symbol(StyleArray, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 36))
interface StyleArray extends Array<Style> {}
>StyleArray : Symbol(StyleArray, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 36))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Style : Symbol(Style, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 0))
interface StyleBase {
>StyleBase : Symbol(StyleBase, Decl(nestedRecursiveArraysOrObjectsError01.ts, 1, 44))
foo: string;
>foo : Symbol(StyleBase.foo, Decl(nestedRecursiveArraysOrObjectsError01.ts, 2, 21))
}
const blah: Style = [
>blah : Symbol(blah, Decl(nestedRecursiveArraysOrObjectsError01.ts, 6, 5))
>Style : Symbol(Style, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 0))
[[{
foo: 'asdf',
>foo : Symbol(foo, Decl(nestedRecursiveArraysOrObjectsError01.ts, 7, 7))
jj: 1 // intentional error
>jj : Symbol(jj, Decl(nestedRecursiveArraysOrObjectsError01.ts, 8, 20))
}]]
];
@@ -0,0 +1,40 @@
=== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts ===
type Style = StyleBase | StyleArray;
>Style : Style
>StyleBase : StyleBase
>StyleArray : StyleArray
interface StyleArray extends Array<Style> {}
>StyleArray : StyleArray
>Array : T[]
>Style : Style
interface StyleBase {
>StyleBase : StyleBase
foo: string;
>foo : string
}
const blah: Style = [
>blah : Style
>Style : Style
>[ [[{ foo: 'asdf', jj: 1 // intentional error }]]] : { foo: string; jj: number; }[][][]
[[{
>[[{ foo: 'asdf', jj: 1 // intentional error }]] : { foo: string; jj: number; }[][]
>[{ foo: 'asdf', jj: 1 // intentional error }] : { foo: string; jj: number; }[]
>{ foo: 'asdf', jj: 1 // intentional error } : { foo: string; jj: number; }
foo: 'asdf',
>foo : string
>'asdf' : "asdf"
jj: 1 // intentional error
>jj : number
>1 : 1
}]]
];
@@ -0,0 +1,30 @@
tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts(9,5): error TS2322: Type '{ bar: { prop: number; }; }[]' is not assignable to type 'Foo[]'.
Type '{ bar: { prop: number; }; }' is not assignable to type 'Foo'.
Types of property 'bar' are incompatible.
Type '{ prop: number; }' is not assignable to type 'Bar | Bar[]'.
Type '{ prop: number; }' is not assignable to type 'Bar'.
Types of property 'prop' are incompatible.
Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts (1 errors) ====
interface Foo {
bar: Bar | Bar[];
}
interface Bar {
prop: string;
}
let x: Foo[] = [
~
!!! error TS2322: Type '{ bar: { prop: number; }; }[]' is not assignable to type 'Foo[]'.
!!! error TS2322: Type '{ bar: { prop: number; }; }' is not assignable to type 'Foo'.
!!! error TS2322: Types of property 'bar' are incompatible.
!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'Bar | Bar[]'.
!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'Bar'.
!!! error TS2322: Types of property 'prop' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
{ bar: { prop: 100 } }
]
@@ -0,0 +1,18 @@
//// [objectLiteralsAgainstUnionsOfArrays01.ts]
interface Foo {
bar: Bar | Bar[];
}
interface Bar {
prop: string;
}
let x: Foo[] = [
{ bar: { prop: 100 } }
]
//// [objectLiteralsAgainstUnionsOfArrays01.js]
var x = [
{ bar: { prop: 100 } }
];
@@ -0,0 +1,27 @@
=== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 0))
bar: Bar | Bar[];
>bar : Symbol(Foo.bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 15))
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
}
interface Bar {
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
prop: string;
>prop : Symbol(Bar.prop, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 4, 15))
}
let x: Foo[] = [
>x : Symbol(x, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 8, 3))
>Foo : Symbol(Foo, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 0))
{ bar: { prop: 100 } }
>bar : Symbol(bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 9, 3))
>prop : Symbol(prop, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 9, 10))
]
@@ -0,0 +1,31 @@
=== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts ===
interface Foo {
>Foo : Foo
bar: Bar | Bar[];
>bar : Bar | Bar[]
>Bar : Bar
>Bar : Bar
}
interface Bar {
>Bar : Bar
prop: string;
>prop : string
}
let x: Foo[] = [
>x : Foo[]
>Foo : Foo
>[ { bar: { prop: 100 } }] : { bar: { prop: number; }; }[]
{ bar: { prop: 100 } }
>{ bar: { prop: 100 } } : { bar: { prop: number; }; }
>bar : { prop: number; }
>{ prop: 100 } : { prop: number; }
>prop : number
>100 : 100
]
@@ -0,0 +1,7 @@
//// [optionsStrictPropertyInitializationStrict.ts]
var x;
//// [optionsStrictPropertyInitializationStrict.js]
"use strict";
var x;
@@ -0,0 +1,4 @@
=== tests/cases/compiler/optionsStrictPropertyInitializationStrict.ts ===
var x;
>x : Symbol(x, Decl(optionsStrictPropertyInitializationStrict.ts, 0, 3))
@@ -0,0 +1,4 @@
=== tests/cases/compiler/optionsStrictPropertyInitializationStrict.ts ===
var x;
>x : any
@@ -1,9 +1,10 @@
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(5,11): error TS2558: Expected 0-2 type arguments, but got 3.
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,1): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,15): error TS2558: Expected 0-2 type arguments, but got 3.
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(9,1): error TS2554: Expected 1 arguments, but got 0.
==== tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts (3 errors) ====
==== tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts (4 errors) ====
declare function Callbacks(flags?: string): void;
declare function Callbacks<T>(flags?: string): void;
declare function Callbacks<T1, T2>(flags?: string): void;
@@ -15,4 +16,10 @@ tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,15): error TS2558:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 0-2 type arguments, but got 3.
!!! error TS2558: Expected 0-2 type arguments, but got 3.
declare function f<A, B = {}>(arg: number): void;
f<number>(); // wrong number of arguments (#25683)
~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 0.
@@ -4,8 +4,13 @@ declare function Callbacks<T>(flags?: string): void;
declare function Callbacks<T1, T2>(flags?: string): void;
Callbacks<number, string, boolean>('s'); // wrong number of type arguments
new Callbacks<number, string, boolean>('s'); // wrong number of type arguments
new Callbacks<number, string, boolean>('s'); // wrong number of type arguments
declare function f<A, B = {}>(arg: number): void;
f<number>(); // wrong number of arguments (#25683)
//// [overloadsAndTypeArgumentArityErrors.js]
Callbacks('s'); // wrong number of type arguments
new Callbacks('s'); // wrong number of type arguments
f(); // wrong number of arguments (#25683)
@@ -20,3 +20,12 @@ Callbacks<number, string, boolean>('s'); // wrong number of type arguments
new Callbacks<number, string, boolean>('s'); // wrong number of type arguments
>Callbacks : Symbol(Callbacks, Decl(overloadsAndTypeArgumentArityErrors.ts, 0, 0), Decl(overloadsAndTypeArgumentArityErrors.ts, 0, 49), Decl(overloadsAndTypeArgumentArityErrors.ts, 1, 52))
declare function f<A, B = {}>(arg: number): void;
>f : Symbol(f, Decl(overloadsAndTypeArgumentArityErrors.ts, 5, 44))
>A : Symbol(A, Decl(overloadsAndTypeArgumentArityErrors.ts, 7, 19))
>B : Symbol(B, Decl(overloadsAndTypeArgumentArityErrors.ts, 7, 21))
>arg : Symbol(arg, Decl(overloadsAndTypeArgumentArityErrors.ts, 7, 30))
f<number>(); // wrong number of arguments (#25683)
>f : Symbol(f, Decl(overloadsAndTypeArgumentArityErrors.ts, 5, 44))
@@ -24,3 +24,13 @@ new Callbacks<number, string, boolean>('s'); // wrong number of type arguments
>Callbacks : { (flags?: string): void; <T>(flags?: string): void; <T1, T2>(flags?: string): void; }
>'s' : "s"
declare function f<A, B = {}>(arg: number): void;
>f : <A, B = {}>(arg: number) => void
>A : A
>B : B
>arg : number
f<number>(); // wrong number of arguments (#25683)
>f<number>() : any
>f : <A, B = {}>(arg: number) => void
@@ -87,7 +87,7 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>p1 : T
var {...r2} = p2; // OK
>r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
>r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
>p2 : T[]
var {...r3} = t; // Error, generic type paramter
@@ -89,8 +89,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>p1 : T
var o2 = { ...p2 }; // OK
>o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
>{ ...p2 } : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
>o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
>{ ...p2 } : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
>p2 : T[]
var o3 = { ...t }; // Error, generic type paramter
@@ -5,9 +5,9 @@ var Inner = function() {}
Inner.prototype = {
>Inner.prototype = { m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
>Inner.prototype : { [x: string]: any; }
>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; m(): void; i: number; }
>{ m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
m() { },
@@ -21,18 +21,18 @@ Inner.prototype = {
Inner.prototype.j = 2
>Inner.prototype.j = 2 : 2
>Inner.prototype.j : any
>Inner.prototype : { [x: string]: any; }
>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; m(): void; i: number; }
>j : any
>2 : 2
/** @type {string} */
Inner.prototype.k;
>Inner.prototype.k : any
>Inner.prototype : { [x: string]: any; }
>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; m(): void; i: number; }
>k : any
var inner = new Inner()
@@ -12,11 +12,11 @@ Outer.Inner = function() {}
Outer.Inner.prototype = {
>Outer.Inner.prototype = { m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
>Outer.Inner.prototype : { [x: string]: any; }
>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : typeof Outer
>Inner : typeof Inner
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; m(): void; i: number; }
>{ m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
m() { },
@@ -30,22 +30,22 @@ Outer.Inner.prototype = {
Outer.Inner.prototype.j = 2
>Outer.Inner.prototype.j = 2 : 2
>Outer.Inner.prototype.j : any
>Outer.Inner.prototype : { [x: string]: any; }
>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : typeof Outer
>Inner : typeof Inner
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; m(): void; i: number; }
>j : any
>2 : 2
/** @type {string} */
Outer.Inner.prototype.k;
>Outer.Inner.prototype.k : any
>Outer.Inner.prototype : { [x: string]: any; }
>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : typeof Outer
>Inner : typeof Inner
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; m(): void; i: number; }
>k : any
var inner = new Outer.Inner()
@@ -5,19 +5,19 @@ var Outer = {};
=== tests/cases/conformance/salsa/work.js ===
Outer.Inner = function () {}
>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
>Inner : { (): void; prototype: { [x: string]: any; }; }
>function () {} : { (): void; prototype: { [x: string]: any; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
Outer.Inner.prototype = {
>Outer.Inner.prototype = { x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
>Outer.Inner.prototype : { [x: string]: any; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner.prototype : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
>Inner : { (): void; prototype: { [x: string]: any; }; }
>prototype : { [x: string]: any; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>prototype : { [x: string]: any; x: number; m(): void; }
>{ x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
x: 1,
@@ -47,9 +47,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : { [x: string]: any; x: number; m(): void; }
>new Outer.Inner() : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
>Inner : { (): void; prototype: { [x: string]: any; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
inno.x
>inno.x : number
@@ -4,19 +4,19 @@ var Outer = {};
>{} : { [x: string]: any; }
Outer.Inner = function () {}
>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
>Inner : { (): void; prototype: { [x: string]: any; }; }
>function () {} : { (): void; prototype: { [x: string]: any; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
Outer.Inner.prototype = {
>Outer.Inner.prototype = { x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
>Outer.Inner.prototype : { [x: string]: any; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner.prototype : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
>Inner : { (): void; prototype: { [x: string]: any; }; }
>prototype : { [x: string]: any; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>prototype : { [x: string]: any; x: number; m(): void; }
>{ x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
x: 1,
@@ -45,9 +45,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : { [x: string]: any; x: number; m(): void; }
>new Outer.Inner() : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
>Inner : { (): void; prototype: { [x: string]: any; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
inno.x
>inno.x : number
@@ -10,9 +10,9 @@ function C() { this.p = 1; }
C.prototype = { q: 2 };
>C.prototype = { q: 2 } : { [x: string]: any; q: number; }
>C.prototype : { [x: string]: any; }
>C.prototype : { [x: string]: any; q: number; }
>C : typeof C
>prototype : { [x: string]: any; }
>prototype : { [x: string]: any; q: number; }
>{ q: 2 } : { [x: string]: any; q: number; }
>q : number
>2 : 2
@@ -36,7 +36,7 @@ node_modules/adonis-framework/src/Env/index.js(56,15): error TS2304: Cannot find
node_modules/adonis-framework/src/Env/index.js(80,15): error TS2304: Cannot find name 'Mixed'.
node_modules/adonis-framework/src/Event/index.js(13,21): error TS2307: Cannot find module 'adonis-fold'.
node_modules/adonis-framework/src/Event/index.js(128,5): error TS2322: Type '() => {}[]' is not assignable to type 'any[]'.
Property 'push' is missing in type '() => {}[]'.
Property 'pop' is missing in type '() => {}[]'.
node_modules/adonis-framework/src/Event/index.js(153,25): error TS2339: Property 'wildcard' does not exist on type 'EventEmitter2'.
node_modules/adonis-framework/src/Event/index.js(188,17): error TS2304: Cannot find name 'Spread'.
node_modules/adonis-framework/src/Event/index.js(207,24): error TS2304: Cannot find name 'Sring'.
+1 -1
View File
@@ -129,7 +129,7 @@ node_modules/async/dist/async.js(2450,5): error TS2322: Type '{ [x: string]: any
Property 'exports' is missing in type '{ [x: string]: any; _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturated: () => void; buffer: number; empty: () => void; drain: () => void; error: () => void; started: boolean; paused: boolean; ... 10 more ...; resume: () => void; }'.
node_modules/async/dist/async.js(2521,9): error TS2722: Cannot invoke an object which is possibly 'undefined'.
node_modules/async/dist/async.js(2564,31): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'.
Property 'push' is missing in type 'IArguments'.
Property 'pop' is missing in type 'IArguments'.
node_modules/async/dist/async.js(2663,16): error TS2722: Cannot invoke an object which is possibly 'undefined'.
node_modules/async/dist/async.js(2682,31): error TS1005: ']' expected.
node_modules/async/dist/async.js(2707,31): error TS1005: ']' expected.
+2 -2
View File
@@ -5,7 +5,7 @@ node_modules/bcryptjs/scripts/build.js(32,1): error TS2322: Type '{ VERSION: any
Property 'ISAAC' is missing in type '{ VERSION: any; }'.
node_modules/bcryptjs/src/bcrypt/impl.js(516,22): error TS2345: Argument of type 'number[] | Int32Array' is not assignable to parameter of type 'number[]'.
Type 'Int32Array' is not assignable to type 'number[]'.
Property 'push' is missing in type 'Int32Array'.
Property 'pop' is missing in type 'Int32Array'.
node_modules/bcryptjs/src/bcrypt/impl.js(546,26): error TS2345: Argument of type 'null' is not assignable to parameter of type 'Error'.
node_modules/bcryptjs/src/bcrypt/impl.js(658,23): error TS2345: Argument of type 'number[] | undefined' is not assignable to parameter of type 'number[]'.
Type 'undefined' is not assignable to type 'number[]'.
@@ -21,7 +21,7 @@ node_modules/bcryptjs/src/bcrypt/prng/accum.js(66,22): error TS2339: Property 'd
node_modules/bcryptjs/src/bcrypt/prng/accum.js(67,22): error TS2339: Property 'detachEvent' does not exist on type 'Document'.
node_modules/bcryptjs/src/bcrypt/util.js(20,5): error TS2304: Cannot find name 'utfx'.
node_modules/bcryptjs/src/bcrypt.js(25,13): error TS2322: Type 'Buffer' is not assignable to type 'number[]'.
Property 'push' is missing in type 'Buffer'.
Property 'pop' is missing in type 'Buffer'.
node_modules/bcryptjs/src/bcrypt.js(94,14): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
node_modules/bcryptjs/src/bcrypt.js(150,5): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
@@ -6439,7 +6439,7 @@ node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionTraceProvide
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionTraceProvider.js(31,32): error TS2339: Property 'stopTraceRecording' does not exist on type 'typeof extensionServer'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionView.js(50,18): error TS2339: Property 'src' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionView.js(74,22): error TS2352: Type 'Window' cannot be converted to type 'Window[]'.
Property 'push' is missing in type 'Window'.
Property 'pop' is missing in type 'Window'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionView.js(75,74): error TS2339: Property 'contentWindow' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/extensions_test_runner/ExtensionsNetworkTestRunner.js(23,5): error TS2304: Cannot find name 'output'.
node_modules/chrome-devtools-frontend/front_end/extensions_test_runner/ExtensionsNetworkTestRunner.js(27,3): error TS2304: Cannot find name 'webInspector'.
@@ -6786,7 +6786,7 @@ node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapsho
node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(314,5): error TS2322: Type 'void' is not assignable to type 'HeapSnapshotNode'.
node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(759,27): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(918,34): error TS2345: Argument of type 'Uint32Array' is not assignable to parameter of type 'number[]'.
Property 'push' is missing in type 'Uint32Array'.
Property 'pop' is missing in type 'Uint32Array'.
node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(920,34): error TS2345: Argument of type 'Uint32Array' is not assignable to parameter of type 'number[]'.
node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(1045,5): error TS2322: Type 'void' is not assignable to type 'HeapSnapshotNode'.
node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(1083,14): error TS2339: Property 'key' does not exist on type '(arg0: HeapSnapshotNode) => boolean'.
@@ -10875,7 +10875,7 @@ node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(20,41): erro
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(110,26): error TS2554: Expected 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(129,32): error TS2345: Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string | string[]'.
Type 'TemplateStringsArray' is not assignable to type 'string[]'.
Property 'push' is missing in type 'TemplateStringsArray'.
Property 'pop' is missing in type 'TemplateStringsArray'.
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(134,32): error TS2345: Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string | string[]'.
Type 'TemplateStringsArray' is not assignable to type 'string[]'.
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(139,30): error TS2345: Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string | string[]'.
+1 -1
View File
@@ -228,7 +228,7 @@ node_modules/lodash/core.js(3424,41): error TS2345: Argument of type 'Function'
Type 'Function' provides no match for the signature '(substring: string, ...args: any[]): string'.
node_modules/lodash/core.js(3573,51): error TS2532: Object is possibly 'undefined'.
node_modules/lodash/core.js(3590,63): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'.
Property 'push' is missing in type 'IArguments'.
Property 'pop' is missing in type 'IArguments'.
node_modules/lodash/core.js(3830,14): error TS2304: Cannot find name 'define'.
node_modules/lodash/core.js(3830,45): error TS2304: Cannot find name 'define'.
node_modules/lodash/core.js(3830,71): error TS2304: Cannot find name 'define'.
+5 -4
View File
@@ -52,10 +52,11 @@ node_modules/uglify-js/lib/compress.js(6340,25): error TS2403: Subsequent variab
node_modules/uglify-js/lib/compress.js(6368,19): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/minify.js(170,75): error TS2339: Property 'compress' does not exist on type 'Compressor'.
node_modules/uglify-js/lib/mozilla-ast.js(566,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/output.js(481,22): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/output.js(774,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/output.js(1170,29): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/output.js(1452,58): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
node_modules/uglify-js/lib/output.js(246,9): error TS2554: Expected 0 arguments, but got 2.
node_modules/uglify-js/lib/output.js(475,22): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/output.js(775,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/output.js(1171,29): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/output.js(1453,58): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
node_modules/uglify-js/lib/parse.js(367,20): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
node_modules/uglify-js/lib/parse.js(449,32): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
@@ -0,0 +1,2 @@
export default 0;
export default function() {}
@@ -0,0 +1,13 @@
type Style = StyleBase | StyleArray;
interface StyleArray extends Array<Style> {}
interface StyleBase {
foo: string;
}
const blah: Style = [
[[{
foo: 'asdf',
jj: 1 // intentional error
}]]
];
@@ -0,0 +1,11 @@
interface Foo {
bar: Bar | Bar[];
}
interface Bar {
prop: string;
}
let x: Foo[] = [
{ bar: { prop: 100 } }
]
@@ -0,0 +1,4 @@
// @strict: true
// @strictPropertyInitialization: true
var x;
@@ -3,4 +3,7 @@ declare function Callbacks<T>(flags?: string): void;
declare function Callbacks<T1, T2>(flags?: string): void;
Callbacks<number, string, boolean>('s'); // wrong number of type arguments
new Callbacks<number, string, boolean>('s'); // wrong number of type arguments
new Callbacks<number, string, boolean>('s'); // wrong number of type arguments
declare function f<A, B = {}>(arg: number): void;
f<number>(); // wrong number of arguments (#25683)
@@ -0,0 +1,7 @@
// @noemit: true
// @allowjs: true
// @checkjs: true
// @strict: true
// @Filename: paren.js
/** @type {function((string), function((string)): string): string} */
var x = (s, id) => id(s)
@@ -0,0 +1,7 @@
// @noemit: true
// @allowjs: true
// @checkjs: true
// @strict: true
// @Filename: paren.js
/** @type {function((string)): string} */
var x = s => s.toString()
@@ -77,7 +77,7 @@ F.prototype = {
// @Filename: mod.js
// module.exports assignment
/** @type {{ status: 'done' }} */
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
status: "done",
m(n) { }
@@ -0,0 +1,15 @@
// @lib: es2015
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
label: namespace N {}
label: type T = {}
@@ -0,0 +1,15 @@
// @target: es2015
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
label: namespace N {}
label: type T = {}
@@ -0,0 +1,15 @@
// @target: es2015
"use strict"
label: function fn() { }
label: function* gen() { }
label: async function gen1() { }
label: enum E {}
label: interface I {}
label: class C { }
label: var a = 1;
label: let b = 1;
label: const c = 1;
label: module M { }
label: namespace N {}
label: type T = {}
@@ -0,0 +1,17 @@
/// <reference path='fourslash.ts'/>
////{ namespace /*0*/ }
////namespace N/*1*/ {}
////namespace N.M {}
////namespace N./*2*/
////
////namespace N1.M/*3*/ {}
////namespace N2.M {}
////namespace N2.M/*4*/
verify.completions(
{ marker: ["0", "1"], isNewIdentifierLocation: true },
{ marker: "2", exact: ["M"], isNewIdentifierLocation: true },
{ marker: "3", exact: undefined, isNewIdentifierLocation: true },
{ marker: "4", exact: "M", isNewIdentifierLocation: true },
);
@@ -0,0 +1,8 @@
/// <reference path='fourslash.ts' />
////foo
//// .bar(
//// x,
//// );
verify.formatDocumentChangesNothing();
+5 -3
View File
@@ -228,6 +228,7 @@ declare namespace FourSlashInterface {
eval(expr: string, value: any): void;
currentLineContentIs(text: string): void;
currentFileContentIs(text: string): void;
formatDocumentChangesNothing(): void;
/** Verifies that goToDefinition at the current position would take you to `endMarker`. */
goToDefinitionIs(endMarkers: ArrayOrSingle<string>): void;
goToDefinitionName(name: string, containerName: string): void;
@@ -335,9 +336,10 @@ declare namespace FourSlashInterface {
ProjectInfo(expected: string[]): void;
allRangesAppearInImplementationList(markerName: string): void;
getEditsForFileRename(options: {
oldPath: string;
newPath: string;
newFileContents: { [fileName: string]: string };
readonly oldPath: string;
readonly newPath: string;
readonly newFileContents: { readonly [fileName: string]: string };
readonly preferences?: UserPreferences;
}): void;
moveToNewFile(options: {
readonly newFileContents: { readonly [fileName: string]: string };
@@ -0,0 +1,26 @@
/// <reference path='fourslash.ts' />
// @Filename: /dir/a.ts
////export const a = 0;
// @Filename: /dir/b.ts
////import {} from "dir/a";
////import {} from 'dir/a';
// @Filename: /tsconfig.json
////{ "compilerOptions": { "baseUrl": "." } }
verify.getEditsForFileRename({
oldPath: "/dir/a.ts",
newPath: "/dir/a1.ts",
newFileContents: {
"/dir/b.ts":
`import {} from "dir/a1";
import {} from 'dir/a1';`,
},
preferences: {
importModuleSpecifierPreference: "non-relative",
// No effect because we are changing existing imports, which already have quotes
quotePreference: "single",
},
});
@@ -1,7 +1,8 @@
/// <reference path="fourslash.ts" />
//// [|import * as ns from "./module";
//// f1/*0*/();|]
////import * as ns from "./module";
////// Comment
////f1/*0*/();
// @Filename: module.ts
//// export function f1() {}
@@ -9,8 +10,10 @@
verify.importFixAtPosition([
`import * as ns from "./module";
// Comment
ns.f1();`,
`import * as ns from "./module";
import { f1 } from "./module";
// Comment
f1();`,
]);
@@ -0,0 +1,44 @@
/// <reference path="fourslash.ts"/>
////const o = {
//// a: {
//// m() {},
//// },
//// b: {
//// m() {},
//// },
////}
verify.navigationTree({
text: "<global>",
kind: "script",
childItems: [
{
text: "o",
kind: "const",
childItems: [
{ text: "m", kind: "method" },
{ text: "m", kind: "method" },
],
},
]
});
verify.navigationBar([
{
text: "<global>",
kind: "script",
childItems: [
{ text: "o", kind: "const" },
],
},
{
text: "o",
kind: "const",
childItems: [
{ text: "m", kind: "method" },
{ text: "m", kind: "method" },
],
indent: 1,
},
]);
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff. Show more