mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into js-object-literal-assignments-as-declarations
This commit is contained in:
@@ -315,7 +315,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getDisplayName(node: Declaration): string {
|
||||
return (node as NamedDeclaration).name ? declarationNameToString((node as NamedDeclaration).name) : unescapeLeadingUnderscores(getDeclarationName(node));
|
||||
return isNamedDeclaration(node) ? declarationNameToString(node.name) : unescapeLeadingUnderscores(getDeclarationName(node));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -383,8 +383,8 @@ namespace ts {
|
||||
symbolTable.set(name, symbol = createSymbol(SymbolFlags.None, name));
|
||||
}
|
||||
else {
|
||||
if ((node as NamedDeclaration).name) {
|
||||
(node as NamedDeclaration).name.parent = node;
|
||||
if (isNamedDeclaration(node)) {
|
||||
node.name.parent = node;
|
||||
}
|
||||
|
||||
// Report errors every position with duplicate declaration
|
||||
@@ -1996,7 +1996,7 @@ namespace ts {
|
||||
|
||||
/// Should be called only on prologue directives (isPrologueDirective(node) should be true)
|
||||
function isUseStrictPrologueDirective(node: ExpressionStatement): boolean {
|
||||
const nodeText = getTextOfNodeFromSourceText(file.text, node.expression);
|
||||
const nodeText = getSourceTextOfNodeFromSourceFile(file, node.expression);
|
||||
|
||||
// Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the
|
||||
// string to contain unicode escapes (as per ES5).
|
||||
|
||||
+52
-8
@@ -8012,10 +8012,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getLiteralTypeFromPropertyName(prop: Symbol) {
|
||||
const links = getSymbolLinks(prop);
|
||||
const links = getSymbolLinks(getLateBoundSymbol(prop));
|
||||
if (!links.nameType) {
|
||||
if (links.target) {
|
||||
Debug.assert(links.target.escapedName === prop.escapedName, "Target symbol and symbol do not have the same name");
|
||||
Debug.assert(links.target.escapedName === prop.escapedName || links.target.escapedName === InternalSymbolName.Computed, "Target symbol and symbol do not have the same name");
|
||||
links.nameType = getLiteralTypeFromPropertyName(links.target);
|
||||
}
|
||||
else {
|
||||
@@ -10562,6 +10562,11 @@ namespace ts {
|
||||
if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) {
|
||||
continue;
|
||||
}
|
||||
// Skip over symbol-named members
|
||||
const nameType = getLiteralTypeFromPropertyName(prop);
|
||||
if (nameType !== undefined && !(isRelatedTo(nameType, stringType) || isRelatedTo(nameType, numberType))) {
|
||||
continue;
|
||||
}
|
||||
if (kind === IndexKind.String || isNumericLiteralName(prop.escapedName)) {
|
||||
const related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors);
|
||||
if (!related) {
|
||||
@@ -21737,18 +21742,58 @@ namespace ts {
|
||||
|
||||
function checkUnusedModuleMembers(node: ModuleDeclaration | SourceFile): void {
|
||||
if (compilerOptions.noUnusedLocals && !(node.flags & NodeFlags.Ambient)) {
|
||||
// Ideally we could use the ImportClause directly as a key, but must wait until we have full ES6 maps. So must store key along with value.
|
||||
const unusedImports = createMap<[ImportClause, ImportedDeclaration[]]>();
|
||||
node.locals.forEach(local => {
|
||||
if (!local.isReferenced && !local.exportSymbol) {
|
||||
for (const declaration of local.declarations) {
|
||||
if (!isAmbientModule(declaration)) {
|
||||
errorUnusedLocal(declaration, symbolName(local));
|
||||
if (local.isReferenced || local.exportSymbol) return;
|
||||
for (const declaration of local.declarations) {
|
||||
if (isAmbientModule(declaration)) continue;
|
||||
if (isImportedDeclaration(declaration)) {
|
||||
const importClause = importClauseFromImported(declaration);
|
||||
const key = String(getNodeId(importClause));
|
||||
const group = unusedImports.get(key);
|
||||
if (group) {
|
||||
group[1].push(declaration);
|
||||
}
|
||||
else {
|
||||
unusedImports.set(key, [importClause, [declaration]]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorUnusedLocal(declaration, symbolName(local));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
unusedImports.forEach(([importClause, unuseds]) => {
|
||||
const importDecl = importClause.parent;
|
||||
if (forEachImportedDeclaration(importClause, d => !contains(unuseds, d))) {
|
||||
for (const unused of unuseds) errorUnusedLocal(unused, idText(unused.name));
|
||||
}
|
||||
else if (unuseds.length === 1) {
|
||||
error(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name));
|
||||
}
|
||||
else {
|
||||
error(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused, showModuleSpecifier(importDecl));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
type ImportedDeclaration = ImportClause | ImportSpecifier | NamespaceImport;
|
||||
function isImportedDeclaration(node: Node): node is ImportedDeclaration {
|
||||
return node.kind === SyntaxKind.ImportClause || node.kind === SyntaxKind.ImportSpecifier || node.kind === SyntaxKind.NamespaceImport;
|
||||
}
|
||||
function importClauseFromImported(decl: ImportedDeclaration): ImportClause {
|
||||
return decl.kind === SyntaxKind.ImportClause ? decl : decl.kind === SyntaxKind.NamespaceImport ? decl.parent : decl.parent.parent;
|
||||
}
|
||||
|
||||
function forEachImportedDeclaration<T>(importClause: ImportClause, cb: (im: ImportedDeclaration) => T | undefined): T | undefined {
|
||||
const { name: defaultName, namedBindings } = importClause;
|
||||
return (defaultName && cb(importClause)) ||
|
||||
namedBindings && (namedBindings.kind === SyntaxKind.NamespaceImport ? cb(namedBindings) : forEach(namedBindings.elements, cb));
|
||||
}
|
||||
|
||||
function checkBlock(node: Block) {
|
||||
// Grammar checking for SyntaxKind.Block
|
||||
if (node.kind === SyntaxKind.Block) {
|
||||
@@ -22867,8 +22912,7 @@ namespace ts {
|
||||
return "quit";
|
||||
}
|
||||
if (current.kind === SyntaxKind.LabeledStatement && (<LabeledStatement>current).label.escapedText === node.label.escapedText) {
|
||||
const sourceFile = getSourceFileOfNode(node);
|
||||
grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceFile.text, node.label));
|
||||
grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNode(node.label));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2539,7 +2539,6 @@ namespace ts {
|
||||
path = normalizePath(path);
|
||||
currentDirectory = normalizePath(currentDirectory);
|
||||
|
||||
const comparer = useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive;
|
||||
const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
|
||||
const regexFlag = useCaseSensitiveFileNames ? "" : "i";
|
||||
@@ -2560,7 +2559,7 @@ namespace ts {
|
||||
function visitDirectory(path: string, absolutePath: string, depth: number | undefined) {
|
||||
const { files, directories } = getFileSystemEntries(path);
|
||||
|
||||
for (const current of sort(files, comparer)) {
|
||||
for (const current of sort(files, compareStringsCaseSensitive)) {
|
||||
const name = combinePaths(path, current);
|
||||
const absoluteName = combinePaths(absolutePath, current);
|
||||
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
|
||||
@@ -2583,7 +2582,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
for (const current of sort(directories, comparer)) {
|
||||
for (const current of sort(directories, compareStringsCaseSensitive)) {
|
||||
const name = combinePaths(path, current);
|
||||
const absoluteName = combinePaths(absolutePath, current);
|
||||
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
|
||||
|
||||
@@ -3480,6 +3480,10 @@
|
||||
"category": "Message",
|
||||
"code": 6191
|
||||
},
|
||||
"All imports in import declaration are unused.": {
|
||||
"category": "Error",
|
||||
"code": 6192
|
||||
},
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
"code": 7005
|
||||
@@ -3851,6 +3855,10 @@
|
||||
"category": "Message",
|
||||
"code": 90004
|
||||
},
|
||||
"Remove import from '{0}'": {
|
||||
"category": "Message",
|
||||
"code": 90005
|
||||
},
|
||||
"Implement interface '{0}'": {
|
||||
"category": "Message",
|
||||
"code": 90006
|
||||
|
||||
@@ -2793,6 +2793,7 @@ namespace ts {
|
||||
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode;
|
||||
/* @internal */ typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): TypeNode; // tslint:disable-line unified-signatures
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined;
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
|
||||
+24
-17
@@ -314,20 +314,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node, includeTrivia = false): string {
|
||||
if (nodeIsMissing(node)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const text = sourceFile.text;
|
||||
return text.substring(includeTrivia ? node.pos : skipTrivia(text, node.pos), node.end);
|
||||
return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia);
|
||||
}
|
||||
|
||||
export function getTextOfNodeFromSourceText(sourceText: string, node: Node): string {
|
||||
export function getTextOfNodeFromSourceText(sourceText: string, node: Node, includeTrivia = false): string {
|
||||
if (nodeIsMissing(node)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return sourceText.substring(skipTrivia(sourceText, node.pos), node.end);
|
||||
return sourceText.substring(includeTrivia ? node.pos : skipTrivia(sourceText, node.pos), node.end);
|
||||
}
|
||||
|
||||
export function getTextOfNode(node: Node, includeTrivia = false): string {
|
||||
@@ -1204,7 +1199,7 @@ namespace ts {
|
||||
&& (<PropertyAccessExpression | ElementAccessExpression>node).expression.kind === SyntaxKind.ThisKeyword;
|
||||
}
|
||||
|
||||
export function getEntityNameFromTypeNode(node: TypeNode): EntityNameOrEntityNameExpression {
|
||||
export function getEntityNameFromTypeNode(node: TypeNode): EntityNameOrEntityNameExpression {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeReference:
|
||||
return (<TypeReferenceNode>node).typeName;
|
||||
@@ -2591,7 +2586,6 @@ namespace ts {
|
||||
const singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
|
||||
const backtickQuoteEscapedCharsRegExp = /[\\\`\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
|
||||
const escapedCharsMap = createMapFromTemplate({
|
||||
"\0": "\\0",
|
||||
"\t": "\\t",
|
||||
"\v": "\\v",
|
||||
"\f": "\\f",
|
||||
@@ -2606,7 +2600,6 @@ namespace ts {
|
||||
"\u2029": "\\u2029", // paragraphSeparator
|
||||
"\u0085": "\\u0085" // nextLine
|
||||
});
|
||||
const escapedNullRegExp = /\\0[0-9]/g;
|
||||
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
|
||||
@@ -2618,14 +2611,19 @@ namespace ts {
|
||||
quoteChar === CharacterCodes.backtick ? backtickQuoteEscapedCharsRegExp :
|
||||
quoteChar === CharacterCodes.singleQuote ? singleQuoteEscapedCharsRegExp :
|
||||
doubleQuoteEscapedCharsRegExp;
|
||||
return s.replace(escapedCharsRegExp, getReplacement).replace(escapedNullRegExp, nullReplacement);
|
||||
return s.replace(escapedCharsRegExp, getReplacement);
|
||||
}
|
||||
|
||||
function nullReplacement(c: string) {
|
||||
return "\\x00" + c.charAt(c.length - 1);
|
||||
}
|
||||
|
||||
function getReplacement(c: string) {
|
||||
function getReplacement(c: string, offset: number, input: string) {
|
||||
if (c.charCodeAt(0) === CharacterCodes.nullCharacter) {
|
||||
const lookAhead = input.charCodeAt(offset + c.length);
|
||||
if (lookAhead >= CharacterCodes._0 && lookAhead <= CharacterCodes._9) {
|
||||
// If the null character is followed by digits, print as a hex escape to prevent the result from parsing as an octal (which is forbidden in strict mode)
|
||||
return "\\x00";
|
||||
}
|
||||
// Otherwise, keep printing a literal \0 for the null character
|
||||
return "\\0";
|
||||
}
|
||||
return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0));
|
||||
}
|
||||
|
||||
@@ -3848,6 +3846,10 @@ namespace ts {
|
||||
export function isUMDExportSymbol(symbol: Symbol) {
|
||||
return symbol && symbol.declarations && symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
|
||||
}
|
||||
|
||||
export function showModuleSpecifier({ moduleSpecifier }: ImportDeclaration): string {
|
||||
return isStringLiteral(moduleSpecifier) ? moduleSpecifier.text : getTextOfNode(moduleSpecifier);
|
||||
}
|
||||
}
|
||||
|
||||
namespace ts {
|
||||
@@ -4363,6 +4365,11 @@ namespace ts {
|
||||
return declaration.name || nameForNamelessJSDocTypedef(declaration);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function isNamedDeclaration(node: Node): node is NamedDeclaration & { name: DeclarationName } {
|
||||
return !!(node as NamedDeclaration).name; // A 'name' property should always be a DeclarationName.
|
||||
}
|
||||
|
||||
export function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
|
||||
@@ -72,8 +72,7 @@ class TypeWriterWalker {
|
||||
private writeTypeOrSymbol(node: ts.Node, isSymbolWalk: boolean): TypeWriterResult {
|
||||
const actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos);
|
||||
const lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos);
|
||||
const sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node);
|
||||
|
||||
const sourceText = ts.getSourceTextOfNodeFromSourceFile(this.currentSourceFile, node);
|
||||
|
||||
if (!isSymbolWalk) {
|
||||
// Workaround to ensure we output 'C' instead of 'typeof C' for base class expressions
|
||||
|
||||
@@ -91,6 +91,18 @@ namespace ts {
|
||||
"c:/dev/g.min.js/.g/g.ts"
|
||||
]);
|
||||
|
||||
const caseInsensitiveOrderingDiffersWithCaseHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, [
|
||||
"c:/dev/xylophone.ts",
|
||||
"c:/dev/Yosemite.ts",
|
||||
"c:/dev/zebra.ts",
|
||||
]);
|
||||
|
||||
const caseSensitiveOrderingDiffersWithCaseHost = new Utils.MockParseConfigHost(caseSensitiveBasePath, /*useCaseSensitiveFileNames*/ true, [
|
||||
"/dev/xylophone.ts",
|
||||
"/dev/Yosemite.ts",
|
||||
"/dev/zebra.ts",
|
||||
]);
|
||||
|
||||
function assertParsed(actual: ParsedCommandLine, expected: ParsedCommandLine): void {
|
||||
assert.deepEqual(actual.fileNames, expected.fileNames);
|
||||
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
|
||||
@@ -1482,5 +1494,25 @@ namespace ts {
|
||||
validateMatches(expected, json, caseSensitiveHost, caseSensitiveBasePath);
|
||||
});
|
||||
});
|
||||
|
||||
it("can include files in the same order on multiple platforms", () => {
|
||||
function getExpected(basePath: string): ParsedCommandLine {
|
||||
return {
|
||||
options: {},
|
||||
errors: [],
|
||||
fileNames: [
|
||||
`${basePath}Yosemite.ts`, // capital always comes before lowercase letters
|
||||
`${basePath}xylophone.ts`,
|
||||
`${basePath}zebra.ts`
|
||||
],
|
||||
wildcardDirectories: {
|
||||
[basePath.slice(0, basePath.length - 1)]: WatchDirectoryFlags.Recursive
|
||||
},
|
||||
};
|
||||
}
|
||||
const json = {};
|
||||
validateMatches(getExpected(caseSensitiveBasePath), json, caseSensitiveOrderingDiffersWithCaseHost, caseSensitiveBasePath);
|
||||
validateMatches(getExpected(caseInsensitiveBasePath), json, caseInsensitiveOrderingDiffersWithCaseHost, caseInsensitiveBasePath);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+15060
-14535
File diff suppressed because it is too large
Load Diff
Vendored
+1757
-1930
File diff suppressed because it is too large
Load Diff
@@ -88,13 +88,6 @@ namespace ts {
|
||||
return createCombinedCodeActions(changes, commands.length === 0 ? undefined : commands);
|
||||
}
|
||||
|
||||
export function codeFixAllWithTextChanges(context: CodeFixAllContext, errorCodes: number[], use: (changes: Push<TextChange>, error: Diagnostic) => void): CombinedCodeActions {
|
||||
const changes: TextChange[] = [];
|
||||
eachDiagnostic(context, errorCodes, diag => use(changes, diag));
|
||||
changes.sort((a, b) => b.span.start - a.span.start);
|
||||
return createCombinedCodeActions([createFileTextChanges(context.sourceFile.fileName, changes)]);
|
||||
}
|
||||
|
||||
function eachDiagnostic({ program, sourceFile }: CodeFixAllContext, errorCodes: number[], cb: (diag: Diagnostic) => void): void {
|
||||
for (const diag of program.getSemanticDiagnostics(sourceFile).concat(computeSuggestionDiagnostics(sourceFile, program))) {
|
||||
if (contains(errorCodes, diag.code)) {
|
||||
|
||||
@@ -21,42 +21,36 @@ namespace ts.codefix {
|
||||
return actions;
|
||||
|
||||
function fix(type: Type, fixId: string): CodeFixAction {
|
||||
const newText = typeString(type, checker);
|
||||
return {
|
||||
description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Change_0_to_1), [original, newText]),
|
||||
changes: [createFileTextChanges(sourceFile.fileName, [createChange(typeNode, sourceFile, newText)])],
|
||||
fixId,
|
||||
};
|
||||
const newText = checker.typeToString(type);
|
||||
const description = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Change_0_to_1), [original, newText]);
|
||||
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, typeNode, type, checker));
|
||||
return { description, changes, fixId };
|
||||
}
|
||||
},
|
||||
fixIds: [fixIdPlain, fixIdNullable],
|
||||
getAllCodeActions(context) {
|
||||
const { fixId, program, sourceFile } = context;
|
||||
const checker = program.getTypeChecker();
|
||||
return codeFixAllWithTextChanges(context, errorCodes, (changes, err) => {
|
||||
return codeFixAll(context, errorCodes, (changes, err) => {
|
||||
const info = getInfo(err.file, err.start!, checker);
|
||||
if (!info) return;
|
||||
const { typeNode, type } = info;
|
||||
const fixedType = typeNode.kind === SyntaxKind.JSDocNullableType && fixId === fixIdNullable ? checker.getNullableType(type, TypeFlags.Undefined) : type;
|
||||
changes.push(createChange(typeNode, sourceFile, typeString(fixedType, checker)));
|
||||
doChange(changes, sourceFile, typeNode, fixedType, checker);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, oldTypeNode: TypeNode, newType: Type, checker: TypeChecker): void {
|
||||
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(newType, /*enclosingDeclaration*/ oldTypeNode));
|
||||
}
|
||||
|
||||
function getInfo(sourceFile: SourceFile, pos: number, checker: TypeChecker): { readonly typeNode: TypeNode, type: Type } {
|
||||
const decl = findAncestor(getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false), isTypeContainer);
|
||||
const typeNode = decl && decl.type;
|
||||
return typeNode && { typeNode, type: checker.getTypeFromTypeNode(typeNode) };
|
||||
}
|
||||
|
||||
function createChange(declaration: TypeNode, sourceFile: SourceFile, newText: string): TextChange {
|
||||
return createTextChange(createTextSpanFromNode(declaration, sourceFile), newText);
|
||||
}
|
||||
|
||||
function typeString(type: Type, checker: TypeChecker): string {
|
||||
return checker.typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.NoTruncation);
|
||||
}
|
||||
|
||||
// TODO: GH#19856 Node & { type: TypeNode }
|
||||
type TypeContainer =
|
||||
| AsExpression | CallSignatureDeclaration | ConstructSignatureDeclaration | FunctionDeclaration
|
||||
|
||||
@@ -5,11 +5,19 @@ namespace ts.codefix {
|
||||
const errorCodes = [
|
||||
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
||||
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
||||
Diagnostics.All_imports_in_import_declaration_are_unused.code,
|
||||
];
|
||||
registerCodeFix({
|
||||
errorCodes,
|
||||
getCodeActions(context) {
|
||||
const { sourceFile } = context;
|
||||
const { errorCode, sourceFile } = context;
|
||||
const importDecl = tryGetFullImport(sourceFile, context.span.start);
|
||||
if (importDecl) {
|
||||
const description = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Remove_import_from_0), [showModuleSpecifier(importDecl)]);
|
||||
const changes = textChanges.ChangeTracker.with(context, t => t.deleteNode(sourceFile, importDecl));
|
||||
return [{ description, changes, fixId: fixIdDelete }];
|
||||
}
|
||||
|
||||
const token = getToken(sourceFile, textSpanEnd(context.span));
|
||||
const result: CodeFixAction[] = [];
|
||||
|
||||
@@ -19,7 +27,7 @@ namespace ts.codefix {
|
||||
result.push({ description, changes: deletion, fixId: fixIdDelete });
|
||||
}
|
||||
|
||||
const prefix = textChanges.ChangeTracker.with(context, t => tryPrefixDeclaration(t, context.errorCode, sourceFile, token));
|
||||
const prefix = textChanges.ChangeTracker.with(context, t => tryPrefixDeclaration(t, errorCode, sourceFile, token));
|
||||
if (prefix.length) {
|
||||
const description = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Prefix_0_with_an_underscore), [token.getText()]);
|
||||
result.push({ description, changes: prefix, fixId: fixIdPrefix });
|
||||
@@ -38,7 +46,13 @@ namespace ts.codefix {
|
||||
}
|
||||
break;
|
||||
case fixIdDelete:
|
||||
tryDeleteDeclaration(changes, sourceFile, token);
|
||||
const importDecl = tryGetFullImport(diag.file!, diag.start!);
|
||||
if (importDecl) {
|
||||
changes.deleteNode(sourceFile, importDecl);
|
||||
}
|
||||
else {
|
||||
tryDeleteDeclaration(changes, sourceFile, token);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Debug.fail(JSON.stringify(context.fixId));
|
||||
@@ -46,6 +60,12 @@ namespace ts.codefix {
|
||||
}),
|
||||
});
|
||||
|
||||
// Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing.
|
||||
function tryGetFullImport(sourceFile: SourceFile, pos: number): ImportDeclaration | undefined {
|
||||
const startToken = getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false);
|
||||
return startToken.kind === SyntaxKind.ImportKeyword ? tryCast(startToken.parent, isImportDeclaration) : undefined;
|
||||
}
|
||||
|
||||
function getToken(sourceFile: SourceFile, pos: number): Node {
|
||||
const token = findPrecedingToken(pos, sourceFile);
|
||||
// this handles var ["computed"] = 12;
|
||||
|
||||
@@ -24,27 +24,26 @@ namespace ts.codefix {
|
||||
];
|
||||
registerCodeFix({
|
||||
errorCodes,
|
||||
getCodeActions({ sourceFile, program, span: { start }, errorCode, cancellationToken }) {
|
||||
getCodeActions(context) {
|
||||
const { sourceFile, program, span: { start }, errorCode, cancellationToken } = context;
|
||||
if (isSourceFileJavaScript(sourceFile)) {
|
||||
return undefined; // TODO: GH#20113
|
||||
}
|
||||
|
||||
const token = getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
const fix = getFix(sourceFile, token, errorCode, program, cancellationToken);
|
||||
if (!fix) return undefined;
|
||||
|
||||
const { declaration, textChanges } = fix;
|
||||
const name = getNameOfDeclaration(declaration);
|
||||
const description = formatStringFromArgs(getLocaleSpecificMessage(getDiagnostic(errorCode, token)), [name.getText()]);
|
||||
return [{ description, changes: [{ fileName: sourceFile.fileName, textChanges }], fixId }];
|
||||
let declaration!: Declaration;
|
||||
const changes = textChanges.ChangeTracker.with(context, changes => { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken); });
|
||||
if (changes.length === 0) return undefined;
|
||||
const name = getNameOfDeclaration(declaration).getText();
|
||||
const description = formatStringFromArgs(getLocaleSpecificMessage(getDiagnostic(errorCode, token)), [name]);
|
||||
return [{ description, changes, fixId }];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions(context) {
|
||||
const { sourceFile, program, cancellationToken } = context;
|
||||
const seenFunctions = createMap<true>();
|
||||
return codeFixAllWithTextChanges(context, errorCodes, (changes, err) => {
|
||||
const fix = getFix(sourceFile, getTokenAtPosition(err.file!, err.start!, /*includeJsDocComment*/ false), err.code, program, cancellationToken, seenFunctions);
|
||||
if (fix) changes.push(...fix.textChanges);
|
||||
return codeFixAll(context, errorCodes, (changes, err) => {
|
||||
doChange(changes, sourceFile, getTokenAtPosition(err.file!, err.start!, /*includeJsDocComment*/ false), err.code, program, cancellationToken, seenFunctions);
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -60,12 +59,7 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
|
||||
interface Fix {
|
||||
readonly declaration: Declaration;
|
||||
readonly textChanges: TextChange[];
|
||||
}
|
||||
|
||||
function getFix(sourceFile: SourceFile, token: Node, errorCode: number, program: Program, cancellationToken: CancellationToken, seenFunctions?: Map<true>): Fix | undefined {
|
||||
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, token: Node, errorCode: number, program: Program, cancellationToken: CancellationToken, seenFunctions?: Map<true>): Declaration | undefined {
|
||||
if (!isAllowedTokenKind(token.kind)) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -74,11 +68,15 @@ namespace ts.codefix {
|
||||
// Variable and Property declarations
|
||||
case Diagnostics.Member_0_implicitly_has_an_1_type.code:
|
||||
case Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
|
||||
return getCodeActionForVariableDeclaration(<PropertyDeclaration | PropertySignature | VariableDeclaration>token.parent, program, cancellationToken);
|
||||
annotateVariableDeclaration(changes, sourceFile, <PropertyDeclaration | PropertySignature | VariableDeclaration>token.parent, program, cancellationToken);
|
||||
return token.parent as Declaration;
|
||||
|
||||
case Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
||||
const symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
||||
return symbol && symbol.valueDeclaration && getCodeActionForVariableDeclaration(<VariableDeclaration>symbol.valueDeclaration, program, cancellationToken);
|
||||
if (symbol && symbol.valueDeclaration) {
|
||||
annotateVariableDeclaration(changes, sourceFile, <VariableDeclaration>symbol.valueDeclaration, program, cancellationToken);
|
||||
return symbol.valueDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,22 +89,34 @@ namespace ts.codefix {
|
||||
// Parameter declarations
|
||||
case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
|
||||
if (isSetAccessor(containingFunction)) {
|
||||
return getCodeActionForSetAccessor(containingFunction, program, cancellationToken);
|
||||
annotateSetAccessor(changes, sourceFile, containingFunction, program, cancellationToken);
|
||||
return containingFunction;
|
||||
}
|
||||
// falls through
|
||||
case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
|
||||
return !seenFunctions || addToSeen(seenFunctions, getNodeId(containingFunction))
|
||||
? getCodeActionForParameters(cast(token.parent, isParameter), containingFunction, sourceFile, program, cancellationToken)
|
||||
: undefined;
|
||||
if (!seenFunctions || addToSeen(seenFunctions, getNodeId(containingFunction))) {
|
||||
const param = cast(token.parent, isParameter);
|
||||
annotateParameters(changes, param, containingFunction, sourceFile, program, cancellationToken);
|
||||
return param;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
// Get Accessor declarations
|
||||
case Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code:
|
||||
case Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code:
|
||||
return isGetAccessor(containingFunction) ? getCodeActionForGetAccessor(containingFunction, sourceFile, program, cancellationToken) : undefined;
|
||||
if (isGetAccessor(containingFunction) && isIdentifier(containingFunction.name)) {
|
||||
annotate(changes, sourceFile, containingFunction, inferTypeForVariableFromUsage(containingFunction.name, program, cancellationToken), program);
|
||||
return containingFunction;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
// Set Accessor declarations
|
||||
case Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code:
|
||||
return isSetAccessor(containingFunction) ? getCodeActionForSetAccessor(containingFunction, program, cancellationToken) : undefined;
|
||||
if (isSetAccessor(containingFunction)) {
|
||||
annotateSetAccessor(changes, sourceFile, containingFunction, program, cancellationToken);
|
||||
return containingFunction;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
default:
|
||||
return Debug.fail(String(errorCode));
|
||||
@@ -127,10 +137,10 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
|
||||
function getCodeActionForVariableDeclaration(declaration: VariableDeclaration | PropertyDeclaration | PropertySignature, program: Program, cancellationToken: CancellationToken): Fix | undefined {
|
||||
if (!isIdentifier(declaration.name)) return undefined;
|
||||
const type = inferTypeForVariableFromUsage(declaration.name, program, cancellationToken);
|
||||
return makeFix(declaration, declaration.name.getEnd(), type, program);
|
||||
function annotateVariableDeclaration(changes: textChanges.ChangeTracker, sourceFile: SourceFile, declaration: VariableDeclaration | PropertyDeclaration | PropertySignature, program: Program, cancellationToken: CancellationToken): void {
|
||||
if (isIdentifier(declaration.name)) {
|
||||
annotate(changes, sourceFile, declaration, inferTypeForVariableFromUsage(declaration.name, program, cancellationToken), program);
|
||||
}
|
||||
}
|
||||
|
||||
function isApplicableFunctionForInference(declaration: FunctionLike): declaration is MethodDeclaration | FunctionDeclaration | ConstructorDeclaration {
|
||||
@@ -145,54 +155,51 @@ namespace ts.codefix {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getCodeActionForParameters(parameterDeclaration: ParameterDeclaration, containingFunction: FunctionLike, sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): Fix | undefined {
|
||||
function annotateParameters(changes: textChanges.ChangeTracker, parameterDeclaration: ParameterDeclaration, containingFunction: FunctionLike, sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): void {
|
||||
if (!isIdentifier(parameterDeclaration.name) || !isApplicableFunctionForInference(containingFunction)) {
|
||||
return undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
const types = inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) ||
|
||||
containingFunction.parameters.map(p => isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : undefined);
|
||||
if (!types) return undefined;
|
||||
|
||||
// We didn't actually find a set of type inference positions matching each parameter position
|
||||
if (containingFunction.parameters.length !== types.length) {
|
||||
return undefined;
|
||||
if (!types || containingFunction.parameters.length !== types.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const textChanges = arrayFrom(mapDefinedIterator(zipToIterator(containingFunction.parameters, types), ([parameter, type]) =>
|
||||
type && !parameter.type && !parameter.initializer ? makeChange(containingFunction, parameter.end, type, program) : undefined));
|
||||
return textChanges.length ? { declaration: parameterDeclaration, textChanges } : undefined;
|
||||
zipWith(containingFunction.parameters, types, (parameter, type) => {
|
||||
if (!parameter.type && !parameter.initializer) {
|
||||
annotate(changes, sourceFile, parameter, type, program);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getCodeActionForSetAccessor(setAccessorDeclaration: SetAccessorDeclaration, program: Program, cancellationToken: CancellationToken): Fix | undefined {
|
||||
const setAccessorParameter = setAccessorDeclaration.parameters[0];
|
||||
if (!setAccessorParameter || !isIdentifier(setAccessorDeclaration.name) || !isIdentifier(setAccessorParameter.name)) {
|
||||
return undefined;
|
||||
function annotateSetAccessor(changes: textChanges.ChangeTracker, sourceFile: SourceFile, setAccessorDeclaration: SetAccessorDeclaration, program: Program, cancellationToken: CancellationToken): void {
|
||||
const param = firstOrUndefined(setAccessorDeclaration.parameters);
|
||||
if (param && isIdentifier(setAccessorDeclaration.name) && isIdentifier(param.name)) {
|
||||
const type = inferTypeForVariableFromUsage(setAccessorDeclaration.name, program, cancellationToken) ||
|
||||
inferTypeForVariableFromUsage(param.name, program, cancellationToken);
|
||||
annotate(changes, sourceFile, param, type, program);
|
||||
}
|
||||
|
||||
const type = inferTypeForVariableFromUsage(setAccessorDeclaration.name, program, cancellationToken) ||
|
||||
inferTypeForVariableFromUsage(setAccessorParameter.name, program, cancellationToken);
|
||||
return makeFix(setAccessorParameter, setAccessorParameter.name.getEnd(), type, program);
|
||||
}
|
||||
|
||||
function getCodeActionForGetAccessor(getAccessorDeclaration: GetAccessorDeclaration, sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): Fix | undefined {
|
||||
if (!isIdentifier(getAccessorDeclaration.name)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = inferTypeForVariableFromUsage(getAccessorDeclaration.name, program, cancellationToken);
|
||||
const closeParenToken = findChildOfKind(getAccessorDeclaration, SyntaxKind.CloseParenToken, sourceFile);
|
||||
return makeFix(getAccessorDeclaration, closeParenToken.getEnd(), type, program);
|
||||
function annotate(changes: textChanges.ChangeTracker, sourceFile: SourceFile, declaration: textChanges.TypeAnnotatable, type: Type | undefined, program: Program): void {
|
||||
const typeNode = type && getTypeNodeIfAccessible(type, declaration, program.getTypeChecker());
|
||||
if (typeNode) changes.insertTypeAnnotation(sourceFile, declaration, typeNode);
|
||||
}
|
||||
|
||||
function makeFix(declaration: Declaration, start: number, type: Type | undefined, program: Program): Fix | undefined {
|
||||
const change = makeChange(declaration, start, type, program);
|
||||
return change && { declaration, textChanges: [change] };
|
||||
}
|
||||
|
||||
function makeChange(declaration: Declaration, start: number, type: Type | undefined, program: Program): TextChange | undefined {
|
||||
const typeString = type && typeToString(type, declaration, program.getTypeChecker());
|
||||
return typeString === undefined ? undefined : createTextChangeFromStartLength(start, 0, `: ${typeString}`);
|
||||
function getTypeNodeIfAccessible(type: Type, enclosingScope: Node, checker: TypeChecker): TypeNode | undefined {
|
||||
let typeIsAccessible = true;
|
||||
const notAccessible = () => { typeIsAccessible = false; };
|
||||
const res = checker.typeToTypeNode(type, enclosingScope, /*flags*/ undefined, {
|
||||
trackSymbol: (symbol, declaration, meaning) => {
|
||||
typeIsAccessible = typeIsAccessible && checker.isSymbolAccessible(symbol, declaration, meaning, /*shouldComputeAliasToMarkVisible*/ false).accessibility === SymbolAccessibility.Accessible;
|
||||
},
|
||||
reportInaccessibleThisError: notAccessible,
|
||||
reportPrivateInBaseOfClassExpression: notAccessible,
|
||||
reportInaccessibleUniqueSymbolError: notAccessible,
|
||||
});
|
||||
return typeIsAccessible ? res : undefined;
|
||||
}
|
||||
|
||||
function getReferences(token: PropertyName | Token<SyntaxKind.ConstructorKeyword>, program: Program, cancellationToken: CancellationToken): ReadonlyArray<Identifier> {
|
||||
@@ -221,51 +228,6 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
|
||||
function getTypeAccessiblityWriter(checker: TypeChecker): EmitTextWriter {
|
||||
let str = "";
|
||||
let typeIsAccessible = true;
|
||||
|
||||
const writeText: (text: string) => void = text => str += text;
|
||||
return {
|
||||
getText: () => typeIsAccessible ? str : undefined,
|
||||
writeKeyword: writeText,
|
||||
writeOperator: writeText,
|
||||
writePunctuation: writeText,
|
||||
writeSpace: writeText,
|
||||
writeStringLiteral: writeText,
|
||||
writeParameter: writeText,
|
||||
writeProperty: writeText,
|
||||
writeSymbol: writeText,
|
||||
write: writeText,
|
||||
writeTextOfNode: writeText,
|
||||
rawWrite: writeText,
|
||||
writeLiteral: writeText,
|
||||
getTextPos: () => 0,
|
||||
getLine: () => 0,
|
||||
getColumn: () => 0,
|
||||
getIndent: () => 0,
|
||||
isAtStartOfLine: () => false,
|
||||
writeLine: () => writeText(" "),
|
||||
increaseIndent: noop,
|
||||
decreaseIndent: noop,
|
||||
clear: () => { str = ""; typeIsAccessible = true; },
|
||||
trackSymbol: (symbol, declaration, meaning) => {
|
||||
if (checker.isSymbolAccessible(symbol, declaration, meaning, /*shouldComputeAliasToMarkVisible*/ false).accessibility !== SymbolAccessibility.Accessible) {
|
||||
typeIsAccessible = false;
|
||||
}
|
||||
},
|
||||
reportInaccessibleThisError: () => { typeIsAccessible = false; },
|
||||
reportPrivateInBaseOfClassExpression: () => { typeIsAccessible = false; },
|
||||
reportInaccessibleUniqueSymbolError: () => { typeIsAccessible = false; }
|
||||
};
|
||||
}
|
||||
|
||||
function typeToString(type: Type, enclosingDeclaration: Declaration, checker: TypeChecker): string {
|
||||
const writer = getTypeAccessiblityWriter(checker);
|
||||
checker.writeType(type, enclosingDeclaration, /*flags*/ undefined, writer);
|
||||
return writer.getText();
|
||||
}
|
||||
|
||||
namespace InferFromReference {
|
||||
interface CallContext {
|
||||
argumentTypes: Type[];
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace ts.textChanges {
|
||||
|
||||
export function getAdjustedStartPosition(sourceFile: SourceFile, node: Node, options: ConfigurableStart, position: Position) {
|
||||
if (options.useNonAdjustedStartPosition) {
|
||||
return node.getStart();
|
||||
return node.getStart(sourceFile);
|
||||
}
|
||||
const fullStart = node.getFullStart();
|
||||
const start = node.getStart(sourceFile);
|
||||
@@ -199,6 +199,8 @@ namespace ts.textChanges {
|
||||
formatContext: formatting.FormatContext;
|
||||
}
|
||||
|
||||
export type TypeAnnotatable = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertyDeclaration | PropertySignature;
|
||||
|
||||
export class ChangeTracker {
|
||||
private readonly changes: Change[] = [];
|
||||
private readonly deletedNodesInLists: true[] = []; // Stores ids of nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
|
||||
@@ -343,6 +345,14 @@ namespace ts.textChanges {
|
||||
this.replaceRange(sourceFile, { pos, end: pos }, createToken(modifier), { suffix: " " });
|
||||
}
|
||||
|
||||
/** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */
|
||||
public insertTypeAnnotation(sourceFile: SourceFile, node: TypeAnnotatable, type: TypeNode): void {
|
||||
const end = (isFunctionLike(node)
|
||||
? findChildOfKind(node, SyntaxKind.CloseParenToken, sourceFile)!
|
||||
: node.kind !== SyntaxKind.VariableDeclaration && node.questionToken ? node.questionToken : node.name).end;
|
||||
this.insertNodeAt(sourceFile, end, type, { prefix: ": " });
|
||||
}
|
||||
|
||||
private getOptionsForInsertNodeBefore(before: Node, doubleNewlines: boolean): ChangeNodeOptions {
|
||||
if (isStatement(before) || isClassElement(before)) {
|
||||
return { suffix: doubleNewlines ? this.newLineCharacter + this.newLineCharacter : this.newLineCharacter };
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/a.ts(2,8): error TS6133: 'Bar' is declared but its value is never read.
|
||||
/a.ts(2,1): error TS6133: 'Bar' is declared but its value is never read.
|
||||
|
||||
|
||||
==== /a.ts (1 errors) ====
|
||||
import Foo from "foo";
|
||||
import Bar from "bar"; // error: unused
|
||||
~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6133: 'Bar' is declared but its value is never read.
|
||||
export class A extends Foo { }
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -6,7 +6,7 @@ for (const element of document.getElementsByTagName("a")) {
|
||||
>getElementsByTagName : Symbol(Document.getElementsByTagName, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
element.href;
|
||||
>element.href : Symbol(HTMLAnchorElement.href, Decl(lib.dom.d.ts, --, --))
|
||||
>element.href : Symbol(HTMLHyperlinkElementUtils.href, Decl(lib.dom.d.ts, --, --))
|
||||
>element : Symbol(element, Decl(modularizeLibrary_Dom.iterable.ts, 0, 10))
|
||||
>href : Symbol(HTMLAnchorElement.href, Decl(lib.dom.d.ts, --, --))
|
||||
>href : Symbol(HTMLHyperlinkElementUtils.href, Decl(lib.dom.d.ts, --, --))
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
for (const element of document.getElementsByTagName("a")) {
|
||||
>element : HTMLAnchorElement
|
||||
>document.getElementsByTagName("a") : NodeListOf<HTMLAnchorElement>
|
||||
>document.getElementsByTagName : { <K extends "object" | "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "dfn" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "listing" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "plaintext" | "pre" | "progress" | "q" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "small" | "source" | "span" | "strike" | "strong" | "style" | "sub" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tt" | "u" | "ul" | "var" | "video" | "wbr" | "x-ms-webview" | "xmp">(tagname: K): NodeListOf<HTMLElementTagNameMap[K]>; <K extends "symbol" | "circle" | "clippath" | "defs" | "desc" | "ellipse" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "filter" | "foreignobject" | "g" | "image" | "line" | "lineargradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialgradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textpath" | "tspan" | "use" | "view">(tagname: K): NodeListOf<SVGElementTagNameMap[K]>; (tagname: string): NodeListOf<Element>; }
|
||||
>document.getElementsByTagName : { <K extends "object" | "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "dfn" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "listing" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "plaintext" | "pre" | "progress" | "q" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "small" | "source" | "span" | "strike" | "strong" | "style" | "sub" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tt" | "u" | "ul" | "var" | "video" | "wbr" | "xmp">(tagname: K): NodeListOf<HTMLElementTagNameMap[K]>; <K extends "symbol" | "circle" | "clippath" | "defs" | "desc" | "ellipse" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "filter" | "foreignobject" | "g" | "image" | "line" | "lineargradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialgradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textpath" | "tspan" | "use" | "view">(tagname: K): NodeListOf<SVGElementTagNameMap[K]>; (tagname: string): NodeListOf<Element>; }
|
||||
>document : Document
|
||||
>getElementsByTagName : { <K extends "object" | "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "dfn" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "listing" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "plaintext" | "pre" | "progress" | "q" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "small" | "source" | "span" | "strike" | "strong" | "style" | "sub" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tt" | "u" | "ul" | "var" | "video" | "wbr" | "x-ms-webview" | "xmp">(tagname: K): NodeListOf<HTMLElementTagNameMap[K]>; <K extends "symbol" | "circle" | "clippath" | "defs" | "desc" | "ellipse" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "filter" | "foreignobject" | "g" | "image" | "line" | "lineargradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialgradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textpath" | "tspan" | "use" | "view">(tagname: K): NodeListOf<SVGElementTagNameMap[K]>; (tagname: string): NodeListOf<Element>; }
|
||||
>getElementsByTagName : { <K extends "object" | "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "dfn" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "listing" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "plaintext" | "pre" | "progress" | "q" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "small" | "source" | "span" | "strike" | "strong" | "style" | "sub" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tt" | "u" | "ul" | "var" | "video" | "wbr" | "xmp">(tagname: K): NodeListOf<HTMLElementTagNameMap[K]>; <K extends "symbol" | "circle" | "clippath" | "defs" | "desc" | "ellipse" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "filter" | "foreignobject" | "g" | "image" | "line" | "lineargradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialgradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textpath" | "tspan" | "use" | "view">(tagname: K): NodeListOf<SVGElementTagNameMap[K]>; (tagname: string): NodeListOf<Element>; }
|
||||
>"a" : "a"
|
||||
|
||||
element.href;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [nonstrictTemplateWithNotOctalPrintsAsIs.ts]
|
||||
// https://github.com/Microsoft/TypeScript/issues/21828
|
||||
const d2 = `\\0041`;
|
||||
|
||||
|
||||
//// [nonstrictTemplateWithNotOctalPrintsAsIs.js]
|
||||
// https://github.com/Microsoft/TypeScript/issues/21828
|
||||
var d2 = "\\0041";
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/nonstrictTemplateWithNotOctalPrintsAsIs.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/21828
|
||||
const d2 = `\\0041`;
|
||||
>d2 : Symbol(d2, Decl(nonstrictTemplateWithNotOctalPrintsAsIs.ts, 1, 5))
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/nonstrictTemplateWithNotOctalPrintsAsIs.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/21828
|
||||
const d2 = `\\0041`;
|
||||
>d2 : "\\0041"
|
||||
>`\\0041` : "\\0041"
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts(10,5): error TS2322: Type '{ [SYM]: "str"; }' is not assignable to type 'I'.
|
||||
Types of property '[SYM]' are incompatible.
|
||||
Type '"str"' is not assignable to type '"sym"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts (1 errors) ====
|
||||
// https://github.com/Microsoft/TypeScript/issues/21962
|
||||
export const SYM = Symbol('a unique symbol');
|
||||
|
||||
export interface I {
|
||||
[SYM]: 'sym';
|
||||
[x: string]: 'str';
|
||||
}
|
||||
|
||||
let a: I = {[SYM]: 'sym'}; // Expect ok
|
||||
let b: I = {[SYM]: 'str'}; // Expect error
|
||||
~
|
||||
!!! error TS2322: Type '{ [SYM]: "str"; }' is not assignable to type 'I'.
|
||||
!!! error TS2322: Types of property '[SYM]' are incompatible.
|
||||
!!! error TS2322: Type '"str"' is not assignable to type '"sym"'.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts]
|
||||
// https://github.com/Microsoft/TypeScript/issues/21962
|
||||
export const SYM = Symbol('a unique symbol');
|
||||
|
||||
export interface I {
|
||||
[SYM]: 'sym';
|
||||
[x: string]: 'str';
|
||||
}
|
||||
|
||||
let a: I = {[SYM]: 'sym'}; // Expect ok
|
||||
let b: I = {[SYM]: 'str'}; // Expect error
|
||||
|
||||
|
||||
//// [uniqueSymbolAllowsIndexInObjectWithIndexSignature.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
// https://github.com/Microsoft/TypeScript/issues/21962
|
||||
exports.SYM = Symbol('a unique symbol');
|
||||
var a = (_a = {}, _a[exports.SYM] = 'sym', _a); // Expect ok
|
||||
var b = (_b = {}, _b[exports.SYM] = 'str', _b); // Expect error
|
||||
var _a, _b;
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/21962
|
||||
export const SYM = Symbol('a unique symbol');
|
||||
>SYM : Symbol(SYM, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 1, 12))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --))
|
||||
|
||||
export interface I {
|
||||
>I : Symbol(I, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 1, 45))
|
||||
|
||||
[SYM]: 'sym';
|
||||
>[SYM] : Symbol(I[SYM], Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 3, 20))
|
||||
>SYM : Symbol(SYM, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 1, 12))
|
||||
|
||||
[x: string]: 'str';
|
||||
>x : Symbol(x, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 5, 3))
|
||||
}
|
||||
|
||||
let a: I = {[SYM]: 'sym'}; // Expect ok
|
||||
>a : Symbol(a, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 8, 3))
|
||||
>I : Symbol(I, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 1, 45))
|
||||
>[SYM] : Symbol([SYM], Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 8, 12))
|
||||
>SYM : Symbol(SYM, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 1, 12))
|
||||
|
||||
let b: I = {[SYM]: 'str'}; // Expect error
|
||||
>b : Symbol(b, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 9, 3))
|
||||
>I : Symbol(I, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 1, 45))
|
||||
>[SYM] : Symbol([SYM], Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 9, 12))
|
||||
>SYM : Symbol(SYM, Decl(uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts, 1, 12))
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/21962
|
||||
export const SYM = Symbol('a unique symbol');
|
||||
>SYM : unique symbol
|
||||
>Symbol('a unique symbol') : unique symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>'a unique symbol' : "a unique symbol"
|
||||
|
||||
export interface I {
|
||||
>I : I
|
||||
|
||||
[SYM]: 'sym';
|
||||
>[SYM] : "sym"
|
||||
>SYM : unique symbol
|
||||
|
||||
[x: string]: 'str';
|
||||
>x : string
|
||||
}
|
||||
|
||||
let a: I = {[SYM]: 'sym'}; // Expect ok
|
||||
>a : I
|
||||
>I : I
|
||||
>{[SYM]: 'sym'} : { [SYM]: "sym"; }
|
||||
>[SYM] : "sym"
|
||||
>SYM : unique symbol
|
||||
>'sym' : "sym"
|
||||
|
||||
let b: I = {[SYM]: 'str'}; // Expect error
|
||||
>b : I
|
||||
>I : I
|
||||
>{[SYM]: 'str'} : { [SYM]: "str"; }
|
||||
>[SYM] : "str"
|
||||
>SYM : unique symbol
|
||||
>'str' : "str"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but its value is never read.
|
||||
tests/cases/compiler/file2.ts(1,1): error TS6133: 'Calculator' is declared but its value is never read.
|
||||
|
||||
|
||||
==== tests/cases/compiler/file1.ts (0 errors) ====
|
||||
@@ -8,5 +8,5 @@ tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but i
|
||||
|
||||
==== tests/cases/compiler/file2.ts (1 errors) ====
|
||||
import {Calculator} from "./file1"
|
||||
~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6133: 'Calculator' is declared but its value is never read.
|
||||
@@ -1,21 +1,18 @@
|
||||
tests/cases/compiler/a.ts(1,10): error TS6133: 'Member' is declared but its value is never read.
|
||||
tests/cases/compiler/a.ts(2,8): error TS6133: 'd' is declared but its value is never read.
|
||||
tests/cases/compiler/a.ts(2,13): error TS6133: 'M' is declared but its value is never read.
|
||||
tests/cases/compiler/a.ts(3,8): error TS6133: 'ns' is declared but its value is never read.
|
||||
tests/cases/compiler/a.ts(1,1): error TS6133: 'Member' is declared but its value is never read.
|
||||
tests/cases/compiler/a.ts(2,1): error TS6192: All imports in import declaration are unused.
|
||||
tests/cases/compiler/a.ts(3,1): error TS6133: 'ns' is declared but its value is never read.
|
||||
tests/cases/compiler/a.ts(4,1): error TS6133: 'r' is declared but its value is never read.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (5 errors) ====
|
||||
==== tests/cases/compiler/a.ts (4 errors) ====
|
||||
import { Member } from './b';
|
||||
~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6133: 'Member' is declared but its value is never read.
|
||||
import d, { Member as M } from './b';
|
||||
~
|
||||
!!! error TS6133: 'd' is declared but its value is never read.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS6133: 'M' is declared but its value is never read.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6192: All imports in import declaration are unused.
|
||||
import * as ns from './b';
|
||||
~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6133: 'ns' is declared but its value is never read.
|
||||
import r = require("./b");
|
||||
~~~~~~~~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/file2.ts(2,9): error TS6133: 'test' is declared but its value is never read.
|
||||
tests/cases/compiler/file2.ts(2,1): error TS6133: 'test' is declared but its value is never read.
|
||||
|
||||
|
||||
==== tests/cases/compiler/file1.ts (0 errors) ====
|
||||
@@ -13,7 +13,7 @@ tests/cases/compiler/file2.ts(2,9): error TS6133: 'test' is declared but its val
|
||||
==== tests/cases/compiler/file2.ts (1 errors) ====
|
||||
import {Calculator} from "./file1"
|
||||
import {test} from "./file1"
|
||||
~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6133: 'test' is declared but its value is never read.
|
||||
|
||||
var x = new Calculator();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/file2.ts(1,8): error TS6133: 'd' is declared but its value is never read.
|
||||
tests/cases/compiler/file2.ts(1,1): error TS6133: 'd' is declared but its value is never read.
|
||||
|
||||
|
||||
==== tests/cases/compiler/file1.ts (0 errors) ====
|
||||
@@ -16,7 +16,7 @@ tests/cases/compiler/file2.ts(1,8): error TS6133: 'd' is declared but its value
|
||||
|
||||
==== tests/cases/compiler/file2.ts (1 errors) ====
|
||||
import d from "./file1"
|
||||
~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6133: 'd' is declared but its value is never read.
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/file2.ts(1,8): error TS6133: 'n' is declared but its value is never read.
|
||||
tests/cases/compiler/file2.ts(1,1): error TS6133: 'n' is declared but its value is never read.
|
||||
|
||||
|
||||
==== tests/cases/compiler/file1.ts (0 errors) ====
|
||||
@@ -16,7 +16,7 @@ tests/cases/compiler/file2.ts(1,8): error TS6133: 'n' is declared but its value
|
||||
|
||||
==== tests/cases/compiler/file2.ts (1 errors) ====
|
||||
import * as n from "./file1"
|
||||
~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6133: 'n' is declared but its value is never read.
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/b.ts(1,1): error TS6192: All imports in import declaration are unused.
|
||||
/b.ts(2,1): error TS6192: All imports in import declaration are unused.
|
||||
/b.ts(4,14): error TS6133: 'a2' is declared but its value is never read.
|
||||
/b.ts(4,23): error TS6133: 'b2' is declared but its value is never read.
|
||||
/b.ts(6,12): error TS6133: 'ns2' is declared but its value is never read.
|
||||
/b.ts(8,8): error TS6133: 'd5' is declared but its value is never read.
|
||||
|
||||
|
||||
==== /a.ts (0 errors) ====
|
||||
export const a = 0;
|
||||
export const b = 0;
|
||||
export default 0;
|
||||
|
||||
==== /b.ts (6 errors) ====
|
||||
import d1, { a as a1, b as b1 } from "./a";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6192: All imports in import declaration are unused.
|
||||
import d2, * as ns from "./a";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6192: All imports in import declaration are unused.
|
||||
|
||||
import d3, { a as a2, b as b2 } from "./a";
|
||||
~~~~~~~
|
||||
!!! error TS6133: 'a2' is declared but its value is never read.
|
||||
~~~~~~~
|
||||
!!! error TS6133: 'b2' is declared but its value is never read.
|
||||
d3;
|
||||
import d4, * as ns2 from "./a";
|
||||
~~~~~~~~
|
||||
!!! error TS6133: 'ns2' is declared but its value is never read.
|
||||
d4;
|
||||
import d5, * as ns3 from "./a";
|
||||
~~
|
||||
!!! error TS6133: 'd5' is declared but its value is never read.
|
||||
ns3;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/unusedImports_entireImportDeclaration.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export const a = 0;
|
||||
export const b = 0;
|
||||
export default 0;
|
||||
|
||||
//// [b.ts]
|
||||
import d1, { a as a1, b as b1 } from "./a";
|
||||
import d2, * as ns from "./a";
|
||||
|
||||
import d3, { a as a2, b as b2 } from "./a";
|
||||
d3;
|
||||
import d4, * as ns2 from "./a";
|
||||
d4;
|
||||
import d5, * as ns3 from "./a";
|
||||
ns3;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.a = 0;
|
||||
exports.b = 0;
|
||||
exports["default"] = 0;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var a_1 = require("./a");
|
||||
a_1["default"];
|
||||
var a_2 = require("./a");
|
||||
a_2["default"];
|
||||
var ns3 = require("./a");
|
||||
ns3;
|
||||
@@ -0,0 +1,45 @@
|
||||
=== /a.ts ===
|
||||
export const a = 0;
|
||||
>a : Symbol(a, Decl(a.ts, 0, 12))
|
||||
|
||||
export const b = 0;
|
||||
>b : Symbol(b, Decl(a.ts, 1, 12))
|
||||
|
||||
export default 0;
|
||||
|
||||
=== /b.ts ===
|
||||
import d1, { a as a1, b as b1 } from "./a";
|
||||
>d1 : Symbol(d1, Decl(b.ts, 0, 6))
|
||||
>a : Symbol(a1, Decl(b.ts, 0, 12))
|
||||
>a1 : Symbol(a1, Decl(b.ts, 0, 12))
|
||||
>b : Symbol(b1, Decl(b.ts, 0, 21))
|
||||
>b1 : Symbol(b1, Decl(b.ts, 0, 21))
|
||||
|
||||
import d2, * as ns from "./a";
|
||||
>d2 : Symbol(d2, Decl(b.ts, 1, 6))
|
||||
>ns : Symbol(ns, Decl(b.ts, 1, 10))
|
||||
|
||||
import d3, { a as a2, b as b2 } from "./a";
|
||||
>d3 : Symbol(d3, Decl(b.ts, 3, 6))
|
||||
>a : Symbol(a2, Decl(b.ts, 3, 12))
|
||||
>a2 : Symbol(a2, Decl(b.ts, 3, 12))
|
||||
>b : Symbol(b2, Decl(b.ts, 3, 21))
|
||||
>b2 : Symbol(b2, Decl(b.ts, 3, 21))
|
||||
|
||||
d3;
|
||||
>d3 : Symbol(d3, Decl(b.ts, 3, 6))
|
||||
|
||||
import d4, * as ns2 from "./a";
|
||||
>d4 : Symbol(d4, Decl(b.ts, 5, 6))
|
||||
>ns2 : Symbol(ns2, Decl(b.ts, 5, 10))
|
||||
|
||||
d4;
|
||||
>d4 : Symbol(d4, Decl(b.ts, 5, 6))
|
||||
|
||||
import d5, * as ns3 from "./a";
|
||||
>d5 : Symbol(d5, Decl(b.ts, 7, 6))
|
||||
>ns3 : Symbol(ns3, Decl(b.ts, 7, 10))
|
||||
|
||||
ns3;
|
||||
>ns3 : Symbol(ns3, Decl(b.ts, 7, 10))
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
=== /a.ts ===
|
||||
export const a = 0;
|
||||
>a : 0
|
||||
>0 : 0
|
||||
|
||||
export const b = 0;
|
||||
>b : 0
|
||||
>0 : 0
|
||||
|
||||
export default 0;
|
||||
|
||||
=== /b.ts ===
|
||||
import d1, { a as a1, b as b1 } from "./a";
|
||||
>d1 : 0
|
||||
>a : 0
|
||||
>a1 : 0
|
||||
>b : 0
|
||||
>b1 : 0
|
||||
|
||||
import d2, * as ns from "./a";
|
||||
>d2 : 0
|
||||
>ns : typeof ns
|
||||
|
||||
import d3, { a as a2, b as b2 } from "./a";
|
||||
>d3 : 0
|
||||
>a : 0
|
||||
>a2 : 0
|
||||
>b : 0
|
||||
>b2 : 0
|
||||
|
||||
d3;
|
||||
>d3 : 0
|
||||
|
||||
import d4, * as ns2 from "./a";
|
||||
>d4 : 0
|
||||
>ns2 : typeof ns
|
||||
|
||||
d4;
|
||||
>d4 : 0
|
||||
|
||||
import d5, * as ns3 from "./a";
|
||||
>d5 : 0
|
||||
>ns3 : typeof ns
|
||||
|
||||
ns3;
|
||||
>ns3 : typeof ns
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
../../../../built/local/lib.dom.d.ts(1737,11): error TS2300: Duplicate identifier 'Comment'.
|
||||
../../../../built/local/lib.dom.d.ts(1741,13): error TS2300: Duplicate identifier 'Comment'.
|
||||
../../../../built/local/lib.dom.d.ts(1942,11): error TS2300: Duplicate identifier 'CSSRule'.
|
||||
../../../../built/local/lib.dom.d.ts(1961,13): error TS2300: Duplicate identifier 'CSSRule'.
|
||||
../../../../built/local/lib.dom.d.ts(3689,11): error TS2300: Duplicate identifier 'Event'.
|
||||
../../../../built/local/lib.dom.d.ts(3713,13): error TS2300: Duplicate identifier 'Event'.
|
||||
../../../../built/local/lib.dom.d.ts(9090,11): error TS2300: Duplicate identifier 'Position'.
|
||||
../../../../built/local/lib.dom.d.ts(9095,13): error TS2300: Duplicate identifier 'Position'.
|
||||
../../../../built/local/lib.dom.d.ts(9238,11): error TS2300: Duplicate identifier 'Request'.
|
||||
../../../../built/local/lib.dom.d.ts(9256,13): error TS2300: Duplicate identifier 'Request'.
|
||||
../../../../built/local/lib.dom.d.ts(13516,11): error TS2300: Duplicate identifier 'Window'.
|
||||
../../../../built/local/lib.dom.d.ts(13705,13): error TS2300: Duplicate identifier 'Window'.
|
||||
../../../../built/local/lib.dom.d.ts(2255,11): error TS2300: Duplicate identifier 'CSSRule'.
|
||||
../../../../built/local/lib.dom.d.ts(2274,13): error TS2300: Duplicate identifier 'CSSRule'.
|
||||
../../../../built/local/lib.dom.d.ts(2964,11): error TS2300: Duplicate identifier 'Comment'.
|
||||
../../../../built/local/lib.dom.d.ts(2968,13): error TS2300: Duplicate identifier 'Comment'.
|
||||
../../../../built/local/lib.dom.d.ts(4605,11): error TS2300: Duplicate identifier 'Event'.
|
||||
../../../../built/local/lib.dom.d.ts(4630,13): error TS2300: Duplicate identifier 'Event'.
|
||||
../../../../built/local/lib.dom.d.ts(10082,11): error TS2300: Duplicate identifier 'Position'.
|
||||
../../../../built/local/lib.dom.d.ts(10087,13): error TS2300: Duplicate identifier 'Position'.
|
||||
../../../../built/local/lib.dom.d.ts(10575,11): error TS2300: Duplicate identifier 'Request'.
|
||||
../../../../built/local/lib.dom.d.ts(10593,13): error TS2300: Duplicate identifier 'Request'.
|
||||
../../../../built/local/lib.dom.d.ts(14907,11): error TS2300: Duplicate identifier 'Window'.
|
||||
../../../../built/local/lib.dom.d.ts(15102,13): error TS2300: Duplicate identifier 'Window'.
|
||||
../../../../built/local/lib.es5.d.ts(1328,11): error TS2300: Duplicate identifier 'ArrayLike'.
|
||||
../../../../built/local/lib.es5.d.ts(1364,6): error TS2300: Duplicate identifier 'Record'.
|
||||
../../../../node_modules/@types/node/index.d.ts(150,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'module' must be of type '{ [x: string]: any; }', but here has type 'NodeModule'.
|
||||
@@ -21,7 +21,6 @@ node_modules/chrome-devtools-frontend/front_end/Runtime.js(147,37): error TS2339
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(161,5): error TS2322: Type 'Promise<undefined[]>' is not assignable to type 'Promise<undefined>'.
|
||||
Type 'undefined[]' is not assignable to type 'undefined'.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(187,12): error TS2339: Property 'eval' does not exist on type 'Window'.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(219,13): error TS2339: Property 'timeStamp' does not exist on type 'Console'.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(267,14): error TS2339: Property 'runtime' does not exist on type 'Window'.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(269,59): error TS2339: Property 'runtime' does not exist on type 'Window'.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(270,9): error TS2322: Type 'Promise<void>' is not assignable to type 'Promise<undefined>'.
|
||||
@@ -338,7 +337,7 @@ node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(811,
|
||||
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(7,11): error TS2339: Property 'AnimationScreenshotPopover' does not exist on type '{ new (effect?: AnimationEffectReadOnly, timeline?: AnimationTimeline): Animation; prototype: Ani...'.
|
||||
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(9,23): error TS2304: Cannot find name 'Image'.
|
||||
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(18,39): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'Node'.
|
||||
Property 'attributes' is missing in type 'new (width?: number, height?: number) => HTMLImageElement'.
|
||||
Property 'baseURI' is missing in type 'new (width?: number, height?: number) => HTMLImageElement'.
|
||||
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(19,13): error TS2339: Property 'style' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'.
|
||||
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(22,21): error TS2339: Property 'style' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'.
|
||||
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(23,45): error TS2339: Property 'createChild' does not exist on type 'Element'.
|
||||
@@ -810,7 +809,7 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/Audits2Service.js
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/Audits2Service.js(128,1): error TS2322: Type 'Window' is not assignable to type 'typeof global'.
|
||||
Types of property 'document' are incompatible.
|
||||
Type 'Document' is not assignable to type '{ [x: string]: any; documentElement: { [x: string]: any; style: { [x: string]: any; WebkitAppeara...'.
|
||||
Property 'activeElement' does not exist on type '{ [x: string]: any; documentElement: { [x: string]: any; style: { [x: string]: any; WebkitAppeara...'.
|
||||
Property 'URL' does not exist on type '{ [x: string]: any; documentElement: { [x: string]: any; style: { [x: string]: any; WebkitAppeara...'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/Audits2Service.js(129,8): error TS2339: Property 'isVinn' does not exist on type 'typeof global'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(2,1): error TS2322: Type '(o: any, u: any) => any' is not assignable to type 'NodeRequire'.
|
||||
Property 'resolve' is missing in type '(o: any, u: any) => any'.
|
||||
@@ -1311,6 +1310,7 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(39899,1): error TS2304: Cannot find name 'WebInspector'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(39909,1): error TS2304: Cannot find name 'WebInspector'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(39957,1): error TS2304: Cannot find name 'WebInspector'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(39957,68): error TS2339: Property 'message' does not exist on type 'ProgressEvent'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(39963,1): error TS2304: Cannot find name 'WebInspector'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(39980,16): error TS2304: Cannot find name 'WebInspector'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(39986,1): error TS2304: Cannot find name 'WebInspector'.
|
||||
@@ -1609,7 +1609,6 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(43262,37): error TS2339: Property 'regexSpecialCharacters' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(43369,8): error TS2339: Property 'hashCode' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(43395,8): error TS2339: Property 'isDigitAt' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(43414,17): error TS2304: Cannot find name 'TextEncoder'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(43442,8): error TS2339: Property 'naturalOrderComparator' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(43486,8): error TS2339: Property 'caseInsensetiveComparator' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(43501,8): error TS2339: Property 'constrain' does not exist on type 'NumberConstructor'.
|
||||
@@ -3649,12 +3648,10 @@ node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(38,15): er
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(43,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(48,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(55,16): error TS2304: Cannot find name 'FileError'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(76,25): error TS2304: Cannot find name 'TextDecoder'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(78,17): error TS2304: Cannot find name 'FileError'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(125,23): error TS2339: Property 'name' does not exist on type 'Blob'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(130,16): error TS2304: Cannot find name 'FileError'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(143,22): error TS2339: Property 'readyState' does not exist on type 'EventTarget'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(143,48): error TS2339: Property 'DONE' does not exist on type '{ new (): FileReader; prototype: FileReader; }'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(146,31): error TS2339: Property 'result' does not exist on type 'EventTarget'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(178,32): error TS2339: Property 'error' does not exist on type 'EventTarget'.
|
||||
node_modules/chrome-devtools-frontend/front_end/bindings/FileUtils.js(190,15): error TS1055: Type 'Promise<boolean>' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
|
||||
@@ -4543,7 +4540,6 @@ node_modules/chrome-devtools-frontend/front_end/components/DockController.js(70,
|
||||
node_modules/chrome-devtools-frontend/front_end/components/DockController.js(71,7): error TS2555: Expected at least 2 arguments, but got 1.
|
||||
node_modules/chrome-devtools-frontend/front_end/components/DockController.js(77,22): error TS2345: Argument of type 'V' is not assignable to parameter of type 'string'.
|
||||
node_modules/chrome-devtools-frontend/front_end/components/DockController.js(116,33): error TS2339: Property 'deepActiveElement' does not exist on type 'Document'.
|
||||
node_modules/chrome-devtools-frontend/front_end/components/DockController.js(119,13): error TS2339: Property 'timeStamp' does not exist on type 'Console'.
|
||||
node_modules/chrome-devtools-frontend/front_end/components/DockController.js(121,39): error TS2345: Argument of type 'string' is not assignable to parameter of type 'V'.
|
||||
node_modules/chrome-devtools-frontend/front_end/components/DockController.js(122,27): error TS2339: Property 'setIsDocked' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
node_modules/chrome-devtools-frontend/front_end/components/DockController.js(141,40): error TS2345: Argument of type 'V' is not assignable to parameter of type 'string'.
|
||||
@@ -6192,7 +6188,7 @@ node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(74
|
||||
node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(745,60): error TS2339: Property 'pageY' does not exist on type 'Event'.
|
||||
node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(753,20): error TS2551: Property 'deepElementFromPoint' does not exist on type 'Document'. Did you mean 'msElementsFromPoint'?
|
||||
node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(761,5): error TS2322: Type 'ShadowRoot' is not assignable to type 'Document'.
|
||||
Property 'alinkColor' is missing in type 'ShadowRoot'.
|
||||
Property 'URL' is missing in type 'ShadowRoot'.
|
||||
node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(766,28): error TS2339: Property 'deepElementFromPoint' does not exist on type 'DocumentFragment'.
|
||||
node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(766,70): error TS2551: Property 'deepElementFromPoint' does not exist on type 'Document'. Did you mean 'msElementsFromPoint'?
|
||||
node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(771,20): error TS2339: Property 'deepActiveElement' does not exist on type 'Document'.
|
||||
@@ -6961,7 +6957,6 @@ node_modules/chrome-devtools-frontend/front_end/elements_test_runner/SetOuterHTM
|
||||
node_modules/chrome-devtools-frontend/front_end/elements_test_runner/StylesUpdateLinksTestRunner.js(99,35): error TS2339: Property 'sprintf' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/elements_test_runner/StylesUpdateLinksTestRunner.js(119,24): error TS2551: Property 'panels' does not exist on type 'typeof UI'. Did you mean 'Panel'?
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(31,5): error TS2554: Expected 2 arguments, but got 1.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(49,13): error TS2339: Property 'timeStamp' does not exist on type 'Console'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(56,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(88,7): error TS2554: Expected 2 arguments, but got 1.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(92,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
|
||||
@@ -6970,7 +6965,6 @@ node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(124,22)
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(142,44): error TS2339: Property 'style' does not exist on type 'Element'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(169,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(174,57): error TS2339: Property 'window' does not exist on type 'Element'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(180,13): error TS2339: Property 'timeStamp' does not exist on type 'Console'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(181,27): error TS2339: Property 'setInspectedPageBounds' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type '(Anonymous class)' is not assignable to type '{ [x: string]: any; presentUI(document: Document): void; }'.
|
||||
node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type '(Anonymous class)' is not assignable to type '{ [x: string]: any; presentUI(document: Document): void; }'.
|
||||
@@ -8615,9 +8609,7 @@ node_modules/chrome-devtools-frontend/front_end/main/ExecutionContextSelector.js
|
||||
node_modules/chrome-devtools-frontend/front_end/main/ExecutionContextSelector.js(174,31): error TS2345: Argument of type 'typeof (Anonymous class)' is not assignable to parameter of type 'new (arg1: any) => (Anonymous class)'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/ExecutionContextSelector.js(203,29): error TS2345: Argument of type 'typeof (Anonymous class)' is not assignable to parameter of type 'new (arg1: any) => (Anonymous class)'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(39,15): error TS2339: Property '_instanceForTest' does not exist on type 'typeof (Anonymous class)'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(69,13): error TS2339: Property 'timeStamp' does not exist on type 'Console'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(71,27): error TS2339: Property 'getPreferences' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(78,13): error TS2339: Property 'timeStamp' does not exist on type 'Console'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(80,12): error TS2339: Property 'runtime' does not exist on type 'Window'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(105,38): error TS2339: Property 'setPreference' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(105,75): error TS2339: Property 'removePreference' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
@@ -8644,7 +8636,6 @@ node_modules/chrome-devtools-frontend/front_end/main/Main.js(261,27): error TS23
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(284,27): error TS2339: Property 'connectionReady' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(287,27): error TS2339: Property 'readyForTest' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(294,17): error TS2339: Property '_disconnectedScreenWithReasonWasShown' does not exist on type 'typeof Main'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(300,13): error TS2339: Property 'timeStamp' does not exist on type 'Console'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(302,32): error TS2339: Property 'initializeExtensions' does not exist on type 'typeof extensionServer'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(314,27): error TS2339: Property 'setWhitelistedShortcuts' does not exist on type 'typeof InspectorFrontendHost'.
|
||||
node_modules/chrome-devtools-frontend/front_end/main/Main.js(321,24): error TS2694: Namespace 'Common' has no exported member 'Event'.
|
||||
@@ -10301,7 +10292,6 @@ node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(132,8): er
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(133,27): error TS2339: Property 'regexSpecialCharacters' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(250,8): error TS2339: Property 'hashCode' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(275,8): error TS2339: Property 'isDigitAt' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(291,21): error TS2304: Cannot find name 'TextEncoder'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(320,8): error TS2339: Property 'naturalOrderComparator' does not exist on type 'StringConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(335,19): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(336,19): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
@@ -13835,6 +13825,7 @@ node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(144,76):
|
||||
node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(223,35): error TS2339: Property 'childElementCount' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(266,25): error TS2339: Property 'highlightedSearchResultClassName' does not exist on type 'typeof UI'.
|
||||
node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(290,24): error TS2339: Property 'tagName' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(296,31): error TS2339: Property 'attributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(305,20): error TS2339: Property 'childElementCount' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(342,21): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'.
|
||||
node_modules/chrome-devtools-frontend/front_end/sources/AddSourceMapURLDialog.js(14,25): error TS2339: Property 'createChild' does not exist on type 'Element'.
|
||||
@@ -15114,6 +15105,7 @@ node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(712,2)
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(713,12): error TS2339: Property 'CustomFormatters' does not exist on type 'typeof TestRunner'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(717,24): error TS2694: Namespace 'TestRunner' has no exported member 'CustomFormatters'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(748,24): error TS2694: Namespace 'TestRunner' has no exported member 'CustomFormatters'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(777,22): error TS2339: Property 'attributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(785,14): error TS2339: Property 'shadowRoot' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(786,39): error TS2339: Property 'shadowRoot' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(805,12): error TS2339: Property 'shadowRoot' does not exist on type 'Node'.
|
||||
@@ -15148,8 +15140,8 @@ node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1258,2
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1279,81): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(value: any) => any'.
|
||||
Type 'Function' provides no match for the signature '(value: any): any'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1304,3): error TS2322: Type 'Promise<void>' is not assignable to type 'Promise<undefined>'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1310,30): error TS2551: Property 'getAttribute' does not exist on type 'Node'. Did you mean 'attributes'?
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1311,44): error TS2551: Property 'getAttribute' does not exist on type 'Node'. Did you mean 'attributes'?
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1310,30): error TS2339: Property 'getAttribute' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1311,44): error TS2339: Property 'getAttribute' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1388,16): error TS2339: Property 'testRunner' does not exist on type 'Window'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1424,14): error TS2339: Property '_initializeTargetForStartupTest' does not exist on type 'typeof TestRunner'.
|
||||
node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1425,37): error TS2339: Property '_instanceForTest' does not exist on type 'typeof (Anonymous class)'.
|
||||
@@ -15572,7 +15564,7 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataP
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(655,39): error TS2339: Property 'naturalWidth' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(660,23): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'HTMLCanvasElement | HTMLImageElement | HTMLVideoElement | ImageBitmap'.
|
||||
Type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to type 'ImageBitmap'.
|
||||
Property 'width' is missing in type 'new (width?: number, height?: number) => HTMLImageElement'.
|
||||
Property 'height' is missing in type 'new (width?: number, height?: number) => HTMLImageElement'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(684,9): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: any; Frame: symbol; Event: symbol; InteractionRecord: symbol; ExtensionEvent: symb...' and 'symbol'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(689,9): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: any; Frame: symbol; Event: symbol; InteractionRecord: symbol; ExtensionEvent: symb...' and 'symbol'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(694,9): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: any; Frame: symbol; Event: symbol; InteractionRecord: symbol; ExtensionEvent: symb...' and 'symbol'.
|
||||
@@ -16233,7 +16225,7 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1664
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1665,67): error TS2555: Expected at least 2 arguments, but got 1.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2322: Type 'DocumentFragment' is not assignable to type 'Element'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2322: Type 'DocumentFragment' is not assignable to type 'Element'.
|
||||
Property 'classList' is missing in type 'DocumentFragment'.
|
||||
Property 'assignedSlot' is missing in type 'DocumentFragment'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1684,30): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1685,16): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1687,13): error TS2339: Property 'createTextChild' does not exist on type 'Element'.
|
||||
@@ -16619,9 +16611,15 @@ node_modules/chrome-devtools-frontend/front_end/ui/FilterSuggestionBuilder.js(21
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/ForwardedInputEventHandler.js(14,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(12,49): error TS2694: Namespace '(Anonymous class)' has no exported member '_State'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(84,28): error TS2694: Namespace '(Anonymous class)' has no exported member '_Template'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(114,18): error TS2551: Property 'hasAttribute' does not exist on type 'Node'. Did you mean 'hasAttributes'?
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(116,39): error TS2551: Property 'getAttribute' does not exist on type 'Node'. Did you mean 'attributes'?
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(113,55): error TS2339: Property 'hasAttributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(114,18): error TS2339: Property 'hasAttribute' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(116,39): error TS2339: Property 'getAttribute' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(117,16): error TS2339: Property 'removeAttribute' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(121,34): error TS2339: Property 'attributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(122,27): error TS2339: Property 'attributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(130,75): error TS2339: Property 'attributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(135,60): error TS2339: Property 'attributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(143,35): error TS2339: Property 'attributes' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(148,16): error TS2339: Property 'removeAttribute' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(151,52): error TS2339: Property 'data' does not exist on type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(152,26): error TS2339: Property 'data' does not exist on type 'Node'.
|
||||
@@ -17204,7 +17202,7 @@ node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(610,54): error
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(622,35): error TS2339: Property 'getComponentSelection' does not exist on type 'Element'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(627,7): error TS2322: Type 'Node' is not assignable to type 'Element'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(627,7): error TS2322: Type 'Node' is not assignable to type 'Element'.
|
||||
Property 'classList' is missing in type 'Node'.
|
||||
Property 'assignedSlot' is missing in type 'Node'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(43,50): error TS2339: Property 'createChild' does not exist on type 'Element'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(48,45): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(75,24): error TS2694: Namespace 'Common' has no exported member 'Event'.
|
||||
@@ -17272,7 +17270,7 @@ node_modules/chrome-devtools-frontend/front_end/ui/Tooltip.js(135,17): error TS2
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Tooltip.js(136,17): error TS2339: Property 'y' does not exist on type 'Event'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Tooltip.js(178,17): error TS2304: Cannot find name 'ObjectPropertyDescriptor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/Tooltip.js(195,24): error TS2345: Argument of type 'PropertyDescriptor' is not assignable to parameter of type 'Element'.
|
||||
Property 'classList' is missing in type 'PropertyDescriptor'.
|
||||
Property 'assignedSlot' is missing in type 'PropertyDescriptor'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(31,4): error TS2339: Property 'highlightedSearchResultClassName' does not exist on type 'typeof UI'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(32,4): error TS2339: Property 'highlightedCurrentSearchResultClassName' does not exist on type 'typeof UI'.
|
||||
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(69,13): error TS2339: Property 'style' does not exist on type 'Element'.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// https://github.com/Microsoft/TypeScript/issues/21828
|
||||
const d2 = `\\0041`;
|
||||
@@ -0,0 +1,11 @@
|
||||
// @lib: es6
|
||||
// https://github.com/Microsoft/TypeScript/issues/21962
|
||||
export const SYM = Symbol('a unique symbol');
|
||||
|
||||
export interface I {
|
||||
[SYM]: 'sym';
|
||||
[x: string]: 'str';
|
||||
}
|
||||
|
||||
let a: I = {[SYM]: 'sym'}; // Expect ok
|
||||
let b: I = {[SYM]: 'str'}; // Expect error
|
||||
@@ -0,0 +1,17 @@
|
||||
// @noUnusedLocals: true
|
||||
|
||||
// @Filename: /a.ts
|
||||
export const a = 0;
|
||||
export const b = 0;
|
||||
export default 0;
|
||||
|
||||
// @Filename: /b.ts
|
||||
import d1, { a as a1, b as b1 } from "./a";
|
||||
import d2, * as ns from "./a";
|
||||
|
||||
import d3, { a as a2, b as b2 } from "./a";
|
||||
d3;
|
||||
import d4, * as ns2 from "./a";
|
||||
d4;
|
||||
import d5, * as ns3 from "./a";
|
||||
ns3;
|
||||
@@ -1,15 +1,15 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noImplicitAny: true
|
||||
////function f1([|a |]) { }
|
||||
////function f1(a) { }
|
||||
////function h1() {
|
||||
//// class C { p: number };
|
||||
//// f1({ ofTypeC: new C() });
|
||||
////}
|
||||
////
|
||||
////function f2([|a |]) { }
|
||||
////function f2(a) { }
|
||||
////function h2() {
|
||||
//// interface I { a: number }
|
||||
//// interface I { a: number }
|
||||
//// var i: I = {a : 1};
|
||||
//// f2(i);
|
||||
//// f2(2);
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
// @noImplicitAny: true
|
||||
//// function f(y, z = { p: y[
|
||||
|
||||
verify.getAndApplyCodeFix();
|
||||
verify.not.codeFixAvailable();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedLocals: true
|
||||
// @Filename: /a.ts
|
||||
////// leading trivia
|
||||
////import a, { b } from "mod"; // trailing trivia
|
||||
|
||||
verify.codeFix({
|
||||
description: "Remove import from 'mod'",
|
||||
newFileContent: " // trailing trivia",
|
||||
});
|
||||
Reference in New Issue
Block a user