mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into referencesDogfood_1
This commit is contained in:
Generated
+369
-416
File diff suppressed because it is too large
Load Diff
@@ -28,13 +28,11 @@ function walk(ctx: Lint.WalkContext<void>): void {
|
||||
function shouldIgnoreCalledExpression(expression: ts.Expression): boolean {
|
||||
if (expression.kind === ts.SyntaxKind.PropertyAccessExpression) {
|
||||
const methodName = (expression as ts.PropertyAccessExpression).name.text;
|
||||
if (methodName.indexOf("set") === 0) {
|
||||
if (methodName.startsWith("set") || methodName.startsWith("assert")) {
|
||||
return true;
|
||||
}
|
||||
switch (methodName) {
|
||||
case "apply":
|
||||
case "assert":
|
||||
case "assertEqual":
|
||||
case "call":
|
||||
case "equal":
|
||||
case "fail":
|
||||
@@ -46,11 +44,10 @@ function walk(ctx: Lint.WalkContext<void>): void {
|
||||
}
|
||||
else if (expression.kind === ts.SyntaxKind.Identifier) {
|
||||
const functionName = (expression as ts.Identifier).text;
|
||||
if (functionName.indexOf("set") === 0) {
|
||||
if (functionName.startsWith("set") || functionName.startsWith("assert")) {
|
||||
return true;
|
||||
}
|
||||
switch (functionName) {
|
||||
case "assert":
|
||||
case "contains":
|
||||
case "createAnonymousType":
|
||||
case "createImportSpecifier":
|
||||
|
||||
+19
-7
@@ -4170,14 +4170,17 @@ namespace ts {
|
||||
else {
|
||||
// Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
|
||||
const name = declaration.propertyName || <Identifier>declaration.name;
|
||||
if (isComputedNonLiteralName(name)) {
|
||||
// computed properties with non-literal names are treated as 'any'
|
||||
const isLate = isLateBindableName(name);
|
||||
const isWellKnown = isComputedPropertyName(name) && isWellKnownSymbolSyntactically(name.expression);
|
||||
if (!isLate && !isWellKnown && isComputedNonLiteralName(name)) {
|
||||
return anyType;
|
||||
}
|
||||
|
||||
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
|
||||
// or otherwise the type of the string index signature.
|
||||
const text = getTextOfPropertyName(name);
|
||||
const text = isLate ? getLateBoundNameFromType(checkComputedPropertyName(name as ComputedPropertyName) as LiteralType | UniqueESSymbolType) :
|
||||
isWellKnown ? getPropertyNameForKnownSymbolName(idText(((name as ComputedPropertyName).expression as PropertyAccessExpression).name)) :
|
||||
getTextOfPropertyName(name);
|
||||
|
||||
// Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation
|
||||
if (strictNullChecks && declaration.flags & NodeFlags.Ambient && isParameterDeclaration(declaration)) {
|
||||
@@ -4363,7 +4366,7 @@ namespace ts {
|
||||
for (const declaration of symbol.declarations) {
|
||||
let declarationInConstructor = false;
|
||||
const expression = declaration.kind === SyntaxKind.BinaryExpression ? <BinaryExpression>declaration :
|
||||
declaration.kind === SyntaxKind.PropertyAccessExpression ? <BinaryExpression>getAncestor(declaration, SyntaxKind.BinaryExpression) :
|
||||
declaration.kind === SyntaxKind.PropertyAccessExpression ? cast(declaration.parent, isBinaryExpression) :
|
||||
undefined;
|
||||
|
||||
if (!expression) {
|
||||
@@ -13875,7 +13878,8 @@ namespace ts {
|
||||
const assignmentKind = getAssignmentTargetKind(node);
|
||||
|
||||
if (assignmentKind) {
|
||||
if (!(localOrExportSymbol.flags & SymbolFlags.Variable)) {
|
||||
if (!(localOrExportSymbol.flags & SymbolFlags.Variable) &&
|
||||
!(isInJavaScriptFile(node) && localOrExportSymbol.flags & SymbolFlags.ValueModule)) {
|
||||
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol));
|
||||
return unknownType;
|
||||
}
|
||||
@@ -19086,6 +19090,9 @@ namespace ts {
|
||||
|
||||
const links = getNodeLinks(node);
|
||||
const type = getTypeOfSymbol(node.symbol);
|
||||
if (isTypeAny(type)) {
|
||||
return type;
|
||||
}
|
||||
|
||||
// Check if function expression is contextually typed and assign parameter types if so.
|
||||
if (!(links.flags & NodeCheckFlags.ContextChecked)) {
|
||||
@@ -19848,8 +19855,9 @@ namespace ts {
|
||||
// VarExpr = ValueExpr
|
||||
// requires VarExpr to be classified as a reference
|
||||
// A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1)
|
||||
// and the type of the non - compound operation to be assignable to the type of VarExpr.
|
||||
if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
|
||||
// and the type of the non-compound operation to be assignable to the type of VarExpr.
|
||||
if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)
|
||||
&& (!isIdentifier(left) || unescapeLeadingUnderscores(left.escapedText) !== "exports")) {
|
||||
// to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
|
||||
checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined);
|
||||
}
|
||||
@@ -21867,6 +21875,10 @@ namespace ts {
|
||||
// and give a better error message when the host function mentions `arguments`
|
||||
// but the tag doesn't have an array type
|
||||
if (decl) {
|
||||
const i = getJSDocTags(decl).filter(isJSDocParameterTag).indexOf(node);
|
||||
if (i > -1 && i < decl.parameters.length && isBindingPattern(decl.parameters[i].name)) {
|
||||
return;
|
||||
}
|
||||
if (!containsArgumentsReference(decl)) {
|
||||
error(node.name,
|
||||
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name,
|
||||
|
||||
@@ -1265,10 +1265,7 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
export function assign<T1 extends MapLike<{}>, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3;
|
||||
export function assign<T1 extends MapLike<{}>, T2>(t: T1, arg1: T2): T1 & T2;
|
||||
export function assign<T1 extends MapLike<{}>>(t: T1, ...args: any[]): any;
|
||||
export function assign<T1 extends MapLike<{}>>(t: T1, ...args: any[]) {
|
||||
export function assign<T extends object>(t: T, ...args: T[]) {
|
||||
for (const arg of args) {
|
||||
for (const p in arg) {
|
||||
if (hasProperty(arg, p)) {
|
||||
@@ -1724,6 +1721,10 @@ namespace ts {
|
||||
return compareComparableValues(a, b);
|
||||
}
|
||||
|
||||
export function min<T>(a: T, b: T, compare: Comparer<T>): T {
|
||||
return compare(a, b) === Comparison.LessThan ? a : b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two strings using a case-insensitive ordinal comparison.
|
||||
*
|
||||
@@ -3119,8 +3120,8 @@ namespace ts {
|
||||
return (arg: T) => f(arg) && g(arg);
|
||||
}
|
||||
|
||||
export function or<T>(f: (arg: T) => boolean, g: (arg: T) => boolean) {
|
||||
return (arg: T) => f(arg) || g(arg);
|
||||
export function or<T>(f: (arg: T) => boolean, g: (arg: T) => boolean): (arg: T) => boolean {
|
||||
return arg => f(arg) || g(arg);
|
||||
}
|
||||
|
||||
export function assertTypeIsNever(_: never): void { } // tslint:disable-line no-empty
|
||||
|
||||
@@ -4161,5 +4161,9 @@
|
||||
"Convert all constructor functions to classes": {
|
||||
"category": "Message",
|
||||
"code": 95045
|
||||
},
|
||||
"Generate 'get' and 'set' accessors": {
|
||||
"category": "Message",
|
||||
"code": 95046
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7600,7 +7600,7 @@ namespace ts {
|
||||
const tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
|
||||
const singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im;
|
||||
function extractPragmas(pragmas: PragmaPsuedoMapEntry[], range: CommentRange, text: string) {
|
||||
const tripleSlash = tripleSlashXMLCommentStartRegEx.exec(text);
|
||||
const tripleSlash = range.kind === SyntaxKind.SingleLineCommentTrivia && tripleSlashXMLCommentStartRegEx.exec(text);
|
||||
if (tripleSlash) {
|
||||
const name = tripleSlash[1].toLowerCase() as keyof PragmaPsuedoMap; // Technically unsafe cast, but we do it so the below check to make it safe typechecks
|
||||
const pragma = commentPragmas[name] as PragmaDefinition;
|
||||
@@ -7637,15 +7637,17 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
const singleLine = singleLinePragmaRegEx.exec(text);
|
||||
const singleLine = range.kind === SyntaxKind.SingleLineCommentTrivia && singleLinePragmaRegEx.exec(text);
|
||||
if (singleLine) {
|
||||
return addPragmaForMatch(pragmas, range, PragmaKindFlags.SingleLine, singleLine);
|
||||
}
|
||||
|
||||
const multiLinePragmaRegEx = /\s*@(\S+)\s*(.*)\s*$/gim; // Defined inline since it uses the "g" flag, which keeps a persistent index (for iterating)
|
||||
let multiLineMatch: RegExpExecArray;
|
||||
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
||||
addPragmaForMatch(pragmas, range, PragmaKindFlags.MultiLine, multiLineMatch);
|
||||
if (range.kind === SyntaxKind.MultiLineCommentTrivia) {
|
||||
const multiLinePragmaRegEx = /\s*@(\S+)\s*(.*)\s*$/gim; // Defined inline since it uses the "g" flag, which keeps a persistent index (for iterating)
|
||||
let multiLineMatch: RegExpExecArray;
|
||||
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
||||
addPragmaForMatch(pragmas, range, PragmaKindFlags.MultiLine, multiLineMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -573,7 +573,6 @@ namespace ts {
|
||||
const packageIdToSourceFile = createMap<SourceFile>();
|
||||
// Maps from a SourceFile's `.path` to the name of the package it was imported with.
|
||||
let sourceFileToPackageName = createMap<string>();
|
||||
// See `sourceFileIsRedirectedTo`.
|
||||
let redirectTargetsSet = createMap<true>();
|
||||
|
||||
const filesByName = createMap<SourceFile | undefined>();
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
let reportDiagnostic = createDiagnosticReporter(sys);
|
||||
function udpateReportDiagnostic(options: CompilerOptions) {
|
||||
function updateReportDiagnostic(options: CompilerOptions) {
|
||||
if (options.pretty) {
|
||||
reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace ts {
|
||||
const commandLineOptions = commandLine.options;
|
||||
if (configFileName) {
|
||||
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic);
|
||||
udpateReportDiagnostic(configParseResult.options);
|
||||
updateReportDiagnostic(configParseResult.options);
|
||||
if (isWatchSet(configParseResult.options)) {
|
||||
reportWatchModeWithoutSysSupport();
|
||||
createWatchOfConfigFile(configParseResult, commandLineOptions);
|
||||
@@ -117,7 +117,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
udpateReportDiagnostic(commandLineOptions);
|
||||
updateReportDiagnostic(commandLineOptions);
|
||||
if (isWatchSet(commandLineOptions)) {
|
||||
reportWatchModeWithoutSysSupport();
|
||||
createWatchOfFilesAndCompilerOptions(commandLine.fileNames, commandLineOptions);
|
||||
|
||||
@@ -2527,7 +2527,7 @@ namespace ts {
|
||||
/**
|
||||
* If two source files are for the same version of the same package, one will redirect to the other.
|
||||
* (See `createRedirectSourceFile` in program.ts.)
|
||||
* The redirect will have this set. The other will not have anything set, but see Program#sourceFileIsRedirectedTo.
|
||||
* The redirect will have this set. The redirected-to source file will be in `redirectTargetsSet`.
|
||||
*/
|
||||
/* @internal */ redirectInfo?: RedirectInfo | undefined;
|
||||
|
||||
|
||||
@@ -4271,7 +4271,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function isParameterPropertyDeclaration(node: Node): boolean {
|
||||
export function isParameterPropertyDeclaration(node: Node): node is ParameterDeclaration {
|
||||
return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent);
|
||||
}
|
||||
|
||||
@@ -4630,11 +4630,21 @@ namespace ts {
|
||||
* parameters by name and binding patterns do not have a name.
|
||||
*/
|
||||
export function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag> {
|
||||
if (param.name && isIdentifier(param.name)) {
|
||||
const name = param.name.escapedText;
|
||||
return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
|
||||
if (param.name) {
|
||||
if (isIdentifier(param.name)) {
|
||||
const name = param.name.escapedText;
|
||||
return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
|
||||
}
|
||||
else {
|
||||
const i = param.parent.parameters.indexOf(param);
|
||||
Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
|
||||
const paramTags = getJSDocTags(param.parent).filter(isJSDocParameterTag);
|
||||
if (i < paramTags.length) {
|
||||
return [paramTags[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
// a binding pattern doesn't have a name, so it's not possible to match it a JSDoc parameter, which is identified by name
|
||||
// return empty array for: out-of-order binding patterns and JSDoc function syntax, which has un-named parameters
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
|
||||
@@ -1081,8 +1081,20 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
private verifyDocumentHighlightsRespectFilesList(files: ReadonlyArray<string>): void {
|
||||
const startFile = this.activeFile.fileName;
|
||||
for (const fileName of files) {
|
||||
const searchFileNames = startFile === fileName ? [startFile] : [startFile, fileName];
|
||||
const highlights = this.getDocumentHighlightsAtCurrentPosition(searchFileNames);
|
||||
if (!highlights.every(dh => ts.contains(searchFileNames, dh.fileName))) {
|
||||
this.raiseError(`When asking for document highlights only in files ${searchFileNames}, got document highlights in ${unique(highlights, dh => dh.fileName)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public verifyReferencesOf(range: Range, references: Range[]) {
|
||||
this.goToRangeStart(range);
|
||||
this.verifyDocumentHighlightsRespectFilesList(unique(references, e => e.fileName));
|
||||
this.verifyReferencesAre(references);
|
||||
}
|
||||
|
||||
@@ -1094,7 +1106,7 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyReferenceGroups(starts: string | string[] | Range | Range[], parts: FourSlashInterface.ReferenceGroup[]): void {
|
||||
public verifyReferenceGroups(starts: string | string[] | Range | Range[], parts: FourSlashInterface.ReferenceGroup[] | undefined): void {
|
||||
interface ReferenceGroupJson {
|
||||
definition: string | { text: string, range: ts.TextSpan };
|
||||
references: ts.ReferenceEntry[];
|
||||
@@ -1128,6 +1140,10 @@ namespace FourSlash {
|
||||
};
|
||||
});
|
||||
this.assertObjectsEqual(fullActual, fullExpected);
|
||||
|
||||
if (parts) {
|
||||
this.verifyDocumentHighlightsRespectFilesList(unique(ts.flatMap(parts, p => p.ranges), r => r.fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,376 +95,245 @@ describe("PatternMatcher", () => {
|
||||
|
||||
describe("SingleWordPattern", () => {
|
||||
it("PreferCaseSensitiveExact", () => {
|
||||
const match = getFirstMatch("Foo", "Foo");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.exact, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("Foo", "Foo", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveExactInsensitive", () => {
|
||||
const match = getFirstMatch("foo", "Foo");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.exact, match.kind);
|
||||
assert.equal(false, match.isCaseSensitive);
|
||||
assertSegmentMatch("foo", "Foo", { kind: ts.PatternMatchKind.exact, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitivePrefix", () => {
|
||||
const match = getFirstMatch("Foo", "Fo");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.prefix, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("Foo", "Fo", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitivePrefixCaseInsensitive", () => {
|
||||
const match = getFirstMatch("Foo", "fo");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.prefix, match.kind);
|
||||
assert.equal(false, match.isCaseSensitive);
|
||||
assertSegmentMatch("Foo", "fo", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveCamelCaseMatchSimple", () => {
|
||||
const match = getFirstMatch("FogBar", "FB");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("FogBar", "FB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => {
|
||||
const match = getFirstMatch("FogBar", "FoB");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("FogBar", "FoB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveCamelCaseMatchToLongPattern1", () => {
|
||||
const match = getFirstMatch("FogBar", "FBB");
|
||||
|
||||
assert.isTrue(match === undefined);
|
||||
assertSegmentMatch("FogBar", "FBB", undefined);
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveCamelCaseMatchToLongPattern2", () => {
|
||||
const match = getFirstMatch("FogBar", "FoooB");
|
||||
|
||||
assert.isTrue(match === undefined);
|
||||
assertSegmentMatch("FogBar", "FoooB", undefined);
|
||||
});
|
||||
|
||||
it("CamelCaseMatchPartiallyUnmatched", () => {
|
||||
const match = getFirstMatch("FogBarBaz", "FZ");
|
||||
|
||||
assert.isTrue(match === undefined);
|
||||
assertSegmentMatch("FogBarBaz", "FZ", undefined);
|
||||
});
|
||||
|
||||
it("CamelCaseMatchCompletelyUnmatched", () => {
|
||||
const match = getFirstMatch("FogBarBaz", "ZZ");
|
||||
|
||||
assert.isTrue(match === undefined);
|
||||
assertSegmentMatch("FogBarBaz", "ZZ", undefined);
|
||||
});
|
||||
|
||||
it("TwoUppercaseCharacters", () => {
|
||||
const match = getFirstMatch("SimpleUIElement", "SiUI");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("SimpleUIElement", "SiUI", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveLowercasePattern", () => {
|
||||
const match = getFirstMatch("FogBar", "b");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.substring, match.kind);
|
||||
assert.equal(false, match.isCaseSensitive);
|
||||
assertSegmentMatch("FogBar", "b", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveLowercasePattern2", () => {
|
||||
const match = getFirstMatch("FogBar", "fB");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(false, match.isCaseSensitive);
|
||||
assertSegmentMatch("FogBar", "fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveTryUnderscoredName", () => {
|
||||
const match = getFirstMatch("_fogBar", "_fB");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("_fogBar", "_fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveTryUnderscoredName2", () => {
|
||||
const match = getFirstMatch("_fogBar", "fB");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("_fogBar", "fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => {
|
||||
const match = getFirstMatch("_FogBar", "_fB");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(false, match.isCaseSensitive);
|
||||
assertSegmentMatch("_FogBar", "_fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveMiddleUnderscore", () => {
|
||||
const match = getFirstMatch("Fog_Bar", "FB");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("Fog_Bar", "FB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveMiddleUnderscore2", () => {
|
||||
const match = getFirstMatch("Fog_Bar", "F_B");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertSegmentMatch("Fog_Bar", "F_B", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveMiddleUnderscore3", () => {
|
||||
const match = getFirstMatch("Fog_Bar", "F__B");
|
||||
|
||||
assert.isTrue(undefined === match);
|
||||
assertSegmentMatch("Fog_Bar", "F__B", undefined);
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveMiddleUnderscore4", () => {
|
||||
const match = getFirstMatch("Fog_Bar", "f_B");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(false, match.isCaseSensitive);
|
||||
assertSegmentMatch("Fog_Bar", "f_B", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("PreferCaseSensitiveMiddleUnderscore5", () => {
|
||||
const match = getFirstMatch("Fog_Bar", "F_b");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.camelCase, match.kind);
|
||||
assert.equal(false, match.isCaseSensitive);
|
||||
assertSegmentMatch("Fog_Bar", "F_b", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("AllLowerPattern1", () => {
|
||||
const match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs");
|
||||
|
||||
assert.isTrue(undefined !== match);
|
||||
assertSegmentMatch("FogBarChangedEventArgs", "changedeventargs", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("AllLowerPattern2", () => {
|
||||
const match = getFirstMatch("FogBarChangedEventArgs", "changedeventarrrgh");
|
||||
|
||||
assert.isTrue(undefined === match);
|
||||
assertSegmentMatch("FogBarChangedEventArgs", "changedeventarrrgh", undefined);
|
||||
});
|
||||
|
||||
it("AllLowerPattern3", () => {
|
||||
const match = getFirstMatch("ABCDEFGH", "bcd");
|
||||
|
||||
assert.isTrue(undefined !== match);
|
||||
assertSegmentMatch("ABCDEFGH", "bcd", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("AllLowerPattern4", () => {
|
||||
const match = getFirstMatch("AbcdefghijEfgHij", "efghij");
|
||||
|
||||
assert.isTrue(undefined === match);
|
||||
assertSegmentMatch("AbcdefghijEfgHij", "efghij", undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe("MultiWordPattern", () => {
|
||||
it("ExactWithLowercase", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "addmetadatareference");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.exact, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "addmetadatareference", { kind: ts.PatternMatchKind.exact, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("SingleLowercasedSearchWord1", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "add");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "add", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("SingleLowercasedSearchWord2", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "metadata");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("SingleUppercaseSearchWord1", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "Add");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "Add", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("SingleUppercaseSearchWord2", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "Metadata");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "Metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("SingleUppercaseSearchLetter1", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "A");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "A", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("SingleUppercaseSearchLetter2", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "M");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "M", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("TwoLowercaseWords", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "add metadata");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
it("TwoLowercaseWords0", () => {
|
||||
assertSegmentMatch("AddMetadataReference", "add metadata", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("TwoLowercaseWords", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "A M");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
it("TwoLowercaseWords1", () => {
|
||||
assertSegmentMatch("AddMetadataReference", "A M", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("TwoLowercaseWords", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "AM");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.camelCase, matches);
|
||||
it("TwoLowercaseWords2", () => {
|
||||
assertSegmentMatch("AddMetadataReference", "AM", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("TwoLowercaseWords", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "ref Metadata");
|
||||
|
||||
assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]);
|
||||
it("TwoLowercaseWords3", () => {
|
||||
assertSegmentMatch("AddMetadataReference", "ref Metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("TwoLowercaseWords", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "ref M");
|
||||
|
||||
assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]);
|
||||
it("TwoLowercaseWords4", () => {
|
||||
assertSegmentMatch("AddMetadataReference", "ref M", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("MixedCamelCase", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "AMRe");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.camelCase, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "AMRe", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("BlankPattern", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "");
|
||||
|
||||
assert.isTrue(matches === undefined);
|
||||
assertInvalidPattern("");
|
||||
});
|
||||
|
||||
it("WhitespaceOnlyPattern", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", " ");
|
||||
|
||||
assert.isTrue(matches === undefined);
|
||||
assertInvalidPattern(" ");
|
||||
});
|
||||
|
||||
it("EachWordSeparately1", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "add Meta");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "add Meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
|
||||
});
|
||||
|
||||
it("EachWordSeparately2", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "Add meta");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "Add meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("EachWordSeparately3", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "Add Meta");
|
||||
|
||||
assertContainsKind(ts.PatternMatchKind.prefix, matches);
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
assertSegmentMatch("AddMetadataReference", "Add Meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("MixedCasing", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "mEta");
|
||||
|
||||
assert.isTrue(matches === undefined);
|
||||
assertSegmentMatch("AddMetadataReference", "mEta", undefined);
|
||||
});
|
||||
|
||||
it("MixedCasing2", () => {
|
||||
const matches = getAllMatches("AddMetadataReference", "Data");
|
||||
|
||||
assert.isTrue(matches === undefined);
|
||||
assertSegmentMatch("AddMetadataReference", "Data", undefined);
|
||||
});
|
||||
|
||||
it("AsteriskSplit", () => {
|
||||
const matches = getAllMatches("GetKeyWord", "K*W");
|
||||
|
||||
assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]);
|
||||
assertSegmentMatch("GetKeyWord", "K*W", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("LowercaseSubstring1", () => {
|
||||
const matches = getAllMatches("Operator", "a");
|
||||
|
||||
assert.isTrue(matches === undefined);
|
||||
assertSegmentMatch("Operator", "a", undefined);
|
||||
});
|
||||
|
||||
it("LowercaseSubstring2", () => {
|
||||
const matches = getAllMatches("FooAttribute", "a");
|
||||
assertContainsKind(ts.PatternMatchKind.substring, matches);
|
||||
assert.isFalse(matches[0].isCaseSensitive);
|
||||
assertSegmentMatch("FooAttribute", "a", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
|
||||
});
|
||||
});
|
||||
|
||||
describe("DottedPattern", () => {
|
||||
it("DottedPattern1", () => {
|
||||
const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q");
|
||||
|
||||
assert.equal(ts.PatternMatchKind.prefix, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertFullMatch("Foo.Bar.Baz", "Quux", "B.Q", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("DottedPattern2", () => {
|
||||
const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "C.Q");
|
||||
assert.isTrue(match === undefined);
|
||||
assertFullMatch("Foo.Bar.Baz", "Quux", "C.Q", undefined);
|
||||
});
|
||||
|
||||
it("DottedPattern3", () => {
|
||||
const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q");
|
||||
assert.equal(ts.PatternMatchKind.prefix, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertFullMatch("Foo.Bar.Baz", "Quux", "B.B.Q", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("DottedPattern4", () => {
|
||||
const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux");
|
||||
assert.equal(ts.PatternMatchKind.exact, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertFullMatch("Foo.Bar.Baz", "Quux", "Baz.Quux", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("DottedPattern5", () => {
|
||||
const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux");
|
||||
assert.equal(ts.PatternMatchKind.exact, match.kind);
|
||||
assert.equal(true, match.isCaseSensitive);
|
||||
assertFullMatch("Foo.Bar.Baz", "Quux", "F.B.B.Quux", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
|
||||
});
|
||||
|
||||
it("DottedPattern6", () => {
|
||||
const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux");
|
||||
assert.isTrue(match === undefined);
|
||||
assertFullMatch("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux", undefined);
|
||||
});
|
||||
|
||||
it("DottedPattern7", () => {
|
||||
let match = getFirstMatch("UIElement", "UIElement");
|
||||
match = getFirstMatch("GetKeyword", "UIElement");
|
||||
assert.isTrue(match === undefined);
|
||||
assertSegmentMatch("UIElement", "UIElement", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true });
|
||||
assertSegmentMatch("GetKeyword", "UIElement", undefined);
|
||||
});
|
||||
});
|
||||
|
||||
function getFirstMatch(candidate: string, pattern: string): ts.PatternMatch {
|
||||
const matches = ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate);
|
||||
return matches ? matches[0] : undefined;
|
||||
function assertSegmentMatch(candidate: string, pattern: string, expected: ts.PatternMatch | undefined): void {
|
||||
assert.deepEqual(ts.createPatternMatcher(pattern).getMatchForLastSegmentOfPattern(candidate), expected);
|
||||
}
|
||||
|
||||
function getAllMatches(candidate: string, pattern: string): ts.PatternMatch[] {
|
||||
return ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate);
|
||||
function assertInvalidPattern(pattern: string) {
|
||||
assert.equal(ts.createPatternMatcher(pattern), undefined);
|
||||
}
|
||||
|
||||
function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch {
|
||||
const matches = ts.createPatternMatcher(pattern).getMatches(dottedContainer.split("."), candidate);
|
||||
return matches ? matches[0] : undefined;
|
||||
function assertFullMatch(dottedContainer: string, candidate: string, pattern: string, expected: ts.PatternMatch | undefined): void {
|
||||
assert.deepEqual(ts.createPatternMatcher(pattern).getFullMatch(dottedContainer.split("."), candidate), expected);
|
||||
}
|
||||
|
||||
function spanListToSubstrings(identifier: string, spans: ts.TextSpan[]) {
|
||||
return ts.map(spans, s => identifier.substr(s.start, s.length));
|
||||
return spans.map(s => identifier.substr(s.start, s.length));
|
||||
}
|
||||
|
||||
function breakIntoCharacterSpans(identifier: string) {
|
||||
@@ -474,23 +343,12 @@ describe("PatternMatcher", () => {
|
||||
function breakIntoWordSpans(identifier: string) {
|
||||
return spanListToSubstrings(identifier, ts.breakIntoWordSpans(identifier));
|
||||
}
|
||||
function assertArrayEquals<T>(array1: T[], array2: T[]) {
|
||||
assert.equal(array1.length, array2.length);
|
||||
|
||||
for (let i = 0; i < array1.length; i++) {
|
||||
assert.equal(array1[i], array2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function verifyBreakIntoCharacterSpans(original: string, ...parts: string[]): void {
|
||||
assertArrayEquals(parts, breakIntoCharacterSpans(original));
|
||||
assert.deepEqual(parts, breakIntoCharacterSpans(original));
|
||||
}
|
||||
|
||||
function verifyBreakIntoWordSpans(original: string, ...parts: string[]): void {
|
||||
assertArrayEquals(parts, breakIntoWordSpans(original));
|
||||
}
|
||||
|
||||
function assertContainsKind(kind: ts.PatternMatchKind, results: ts.PatternMatch[]) {
|
||||
assert.isTrue(ts.forEach(results, r => r.kind === kind));
|
||||
assert.deepEqual(parts, breakIntoWordSpans(original));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4184,6 +4184,57 @@ namespace ts.projectSystem {
|
||||
session.clearMessages();
|
||||
});
|
||||
|
||||
it("disable suggestion diagnostics", () => {
|
||||
const file: FileOrFolder = {
|
||||
path: "/a.js",
|
||||
content: 'require("b")',
|
||||
};
|
||||
|
||||
const host = createServerHost([file]);
|
||||
const session = createSession(host, { canUseEvents: true });
|
||||
const service = session.getProjectService();
|
||||
|
||||
session.executeCommandSeq<protocol.OpenRequest>({
|
||||
command: server.CommandNames.Open,
|
||||
arguments: { file: file.path, fileContent: file.content },
|
||||
});
|
||||
|
||||
session.executeCommandSeq<protocol.ConfigureRequest>({
|
||||
command: server.CommandNames.Configure,
|
||||
arguments: {
|
||||
preferences: { disableSuggestions: true }
|
||||
},
|
||||
});
|
||||
|
||||
checkNumberOfProjects(service, { inferredProjects: 1 });
|
||||
session.clearMessages();
|
||||
const expectedSequenceId = session.getNextSeq();
|
||||
host.checkTimeoutQueueLengthAndRun(2);
|
||||
|
||||
checkProjectUpdatedInBackgroundEvent(session, [file.path]);
|
||||
session.clearMessages();
|
||||
|
||||
session.executeCommandSeq<protocol.GeterrRequest>({
|
||||
command: server.CommandNames.Geterr,
|
||||
arguments: {
|
||||
delay: 0,
|
||||
files: [file.path],
|
||||
}
|
||||
});
|
||||
|
||||
host.checkTimeoutQueueLengthAndRun(1);
|
||||
|
||||
checkErrorMessage(session, "syntaxDiag", { file: file.path, diagnostics: [] }, /*isMostRecent*/ true);
|
||||
session.clearMessages();
|
||||
|
||||
host.runQueuedImmediateCallbacks(1);
|
||||
|
||||
checkErrorMessage(session, "semanticDiag", { file: file.path, diagnostics: [] });
|
||||
// No suggestion event, we're done.
|
||||
checkCompleteEvent(session, 2, expectedSequenceId);
|
||||
session.clearMessages();
|
||||
});
|
||||
|
||||
it("suppressed diagnostic events", () => {
|
||||
const file: FileOrFolder = {
|
||||
path: "/a.ts",
|
||||
|
||||
@@ -3780,6 +3780,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Našel se tento počet chyb: {0}.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Našla se 1 chyba.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5997,6 +6015,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -3768,6 +3768,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} Fehler gefunden.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1 Fehler gefunden.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5982,6 +6000,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -3780,6 +3780,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Se encontró {0} errores.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Se encontró 1 error.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5997,6 +6015,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -3780,6 +3780,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} erreurs trouvées.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1 erreur trouvée.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5997,6 +6015,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -3771,6 +3771,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} 件のエラーが見つかりました。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1 件のエラーが見つかりました。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5988,6 +6006,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -3771,6 +3771,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0}개 오류가 발견되었습니다.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1개 오류가 발견되었습니다.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5988,6 +6006,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -3761,6 +3761,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Encontrados {0} erros.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Encontrado 1 erro.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5975,6 +5993,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -3770,6 +3770,24 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Найдено ошибок: {0}.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Найдено ошибок: 1.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
|
||||
@@ -5987,6 +6005,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?]]></Val>
|
||||
|
||||
@@ -1834,11 +1834,11 @@ namespace ts.server {
|
||||
this.logger.info(`Host information ${args.hostInfo}`);
|
||||
}
|
||||
if (args.formatOptions) {
|
||||
mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions));
|
||||
this.hostConfiguration.formatCodeOptions = { ...this.hostConfiguration.formatCodeOptions, ...convertFormatOptions(args.formatOptions) };
|
||||
this.logger.info("Format host information updated");
|
||||
}
|
||||
if (args.preferences) {
|
||||
mergeMapLikes(this.hostConfiguration.preferences, args.preferences);
|
||||
this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
|
||||
}
|
||||
if (args.extraFileExtensions) {
|
||||
this.hostConfiguration.extraFileExtensions = args.extraFileExtensions;
|
||||
|
||||
@@ -2640,6 +2640,7 @@ namespace ts.server.protocol {
|
||||
}
|
||||
|
||||
export interface UserPreferences {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "double" | "single";
|
||||
/**
|
||||
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
|
||||
|
||||
@@ -395,15 +395,18 @@ namespace ts.server {
|
||||
if (formatSettings) {
|
||||
if (!this.formatSettings) {
|
||||
this.formatSettings = getDefaultFormatCodeSettings(this.host);
|
||||
assign(this.formatSettings, formatSettings);
|
||||
}
|
||||
else {
|
||||
this.formatSettings = { ...this.formatSettings, ...formatSettings };
|
||||
}
|
||||
mergeMapLikes(this.formatSettings, formatSettings);
|
||||
}
|
||||
|
||||
if (preferences) {
|
||||
if (!this.preferences) {
|
||||
this.preferences = clone(defaultPreferences);
|
||||
this.preferences = defaultPreferences;
|
||||
}
|
||||
mergeMapLikes(this.preferences, preferences);
|
||||
this.preferences = { ...this.preferences, ...preferences };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-3
@@ -523,12 +523,20 @@ namespace ts.server {
|
||||
return;
|
||||
}
|
||||
|
||||
next.immediate(() => {
|
||||
this.suggestionCheck(fileName, project);
|
||||
const goNext = () => {
|
||||
if (checkList.length > index) {
|
||||
next.delay(followMs, checkOne);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (this.getPreferences(fileName).disableSuggestions) {
|
||||
goNext();
|
||||
}
|
||||
else {
|
||||
next.immediate(() => {
|
||||
this.suggestionCheck(fileName, project);
|
||||
goNext();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -80,14 +80,6 @@ namespace ts.server {
|
||||
};
|
||||
}
|
||||
|
||||
export function mergeMapLikes<T extends object>(target: T, source: Partial<T>): void {
|
||||
for (const key in source) {
|
||||
if (hasProperty(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type NormalizedPath = string & { __normalizedPathTag: any };
|
||||
|
||||
export function toNormalizedPath(fileName: string): NormalizedPath {
|
||||
|
||||
@@ -22,10 +22,20 @@ namespace ts.DocumentHighlights {
|
||||
}
|
||||
|
||||
function getSemanticDocumentHighlights(position: number, node: Node, program: Program, cancellationToken: CancellationToken, sourceFilesToSearch: ReadonlyArray<SourceFile>): DocumentHighlights[] | undefined {
|
||||
const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken);
|
||||
const sourceFilesSet = arrayToSet(sourceFilesToSearch, f => f.fileName);
|
||||
const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken, /*options*/ undefined, sourceFilesSet);
|
||||
if (!referenceEntries) return undefined;
|
||||
const map = arrayToMultiMap(referenceEntries.map(FindAllReferences.toHighlightSpan), e => e.fileName, e => e.span);
|
||||
return arrayFrom(map.entries(), ([fileName, highlightSpans]) => ({ fileName, highlightSpans }));
|
||||
return arrayFrom(map.entries(), ([fileName, highlightSpans]) => {
|
||||
if (!sourceFilesSet.has(fileName)) {
|
||||
Debug.assert(program.redirectTargetsSet.has(fileName));
|
||||
const redirectTarget = program.getSourceFile(fileName);
|
||||
const redirect = find(sourceFilesToSearch, f => f.redirectInfo && f.redirectInfo.redirectTarget === redirectTarget)!;
|
||||
fileName = redirect.fileName;
|
||||
Debug.assert(sourceFilesSet.has(fileName));
|
||||
}
|
||||
return { fileName, highlightSpans };
|
||||
});
|
||||
}
|
||||
|
||||
function getSyntacticDocumentHighlights(node: Node, sourceFile: SourceFile): DocumentHighlights[] {
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace ts.FindAllReferences {
|
||||
|
||||
export function findReferencedSymbols(program: Program, cancellationToken: CancellationToken, sourceFiles: ReadonlyArray<SourceFile>, sourceFile: SourceFile, position: number): ReferencedSymbol[] | undefined {
|
||||
const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, /*options*/ {});
|
||||
const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken);
|
||||
const checker = program.getTypeChecker();
|
||||
return !referencedSymbols || !referencedSymbols.length ? undefined : mapDefined<SymbolAndEntries, ReferencedSymbol>(referencedSymbols, ({ definition, references }) =>
|
||||
// Only include referenced symbols that have a valid definition.
|
||||
@@ -86,8 +86,8 @@ namespace ts.FindAllReferences {
|
||||
return map(flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options)), toReferenceEntry);
|
||||
}
|
||||
|
||||
export function getReferenceEntriesForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray<SourceFile>, cancellationToken: CancellationToken, options: Options = {}): Entry[] | undefined {
|
||||
return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options));
|
||||
export function getReferenceEntriesForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray<SourceFile>, cancellationToken: CancellationToken, options: Options = {}, sourceFilesSet: ReadonlyMap<true> = arrayToSet(sourceFiles, f => f.fileName)): Entry[] | undefined {
|
||||
return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet));
|
||||
}
|
||||
|
||||
function flattenEntries(referenceSymbols: SymbolAndEntries[]): Entry[] {
|
||||
@@ -229,10 +229,10 @@ namespace ts.FindAllReferences {
|
||||
/* @internal */
|
||||
namespace ts.FindAllReferences.Core {
|
||||
/** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */
|
||||
export function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray<SourceFile>, cancellationToken: CancellationToken, options: Options = {}): SymbolAndEntries[] | undefined {
|
||||
export function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray<SourceFile>, cancellationToken: CancellationToken, options: Options = {}, sourceFilesSet: ReadonlyMap<true> = arrayToSet(sourceFiles, f => f.fileName)): SymbolAndEntries[] | undefined {
|
||||
if (isSourceFile(node)) {
|
||||
const reference = GoToDefinition.getReferenceAtPosition(node, position, program);
|
||||
return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), sourceFiles);
|
||||
return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), sourceFiles, sourceFilesSet);
|
||||
}
|
||||
|
||||
if (!options.implementations) {
|
||||
@@ -252,10 +252,10 @@ namespace ts.FindAllReferences.Core {
|
||||
}
|
||||
|
||||
if (symbol.flags & SymbolFlags.Module && isModuleReferenceLocation(node)) {
|
||||
return getReferencedSymbolsForModule(program, symbol, sourceFiles);
|
||||
return getReferencedSymbolsForModule(program, symbol, sourceFiles, sourceFilesSet);
|
||||
}
|
||||
|
||||
return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options);
|
||||
return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options);
|
||||
}
|
||||
|
||||
function isModuleReferenceLocation(node: Node): boolean {
|
||||
@@ -275,7 +275,7 @@ namespace ts.FindAllReferences.Core {
|
||||
}
|
||||
}
|
||||
|
||||
function getReferencedSymbolsForModule(program: Program, symbol: Symbol, sourceFiles: ReadonlyArray<SourceFile>): SymbolAndEntries[] {
|
||||
function getReferencedSymbolsForModule(program: Program, symbol: Symbol, sourceFiles: ReadonlyArray<SourceFile>, sourceFilesSet: ReadonlyMap<true>): SymbolAndEntries[] {
|
||||
Debug.assert(!!symbol.valueDeclaration);
|
||||
|
||||
const references = findModuleReferences(program, sourceFiles, symbol).map<Entry>(reference => {
|
||||
@@ -297,7 +297,9 @@ namespace ts.FindAllReferences.Core {
|
||||
// Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.)
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
references.push({ type: "node", node: (decl as ModuleDeclaration).name });
|
||||
if (sourceFilesSet.has(decl.getSourceFile().fileName)) {
|
||||
references.push({ type: "node", node: (decl as ModuleDeclaration).name });
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Debug.fail("Expected a module symbol to be declared by a SourceFile or ModuleDeclaration.");
|
||||
@@ -337,14 +339,14 @@ namespace ts.FindAllReferences.Core {
|
||||
}
|
||||
|
||||
/** Core find-all-references algorithm for a normal symbol. */
|
||||
function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node, sourceFiles: ReadonlyArray<SourceFile>, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] {
|
||||
function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node, sourceFiles: ReadonlyArray<SourceFile>, sourceFilesSet: ReadonlyMap<true>, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] {
|
||||
symbol = skipPastExportOrImportSpecifierOrUnion(symbol, node, checker) || symbol;
|
||||
|
||||
// Compute the meaning from the location and the symbol it references
|
||||
const searchMeaning = getIntersectingMeaningFromDeclarations(node, symbol);
|
||||
|
||||
const result: SymbolAndEntries[] = [];
|
||||
const state = new State(sourceFiles, getSpecialSearchKind(node), checker, cancellationToken, searchMeaning, options, result);
|
||||
const state = new State(sourceFiles, sourceFilesSet, getSpecialSearchKind(node), checker, cancellationToken, searchMeaning, options, result);
|
||||
|
||||
if (node.kind === SyntaxKind.DefaultKeyword) {
|
||||
addReference(node, symbol, state);
|
||||
@@ -467,10 +469,9 @@ namespace ts.FindAllReferences.Core {
|
||||
*/
|
||||
readonly markSeenReExportRHS = nodeSeenTracker();
|
||||
|
||||
private readonly includedSourceFiles: Map<true>;
|
||||
|
||||
constructor(
|
||||
readonly sourceFiles: ReadonlyArray<SourceFile>,
|
||||
readonly sourceFilesSet: ReadonlyMap<true>,
|
||||
/** True if we're searching for constructor references. */
|
||||
readonly specialSearchKind: SpecialSearchKind,
|
||||
readonly checker: TypeChecker,
|
||||
@@ -478,17 +479,16 @@ namespace ts.FindAllReferences.Core {
|
||||
readonly searchMeaning: SemanticMeaning,
|
||||
readonly options: Options,
|
||||
private readonly result: Push<SymbolAndEntries>) {
|
||||
this.includedSourceFiles = arrayToSet(sourceFiles, s => s.fileName);
|
||||
}
|
||||
|
||||
includesSourceFile(sourceFile: SourceFile): boolean {
|
||||
return this.includedSourceFiles.has(sourceFile.fileName);
|
||||
return this.sourceFilesSet.has(sourceFile.fileName);
|
||||
}
|
||||
|
||||
private importTracker: ImportTracker | undefined;
|
||||
/** Gets every place to look for references of an exported symbols. See `ImportsResult` in `importTracker.ts` for more documentation. */
|
||||
getImportSearches(exportSymbol: Symbol, exportInfo: ExportInfo): ImportsResult {
|
||||
if (!this.importTracker) this.importTracker = createImportTracker(this.sourceFiles, this.checker, this.cancellationToken);
|
||||
if (!this.importTracker) this.importTracker = createImportTracker(this.sourceFiles, this.sourceFilesSet, this.checker, this.cancellationToken);
|
||||
return this.importTracker(exportSymbol, exportInfo, this.options.isForRename);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace ts.FindAllReferences {
|
||||
export type ImportTracker = (exportSymbol: Symbol, exportInfo: ExportInfo, isForRename: boolean) => ImportsResult;
|
||||
|
||||
/** Creates the imports map and returns an ImportTracker that uses it. Call this lazily to avoid calling `getDirectImportsMap` unnecessarily. */
|
||||
export function createImportTracker(sourceFiles: ReadonlyArray<SourceFile>, checker: TypeChecker, cancellationToken: CancellationToken): ImportTracker {
|
||||
export function createImportTracker(sourceFiles: ReadonlyArray<SourceFile>, sourceFilesSet: ReadonlyMap<true>, checker: TypeChecker, cancellationToken: CancellationToken): ImportTracker {
|
||||
const allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken);
|
||||
return (exportSymbol, exportInfo, isForRename) => {
|
||||
const { directImports, indirectUsers } = getImportersForExport(sourceFiles, allDirectImports, exportInfo, checker, cancellationToken);
|
||||
const { directImports, indirectUsers } = getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, exportInfo, checker, cancellationToken);
|
||||
return { indirectUsers, ...getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename) };
|
||||
};
|
||||
}
|
||||
@@ -39,6 +39,7 @@ namespace ts.FindAllReferences {
|
||||
/** Returns import statements that directly reference the exporting module, and a list of files that may access the module through a namespace. */
|
||||
function getImportersForExport(
|
||||
sourceFiles: ReadonlyArray<SourceFile>,
|
||||
sourceFilesSet: ReadonlyMap<true>,
|
||||
allDirectImports: Map<ImporterOrCallExpression[]>,
|
||||
{ exportingModuleSymbol, exportKind }: ExportInfo,
|
||||
checker: TypeChecker,
|
||||
@@ -62,7 +63,7 @@ namespace ts.FindAllReferences {
|
||||
|
||||
// Module augmentations may use this module's exports without importing it.
|
||||
for (const decl of exportingModuleSymbol.declarations) {
|
||||
if (isExternalModuleAugmentation(decl)) {
|
||||
if (isExternalModuleAugmentation(decl) && sourceFilesSet.has(decl.getSourceFile().fileName)) {
|
||||
addIndirectUser(decl);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-14
@@ -10,6 +10,7 @@ namespace ts.NavigateTo {
|
||||
|
||||
export function getNavigateToItems(sourceFiles: ReadonlyArray<SourceFile>, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[] {
|
||||
const patternMatcher = createPatternMatcher(searchValue);
|
||||
if (!patternMatcher) return emptyArray;
|
||||
let rawItems: RawNavigateToItem[] = [];
|
||||
|
||||
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
||||
@@ -35,28 +36,24 @@ namespace ts.NavigateTo {
|
||||
function getItemsFromNamedDeclaration(patternMatcher: PatternMatcher, name: string, declarations: ReadonlyArray<Declaration>, checker: TypeChecker, fileName: string, rawItems: Push<RawNavigateToItem>): void {
|
||||
// First do a quick check to see if the name of the declaration matches the
|
||||
// last portion of the (possibly) dotted name they're searching for.
|
||||
const matches = patternMatcher.getMatchesForLastSegmentOfPattern(name);
|
||||
|
||||
if (!matches) {
|
||||
const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
|
||||
if (!match) {
|
||||
return; // continue to next named declarations
|
||||
}
|
||||
|
||||
for (const declaration of declarations) {
|
||||
if (!shouldKeepItem(declaration, checker)) {
|
||||
continue;
|
||||
}
|
||||
if (!shouldKeepItem(declaration, checker)) continue;
|
||||
|
||||
// It was a match! If the pattern has dots in it, then also see if the
|
||||
// declaration container matches as well.
|
||||
let containerMatches = matches;
|
||||
if (patternMatcher.patternContainsDots) {
|
||||
containerMatches = patternMatcher.getMatches(getContainers(declaration), name);
|
||||
if (!containerMatches) {
|
||||
continue;
|
||||
const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name);
|
||||
if (fullMatch) {
|
||||
rawItems.push({ name, fileName, matchKind: fullMatch.kind, isCaseSensitive: fullMatch.isCaseSensitive, declaration });
|
||||
}
|
||||
}
|
||||
|
||||
rawItems.push({ name, fileName, matchKind: Math.min(...matches.map(m => m.kind)), isCaseSensitive: matches.every(m => m.isCaseSensitive), declaration });
|
||||
else {
|
||||
// If the pattern has dots in it, then also see if the declaration container matches as well.
|
||||
rawItems.push({ name, fileName, matchKind: match.kind, isCaseSensitive: match.isCaseSensitive, declaration });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ namespace ts {
|
||||
// this will return a successful match, having only tested "SK" against "SyntaxKind". At
|
||||
// that point a call can be made to 'getMatches("SyntaxKind", "ts.compiler")', with the
|
||||
// work to create 'ts.compiler' only being done once the first match succeeded.
|
||||
getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[];
|
||||
getMatchForLastSegmentOfPattern(candidate: string): PatternMatch | undefined;
|
||||
|
||||
// Fully checks a candidate, with an dotted container, against the search pattern.
|
||||
// The candidate must match the last part of the search pattern, and the dotted container
|
||||
// must match the preceding segments of the pattern.
|
||||
getMatches(candidateContainers: string[], candidate: string): PatternMatch[] | undefined;
|
||||
getFullMatch(candidateContainers: ReadonlyArray<string>, candidate: string): PatternMatch | undefined;
|
||||
|
||||
// Whether or not the pattern contained dots or not. Clients can use this to determine
|
||||
// If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient.
|
||||
@@ -97,31 +97,25 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
export function createPatternMatcher(pattern: string): PatternMatcher {
|
||||
export function createPatternMatcher(pattern: string): PatternMatcher | undefined {
|
||||
// We'll often see the same candidate string many times when searching (For example, when
|
||||
// we see the name of a module that is used everywhere, or the name of an overload). As
|
||||
// such, we cache the information we compute about the candidate for the life of this
|
||||
// pattern matcher so we don't have to compute it multiple times.
|
||||
const stringToWordSpans = createMap<TextSpan[]>();
|
||||
|
||||
pattern = pattern.trim();
|
||||
|
||||
const dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim()));
|
||||
const invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid);
|
||||
const dotSeparatedSegments = pattern.trim().split(".").map(p => createSegment(p.trim()));
|
||||
// A segment is considered invalid if we couldn't find any words in it.
|
||||
if (dotSeparatedSegments.some(segment => !segment.subWordTextChunks.length)) return undefined;
|
||||
|
||||
return {
|
||||
getMatches: (containers, candidate) => skipMatch(candidate) ? undefined : getMatches(containers, candidate, dotSeparatedSegments, stringToWordSpans),
|
||||
getMatchesForLastSegmentOfPattern: candidate => skipMatch(candidate) ? undefined : matchSegment(candidate, lastOrUndefined(dotSeparatedSegments), stringToWordSpans),
|
||||
getFullMatch: (containers, candidate) => getFullMatch(containers, candidate, dotSeparatedSegments, stringToWordSpans),
|
||||
getMatchForLastSegmentOfPattern: candidate => matchSegment(candidate, last(dotSeparatedSegments), stringToWordSpans),
|
||||
patternContainsDots: dotSeparatedSegments.length > 1
|
||||
};
|
||||
|
||||
// Quick checks so we can bail out when asked to match a candidate.
|
||||
function skipMatch(candidate: string) {
|
||||
return invalidPattern || !candidate;
|
||||
}
|
||||
}
|
||||
|
||||
function getMatches(candidateContainers: ReadonlyArray<string>, candidate: string, dotSeparatedSegments: ReadonlyArray<Segment>, stringToWordSpans: Map<TextSpan[]>): PatternMatch[] | undefined {
|
||||
function getFullMatch(candidateContainers: ReadonlyArray<string>, candidate: string, dotSeparatedSegments: ReadonlyArray<Segment>, stringToWordSpans: Map<TextSpan[]>): PatternMatch | undefined {
|
||||
// First, check that the last part of the dot separated pattern matches the name of the
|
||||
// candidate. If not, then there's no point in proceeding and doing the more
|
||||
// expensive work.
|
||||
@@ -140,29 +134,13 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// So far so good. Now break up the container for the candidate and check if all
|
||||
// the dotted parts match up correctly.
|
||||
const totalMatch = candidateMatch;
|
||||
|
||||
let bestMatch: PatternMatch | undefined;
|
||||
for (let i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1;
|
||||
i >= 0;
|
||||
i -= 1, j -= 1) {
|
||||
|
||||
const segment = dotSeparatedSegments[i];
|
||||
const containerName = candidateContainers[j];
|
||||
|
||||
const containerMatch = matchSegment(containerName, segment, stringToWordSpans);
|
||||
if (!containerMatch) {
|
||||
// This container didn't match the pattern piece. So there's no match at all.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
addRange(totalMatch, containerMatch);
|
||||
bestMatch = betterMatch(bestMatch, matchSegment(candidateContainers[j], dotSeparatedSegments[i], stringToWordSpans));
|
||||
}
|
||||
|
||||
// Success, this symbol's full name matched against the dotted name the user was asking
|
||||
// about.
|
||||
return totalMatch;
|
||||
return bestMatch;
|
||||
}
|
||||
|
||||
function getWordSpans(word: string, stringToWordSpans: Map<TextSpan[]>): TextSpan[] {
|
||||
@@ -225,7 +203,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function matchSegment(candidate: string, segment: Segment, stringToWordSpans: Map<TextSpan[]>): PatternMatch[] {
|
||||
function matchSegment(candidate: string, segment: Segment, stringToWordSpans: Map<TextSpan[]>): PatternMatch {
|
||||
// First check if the segment matches as is. This is also useful if the segment contains
|
||||
// characters we would normally strip when splitting into parts that we also may want to
|
||||
// match in the candidate. For example if the segment is "@int" and the candidate is
|
||||
@@ -235,9 +213,7 @@ namespace ts {
|
||||
// multi-word segment.
|
||||
if (every(segment.totalTextChunk.text, ch => ch !== CharacterCodes.space && ch !== CharacterCodes.asterisk)) {
|
||||
const match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans);
|
||||
if (match) {
|
||||
return [match];
|
||||
}
|
||||
if (match) return match;
|
||||
}
|
||||
|
||||
// The logic for pattern matching is now as follows:
|
||||
@@ -277,20 +253,19 @@ namespace ts {
|
||||
// Only if all words have some sort of match is the pattern considered matched.
|
||||
|
||||
const subWordTextChunks = segment.subWordTextChunks;
|
||||
let matches: PatternMatch[];
|
||||
|
||||
let bestMatch: PatternMatch | undefined;
|
||||
for (const subWordTextChunk of subWordTextChunks) {
|
||||
// Try to match the candidate with this word
|
||||
const result = matchTextChunk(candidate, subWordTextChunk, stringToWordSpans);
|
||||
if (!result) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
matches = matches || [];
|
||||
matches.push(result);
|
||||
bestMatch = betterMatch(bestMatch, matchTextChunk(candidate, subWordTextChunk, stringToWordSpans));
|
||||
}
|
||||
return bestMatch;
|
||||
}
|
||||
|
||||
return matches;
|
||||
function betterMatch(a: PatternMatch | undefined, b: PatternMatch | undefined): PatternMatch {
|
||||
return min(a, b, compareMatches);
|
||||
}
|
||||
function compareMatches(a: PatternMatch | undefined, b: PatternMatch | undefined): Comparison {
|
||||
return a === undefined ? Comparison.GreaterThan : b === undefined ? Comparison.LessThan
|
||||
: compareValues(a.kind, b.kind) || compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive);
|
||||
}
|
||||
|
||||
function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan: TextSpan = { start: 0, length: pattern.length }): boolean {
|
||||
@@ -381,11 +356,6 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
// A segment is considered invalid if we couldn't find any words in it.
|
||||
function segmentIsInvalid(segment: Segment) {
|
||||
return segment.subWordTextChunks.length === 0;
|
||||
}
|
||||
|
||||
function isUpperCaseLetter(ch: number) {
|
||||
// Fast check for the ascii range.
|
||||
if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) {
|
||||
|
||||
@@ -698,14 +698,6 @@ namespace ts.refactor.extractSymbol {
|
||||
Global,
|
||||
}
|
||||
|
||||
function getUniqueName(baseName: string, fileText: string): string {
|
||||
let nameText = baseName;
|
||||
for (let i = 1; stringContains(fileText, nameText); i++) {
|
||||
nameText = `${baseName}_${i}`;
|
||||
}
|
||||
return nameText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Result of 'extractRange' operation for a specific scope.
|
||||
* Stores either a list of changes that should be applied to extract a range or a list of errors
|
||||
@@ -1126,37 +1118,6 @@ namespace ts.refactor.extractSymbol {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The index of the (only) reference to the extracted symbol. We want the cursor
|
||||
* to be on the reference, rather than the declaration, because it's closer to where the
|
||||
* user was before extracting it.
|
||||
*/
|
||||
function getRenameLocation(edits: ReadonlyArray<FileTextChanges>, renameFilename: string, functionNameText: string, isDeclaredBeforeUse: boolean): number {
|
||||
let delta = 0;
|
||||
let lastPos = -1;
|
||||
for (const { fileName, textChanges } of edits) {
|
||||
Debug.assert(fileName === renameFilename);
|
||||
for (const change of textChanges) {
|
||||
const { span, newText } = change;
|
||||
const index = newText.indexOf(functionNameText);
|
||||
if (index !== -1) {
|
||||
lastPos = span.start + delta + index;
|
||||
|
||||
// If the reference comes first, return immediately.
|
||||
if (!isDeclaredBeforeUse) {
|
||||
return lastPos;
|
||||
}
|
||||
}
|
||||
delta += newText.length - span.length;
|
||||
}
|
||||
}
|
||||
|
||||
// If the declaration comes first, return the position of the last occurrence.
|
||||
Debug.assert(isDeclaredBeforeUse);
|
||||
Debug.assert(lastPos >= 0);
|
||||
return lastPos;
|
||||
}
|
||||
|
||||
function getFirstDeclaration(type: Type): Declaration | undefined {
|
||||
let firstDeclaration;
|
||||
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
/* @internal */
|
||||
namespace ts.refactor.generateGetAccessorAndSetAccessor {
|
||||
const actionName = "Generate 'get' and 'set' accessors";
|
||||
const actionDescription = Diagnostics.Generate_get_and_set_accessors.message;
|
||||
registerRefactor(actionName, { getEditsForAction, getAvailableActions });
|
||||
|
||||
type AcceptedDeclaration = ParameterDeclaration | PropertyDeclaration | PropertyAssignment;
|
||||
type AcceptedNameType = Identifier | StringLiteral;
|
||||
type ContainerDeclaration = ClassLikeDeclaration | ObjectLiteralExpression;
|
||||
|
||||
interface DeclarationInfo {
|
||||
container: ContainerDeclaration;
|
||||
isStatic: boolean;
|
||||
type: TypeNode | undefined;
|
||||
}
|
||||
|
||||
interface Info extends DeclarationInfo {
|
||||
declaration: AcceptedDeclaration;
|
||||
fieldName: AcceptedNameType;
|
||||
accessorName: AcceptedNameType;
|
||||
}
|
||||
|
||||
function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined {
|
||||
const { file, startPosition } = context;
|
||||
if (!getConvertibleFieldAtPosition(file, startPosition)) return undefined;
|
||||
|
||||
return [{
|
||||
name: actionName,
|
||||
description: actionDescription,
|
||||
actions: [
|
||||
{
|
||||
name: actionName,
|
||||
description: actionDescription
|
||||
}
|
||||
]
|
||||
}];
|
||||
}
|
||||
|
||||
function getEditsForAction(context: RefactorContext, _actionName: string): RefactorEditInfo | undefined {
|
||||
const { file, startPosition } = context;
|
||||
|
||||
const fieldInfo = getConvertibleFieldAtPosition(file, startPosition);
|
||||
if (!fieldInfo) return undefined;
|
||||
|
||||
const isJS = isSourceFileJavaScript(file);
|
||||
const changeTracker = textChanges.ChangeTracker.fromContext(context);
|
||||
const { isStatic, fieldName, accessorName, type, container, declaration } = fieldInfo;
|
||||
|
||||
const isInClassLike = isClassLike(container);
|
||||
const accessorModifiers = getAccessorModifiers(isJS, declaration, isStatic, isInClassLike);
|
||||
const fieldModifiers = getFieldModifiers(isJS, isStatic, isInClassLike);
|
||||
|
||||
updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers, container);
|
||||
|
||||
const getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
|
||||
const setAccessor = generateSetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
|
||||
|
||||
insertAccessor(changeTracker, file, getAccessor, declaration, container);
|
||||
insertAccessor(changeTracker, file, setAccessor, declaration, container);
|
||||
|
||||
const edits = changeTracker.getChanges();
|
||||
const renameFilename = file.fileName;
|
||||
const renameLocationOffset = isIdentifier(fieldName) ? 0 : -1;
|
||||
const renameLocation = renameLocationOffset + getRenameLocation(edits, renameFilename, fieldName.text, /*isDeclaredBeforeUse*/ false);
|
||||
return { renameFilename, renameLocation, edits };
|
||||
}
|
||||
|
||||
function isConvertableName (name: DeclarationName): name is AcceptedNameType {
|
||||
return isIdentifier(name) || isStringLiteral(name);
|
||||
}
|
||||
|
||||
function isAcceptedDeclaration(node: Node): node is AcceptedDeclaration {
|
||||
return isParameterPropertyDeclaration(node) || isPropertyDeclaration(node) || isPropertyAssignment(node);
|
||||
}
|
||||
|
||||
function createPropertyName (name: string, originalName: AcceptedNameType) {
|
||||
return isIdentifier(originalName) ? createIdentifier(name) : createLiteral(name);
|
||||
}
|
||||
|
||||
function createAccessorAccessExpression (fieldName: AcceptedNameType, isStatic: boolean, container: ContainerDeclaration) {
|
||||
const leftHead = isStatic ? (<ClassLikeDeclaration>container).name : createThis();
|
||||
return isIdentifier(fieldName) ? createPropertyAccess(leftHead, fieldName) : createElementAccess(leftHead, createLiteral(fieldName));
|
||||
}
|
||||
|
||||
function getAccessorModifiers(isJS: boolean, declaration: AcceptedDeclaration, isStatic: boolean, isClassLike: boolean): NodeArray<Modifier> | undefined {
|
||||
if (!isClassLike) return undefined;
|
||||
|
||||
if (!declaration.modifiers || getModifierFlags(declaration) & ModifierFlags.Private) {
|
||||
const modifiers = append<Modifier>(
|
||||
!isJS ? [createToken(SyntaxKind.PublicKeyword)] : undefined,
|
||||
isStatic ? createToken(SyntaxKind.StaticKeyword) : undefined
|
||||
);
|
||||
return modifiers && createNodeArray(modifiers);
|
||||
}
|
||||
return declaration.modifiers;
|
||||
}
|
||||
|
||||
function getFieldModifiers(isJS: boolean, isStatic: boolean, isClassLike: boolean): NodeArray<Modifier> | undefined {
|
||||
if (!isClassLike) return undefined;
|
||||
|
||||
const modifiers = append<Modifier>(
|
||||
!isJS ? [createToken(SyntaxKind.PrivateKeyword)] : undefined,
|
||||
isStatic ? createToken(SyntaxKind.StaticKeyword) : undefined
|
||||
);
|
||||
return modifiers && createNodeArray(modifiers);
|
||||
}
|
||||
|
||||
function getPropertyDeclarationInfo(propertyDeclaration: PropertyDeclaration): DeclarationInfo | undefined {
|
||||
if (!isClassLike(propertyDeclaration.parent) || !propertyDeclaration.parent.members) return undefined;
|
||||
|
||||
return {
|
||||
isStatic: hasStaticModifier(propertyDeclaration),
|
||||
type: propertyDeclaration.type,
|
||||
container: propertyDeclaration.parent
|
||||
};
|
||||
}
|
||||
|
||||
function getParameterPropertyDeclarationInfo(parameterDeclaration: ParameterDeclaration): DeclarationInfo | undefined {
|
||||
if (!isClassLike(parameterDeclaration.parent.parent) || !parameterDeclaration.parent.parent.members) return undefined;
|
||||
|
||||
return {
|
||||
isStatic: false,
|
||||
type: parameterDeclaration.type,
|
||||
container: parameterDeclaration.parent.parent
|
||||
};
|
||||
}
|
||||
|
||||
function getPropertyAssignmentDeclarationInfo(propertyAssignment: PropertyAssignment): DeclarationInfo | undefined {
|
||||
return {
|
||||
isStatic: false,
|
||||
type: undefined,
|
||||
container: propertyAssignment.parent
|
||||
};
|
||||
}
|
||||
|
||||
function getDeclarationInfo(declaration: AcceptedDeclaration) {
|
||||
if (isPropertyDeclaration(declaration)) {
|
||||
return getPropertyDeclarationInfo(declaration);
|
||||
}
|
||||
else if (isPropertyAssignment(declaration)) {
|
||||
return getPropertyAssignmentDeclarationInfo(declaration);
|
||||
}
|
||||
else {
|
||||
return getParameterPropertyDeclarationInfo(declaration);
|
||||
}
|
||||
}
|
||||
|
||||
function getConvertibleFieldAtPosition(file: SourceFile, startPosition: number): Info | undefined {
|
||||
const node = getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false);
|
||||
const declaration = findAncestor(node.parent, isAcceptedDeclaration);
|
||||
// make sure propertyDeclaration have AccessibilityModifier or Static Modifier
|
||||
const meaning = ModifierFlags.AccessibilityModifier | ModifierFlags.Static;
|
||||
if (!declaration || !isConvertableName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined;
|
||||
|
||||
const info = getDeclarationInfo(declaration);
|
||||
const fieldName = createPropertyName(getUniqueName(`_${declaration.name.text}`, file.text), declaration.name);
|
||||
suppressLeadingAndTrailingTrivia(fieldName);
|
||||
suppressLeadingAndTrailingTrivia(declaration);
|
||||
return {
|
||||
...info,
|
||||
declaration,
|
||||
fieldName,
|
||||
accessorName: createPropertyName(declaration.name.text, declaration.name)
|
||||
};
|
||||
}
|
||||
|
||||
function generateGetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode, modifiers: ModifiersArray | undefined, isStatic: boolean, container: ContainerDeclaration) {
|
||||
return createGetAccessor(
|
||||
/*decorators*/ undefined,
|
||||
modifiers,
|
||||
accessorName,
|
||||
/*parameters*/ undefined,
|
||||
type,
|
||||
createBlock([
|
||||
createReturn(
|
||||
createAccessorAccessExpression(fieldName, isStatic, container)
|
||||
)
|
||||
], /*multiLine*/ true)
|
||||
);
|
||||
}
|
||||
|
||||
function generateSetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode, modifiers: ModifiersArray | undefined, isStatic: boolean, container: ContainerDeclaration) {
|
||||
return createSetAccessor(
|
||||
/*decorators*/ undefined,
|
||||
modifiers,
|
||||
accessorName,
|
||||
[createParameter(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined,
|
||||
/*dotDotDotToken*/ undefined,
|
||||
createIdentifier("value"),
|
||||
/*questionToken*/ undefined,
|
||||
type
|
||||
)],
|
||||
createBlock([
|
||||
createStatement(
|
||||
createAssignment(
|
||||
createAccessorAccessExpression(fieldName, isStatic, container),
|
||||
createIdentifier("value")
|
||||
)
|
||||
)
|
||||
], /*multiLine*/ true)
|
||||
);
|
||||
}
|
||||
|
||||
function updatePropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined) {
|
||||
const property = updateProperty(
|
||||
declaration,
|
||||
declaration.decorators,
|
||||
modifiers,
|
||||
fieldName,
|
||||
declaration.questionToken || declaration.exclamationToken,
|
||||
declaration.type,
|
||||
declaration.initializer
|
||||
);
|
||||
|
||||
changeTracker.replaceNode(file, declaration, property);
|
||||
}
|
||||
|
||||
function updateParameterPropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: ParameterDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined, classLikeContainer: ClassLikeDeclaration) {
|
||||
const property = createProperty(
|
||||
declaration.decorators,
|
||||
modifiers,
|
||||
fieldName,
|
||||
declaration.questionToken,
|
||||
declaration.type,
|
||||
declaration.initializer
|
||||
);
|
||||
|
||||
changeTracker.insertNodeAtClassStart(file, classLikeContainer, property);
|
||||
changeTracker.deleteNodeInList(file, declaration);
|
||||
}
|
||||
|
||||
function updatePropertyAssignmentDeclaration (changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyAssignment, fieldName: AcceptedNameType) {
|
||||
const assignment = updatePropertyAssignment(declaration, fieldName, declaration.initializer);
|
||||
changeTracker.replacePropertyAssignment(file, declaration, assignment);
|
||||
}
|
||||
|
||||
function updateFieldDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: AcceptedDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined, container: ContainerDeclaration) {
|
||||
if (isPropertyDeclaration(declaration)) {
|
||||
updatePropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers);
|
||||
}
|
||||
else if (isPropertyAssignment(declaration)) {
|
||||
updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName);
|
||||
}
|
||||
else {
|
||||
updateParameterPropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers, <ClassLikeDeclaration>container);
|
||||
}
|
||||
}
|
||||
|
||||
function insertAccessor(changeTracker: textChanges.ChangeTracker, file: SourceFile, accessor: AccessorDeclaration, declaration: AcceptedDeclaration, container: ContainerDeclaration) {
|
||||
isParameterPropertyDeclaration(declaration)
|
||||
? changeTracker.insertNodeAtClassStart(file, <ClassLikeDeclaration>container, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
}
|
||||
}
|
||||
@@ -1663,20 +1663,17 @@ namespace ts {
|
||||
|
||||
/// References and Occurrences
|
||||
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
|
||||
const canonicalFileName = getCanonicalFileName(normalizeSlashes(fileName));
|
||||
return flatMap(getDocumentHighlights(fileName, position, [fileName]), entry => entry.highlightSpans.map<ReferenceEntry>(highlightSpan => {
|
||||
Debug.assert(getCanonicalFileName(normalizeSlashes(entry.fileName)) === canonicalFileName); // Get occurrences only supports reporting occurrences for the file queried.
|
||||
return {
|
||||
fileName: entry.fileName,
|
||||
textSpan: highlightSpan.textSpan,
|
||||
isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference,
|
||||
isDefinition: false,
|
||||
isInString: highlightSpan.isInString,
|
||||
};
|
||||
}));
|
||||
return flatMap(getDocumentHighlights(fileName, position, [fileName]), entry => entry.highlightSpans.map<ReferenceEntry>(highlightSpan => ({
|
||||
fileName: entry.fileName,
|
||||
textSpan: highlightSpan.textSpan,
|
||||
isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference,
|
||||
isDefinition: false,
|
||||
isInString: highlightSpan.isInString,
|
||||
})));
|
||||
}
|
||||
|
||||
function getDocumentHighlights(fileName: string, position: number, filesToSearch: ReadonlyArray<string>): DocumentHighlights[] {
|
||||
Debug.assert(contains(filesToSearch, fileName));
|
||||
synchronizeHostData();
|
||||
const sourceFilesToSearch = map(filesToSearch, f => Debug.assertDefined(program.getSourceFile(f)));
|
||||
const sourceFile = getValidSourceFile(fileName);
|
||||
|
||||
@@ -316,6 +316,12 @@ namespace ts.textChanges {
|
||||
return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options);
|
||||
}
|
||||
|
||||
public replacePropertyAssignment(sourceFile: SourceFile, oldNode: PropertyAssignment, newNode: PropertyAssignment) {
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, {
|
||||
suffix: "," + this.newLineCharacter
|
||||
});
|
||||
}
|
||||
|
||||
private insertNodeAt(sourceFile: SourceFile, pos: number, newNode: Node, options: InsertNodeOptions = {}) {
|
||||
this.replaceRange(sourceFile, createTextRange(pos), newNode, options);
|
||||
}
|
||||
@@ -468,6 +474,9 @@ namespace ts.textChanges {
|
||||
else if (isVariableDeclaration(node)) {
|
||||
return { prefix: ", " };
|
||||
}
|
||||
else if (isPropertyAssignment(node)) {
|
||||
return { suffix: "," + this.newLineCharacter };
|
||||
}
|
||||
else if (isParameter(node)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -228,6 +228,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface UserPreferences {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "double" | "single";
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
|
||||
@@ -1526,4 +1526,45 @@ namespace ts {
|
||||
function getFirstChild(node: Node): Node | undefined {
|
||||
return node.forEachChild(child => child);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function getUniqueName(baseName: string, fileText: string): string {
|
||||
let nameText = baseName;
|
||||
for (let i = 1; stringContains(fileText, nameText); i++) {
|
||||
nameText = `${baseName}_${i}`;
|
||||
}
|
||||
return nameText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The index of the (only) reference to the extracted symbol. We want the cursor
|
||||
* to be on the reference, rather than the declaration, because it's closer to where the
|
||||
* user was before extracting it.
|
||||
*/
|
||||
/* @internal */
|
||||
export function getRenameLocation(edits: ReadonlyArray<FileTextChanges>, renameFilename: string, name: string, isDeclaredBeforeUse: boolean): number {
|
||||
let delta = 0;
|
||||
let lastPos = -1;
|
||||
for (const { fileName, textChanges } of edits) {
|
||||
Debug.assert(fileName === renameFilename);
|
||||
for (const change of textChanges) {
|
||||
const { span, newText } = change;
|
||||
const index = newText.indexOf(name);
|
||||
if (index !== -1) {
|
||||
lastPos = span.start + delta + index;
|
||||
|
||||
// If the reference comes first, return immediately.
|
||||
if (!isDeclaredBeforeUse) {
|
||||
return lastPos;
|
||||
}
|
||||
}
|
||||
delta += newText.length - span.length;
|
||||
}
|
||||
}
|
||||
|
||||
// If the declaration comes first, return the position of the last occurrence.
|
||||
Debug.assert(isDeclaredBeforeUse);
|
||||
Debug.assert(lastPos >= 0);
|
||||
return lastPos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
tests/cases/compiler/app.js(6,7): error TS2322: Type '1' is not assignable to type 'WatchHandler<any>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/func.ts (0 errors) ====
|
||||
interface ComponentOptions<V> {
|
||||
watch: Record<string, WatchHandler<any>>;
|
||||
}
|
||||
type WatchHandler<T> = (val: T) => void;
|
||||
declare function extend(options: ComponentOptions<{}>): void;
|
||||
export var vextend = extend;
|
||||
==== tests/cases/compiler/app.js (1 errors) ====
|
||||
import {vextend} from './func';
|
||||
// hover on vextend
|
||||
export var a = vextend({
|
||||
watch: {
|
||||
data1(val) {
|
||||
this.data2 = 1;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'WatchHandler<any>'.
|
||||
},
|
||||
data2(val) { },
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
//// [tests/cases/compiler/allowJscheckJsTypeParameterNoCrash.ts] ////
|
||||
|
||||
//// [func.ts]
|
||||
interface ComponentOptions<V> {
|
||||
watch: Record<string, WatchHandler<any>>;
|
||||
}
|
||||
type WatchHandler<T> = (val: T) => void;
|
||||
declare function extend(options: ComponentOptions<{}>): void;
|
||||
export var vextend = extend;
|
||||
//// [app.js]
|
||||
import {vextend} from './func';
|
||||
// hover on vextend
|
||||
export var a = vextend({
|
||||
watch: {
|
||||
data1(val) {
|
||||
this.data2 = 1;
|
||||
},
|
||||
data2(val) { },
|
||||
}
|
||||
});
|
||||
|
||||
//// [func.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.vextend = extend;
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var func_1 = require("./func");
|
||||
// hover on vextend
|
||||
exports.a = func_1.vextend({
|
||||
watch: {
|
||||
data1: function (val) {
|
||||
this.data2 = 1;
|
||||
},
|
||||
data2: function (val) { }
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/compiler/func.ts ===
|
||||
interface ComponentOptions<V> {
|
||||
>ComponentOptions : Symbol(ComponentOptions, Decl(func.ts, 0, 0))
|
||||
>V : Symbol(V, Decl(func.ts, 0, 27))
|
||||
|
||||
watch: Record<string, WatchHandler<any>>;
|
||||
>watch : Symbol(ComponentOptions.watch, Decl(func.ts, 0, 31))
|
||||
>Record : Symbol(Record, Decl(lib.d.ts, --, --))
|
||||
>WatchHandler : Symbol(WatchHandler, Decl(func.ts, 2, 1))
|
||||
}
|
||||
type WatchHandler<T> = (val: T) => void;
|
||||
>WatchHandler : Symbol(WatchHandler, Decl(func.ts, 2, 1))
|
||||
>T : Symbol(T, Decl(func.ts, 3, 18))
|
||||
>val : Symbol(val, Decl(func.ts, 3, 24))
|
||||
>T : Symbol(T, Decl(func.ts, 3, 18))
|
||||
|
||||
declare function extend(options: ComponentOptions<{}>): void;
|
||||
>extend : Symbol(extend, Decl(func.ts, 3, 40))
|
||||
>options : Symbol(options, Decl(func.ts, 4, 24))
|
||||
>ComponentOptions : Symbol(ComponentOptions, Decl(func.ts, 0, 0))
|
||||
|
||||
export var vextend = extend;
|
||||
>vextend : Symbol(vextend, Decl(func.ts, 5, 10))
|
||||
>extend : Symbol(extend, Decl(func.ts, 3, 40))
|
||||
|
||||
=== tests/cases/compiler/app.js ===
|
||||
import {vextend} from './func';
|
||||
>vextend : Symbol(vextend, Decl(app.js, 0, 8))
|
||||
|
||||
// hover on vextend
|
||||
export var a = vextend({
|
||||
>a : Symbol(a, Decl(app.js, 2, 10))
|
||||
>vextend : Symbol(vextend, Decl(app.js, 0, 8))
|
||||
|
||||
watch: {
|
||||
>watch : Symbol(watch, Decl(app.js, 2, 24))
|
||||
|
||||
data1(val) {
|
||||
>data1 : Symbol(data1, Decl(app.js, 3, 10))
|
||||
>val : Symbol(val, Decl(app.js, 4, 10))
|
||||
|
||||
this.data2 = 1;
|
||||
>this : Symbol(__type, Decl(lib.d.ts, --, --))
|
||||
>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6))
|
||||
|
||||
},
|
||||
data2(val) { },
|
||||
>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6))
|
||||
>val : Symbol(val, Decl(app.js, 7, 10))
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,57 @@
|
||||
=== tests/cases/compiler/func.ts ===
|
||||
interface ComponentOptions<V> {
|
||||
>ComponentOptions : ComponentOptions<V>
|
||||
>V : V
|
||||
|
||||
watch: Record<string, WatchHandler<any>>;
|
||||
>watch : Record<string, (val: any) => void>
|
||||
>Record : Record<K, T>
|
||||
>WatchHandler : (val: T) => void
|
||||
}
|
||||
type WatchHandler<T> = (val: T) => void;
|
||||
>WatchHandler : (val: T) => void
|
||||
>T : T
|
||||
>val : T
|
||||
>T : T
|
||||
|
||||
declare function extend(options: ComponentOptions<{}>): void;
|
||||
>extend : (options: ComponentOptions<{}>) => void
|
||||
>options : ComponentOptions<{}>
|
||||
>ComponentOptions : ComponentOptions<V>
|
||||
|
||||
export var vextend = extend;
|
||||
>vextend : (options: ComponentOptions<{}>) => void
|
||||
>extend : (options: ComponentOptions<{}>) => void
|
||||
|
||||
=== tests/cases/compiler/app.js ===
|
||||
import {vextend} from './func';
|
||||
>vextend : (options: ComponentOptions<{}>) => void
|
||||
|
||||
// hover on vextend
|
||||
export var a = vextend({
|
||||
>a : void
|
||||
>vextend({ watch: { data1(val) { this.data2 = 1; }, data2(val) { }, }}) : void
|
||||
>vextend : (options: ComponentOptions<{}>) => void
|
||||
>{ watch: { data1(val) { this.data2 = 1; }, data2(val) { }, }} : { watch: { data1(val: any): void; }; }
|
||||
|
||||
watch: {
|
||||
>watch : { data1(val: any): void; }
|
||||
>{ data1(val) { this.data2 = 1; }, data2(val) { }, } : { data1(val: any): void; }
|
||||
|
||||
data1(val) {
|
||||
>data1 : (val: any) => void
|
||||
>val : any
|
||||
|
||||
this.data2 = 1;
|
||||
>this.data2 = 1 : 1
|
||||
>this.data2 : (val: any) => void
|
||||
>this : Record<string, (val: any) => void>
|
||||
>data2 : (val: any) => void
|
||||
>1 : 1
|
||||
|
||||
},
|
||||
data2(val) { },
|
||||
>data2 : any
|
||||
>val : any
|
||||
}
|
||||
});
|
||||
+3
-2
@@ -3010,7 +3010,7 @@ declare namespace ts {
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: ReadonlyArray<TextChangeRange>): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: Node): boolean;
|
||||
function isParameterPropertyDeclaration(node: Node): node is ParameterDeclaration;
|
||||
function isEmptyBindingPattern(node: BindingName): node is BindingPattern;
|
||||
function isEmptyBindingElement(node: BindingElement): boolean;
|
||||
function getCombinedModifierFlags(node: Node): ModifierFlags;
|
||||
@@ -4369,6 +4369,7 @@ declare namespace ts {
|
||||
installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
|
||||
}
|
||||
interface UserPreferences {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "double" | "single";
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
@@ -5303,7 +5304,6 @@ declare namespace ts.server {
|
||||
function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never;
|
||||
}
|
||||
function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings;
|
||||
function mergeMapLikes<T extends object>(target: T, source: Partial<T>): void;
|
||||
type NormalizedPath = string & {
|
||||
__normalizedPathTag: any;
|
||||
};
|
||||
@@ -7419,6 +7419,7 @@ declare namespace ts.server.protocol {
|
||||
insertSpaceBeforeTypeAnnotation?: boolean;
|
||||
}
|
||||
interface UserPreferences {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "double" | "single";
|
||||
/**
|
||||
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
|
||||
|
||||
+2
-1
@@ -3010,7 +3010,7 @@ declare namespace ts {
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: ReadonlyArray<TextChangeRange>): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: Node): boolean;
|
||||
function isParameterPropertyDeclaration(node: Node): node is ParameterDeclaration;
|
||||
function isEmptyBindingPattern(node: BindingName): node is BindingPattern;
|
||||
function isEmptyBindingElement(node: BindingElement): boolean;
|
||||
function getCombinedModifierFlags(node: Node): ModifierFlags;
|
||||
@@ -4369,6 +4369,7 @@ declare namespace ts {
|
||||
installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
|
||||
}
|
||||
interface UserPreferences {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "double" | "single";
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/destructuredLateBoundNameHasCorrectTypes.ts(11,7): error TS2459: Type '{ prop: string; }' has no property '[notPresent]' and no string index signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/destructuredLateBoundNameHasCorrectTypes.ts (1 errors) ====
|
||||
let { [Symbol.iterator]: destructured } = [];
|
||||
void destructured;
|
||||
|
||||
const named = "prop";
|
||||
|
||||
let { [named]: computed } = { prop: "b" };
|
||||
void computed;
|
||||
|
||||
const notPresent = "prop2";
|
||||
|
||||
let { [notPresent]: computed2 } = { prop: "b" };
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2459: Type '{ prop: string; }' has no property '[notPresent]' and no string index signature.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [destructuredLateBoundNameHasCorrectTypes.ts]
|
||||
let { [Symbol.iterator]: destructured } = [];
|
||||
void destructured;
|
||||
|
||||
const named = "prop";
|
||||
|
||||
let { [named]: computed } = { prop: "b" };
|
||||
void computed;
|
||||
|
||||
const notPresent = "prop2";
|
||||
|
||||
let { [notPresent]: computed2 } = { prop: "b" };
|
||||
|
||||
|
||||
//// [destructuredLateBoundNameHasCorrectTypes.js]
|
||||
let { [Symbol.iterator]: destructured } = [];
|
||||
void destructured;
|
||||
const named = "prop";
|
||||
let { [named]: computed } = { prop: "b" };
|
||||
void computed;
|
||||
const notPresent = "prop2";
|
||||
let { [notPresent]: computed2 } = { prop: "b" };
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/destructuredLateBoundNameHasCorrectTypes.ts ===
|
||||
let { [Symbol.iterator]: destructured } = [];
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>destructured : Symbol(destructured, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 0, 5))
|
||||
|
||||
void destructured;
|
||||
>destructured : Symbol(destructured, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 0, 5))
|
||||
|
||||
const named = "prop";
|
||||
>named : Symbol(named, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 3, 5))
|
||||
|
||||
let { [named]: computed } = { prop: "b" };
|
||||
>named : Symbol(named, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 3, 5))
|
||||
>computed : Symbol(computed, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 5, 5))
|
||||
>prop : Symbol(prop, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 5, 29))
|
||||
|
||||
void computed;
|
||||
>computed : Symbol(computed, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 5, 5))
|
||||
|
||||
const notPresent = "prop2";
|
||||
>notPresent : Symbol(notPresent, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 8, 5))
|
||||
|
||||
let { [notPresent]: computed2 } = { prop: "b" };
|
||||
>notPresent : Symbol(notPresent, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 8, 5))
|
||||
>computed2 : Symbol(computed2, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 10, 5))
|
||||
>prop : Symbol(prop, Decl(destructuredLateBoundNameHasCorrectTypes.ts, 10, 35))
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/destructuredLateBoundNameHasCorrectTypes.ts ===
|
||||
let { [Symbol.iterator]: destructured } = [];
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>iterator : symbol
|
||||
>destructured : () => IterableIterator<undefined>
|
||||
>[] : undefined[]
|
||||
|
||||
void destructured;
|
||||
>void destructured : undefined
|
||||
>destructured : () => IterableIterator<undefined>
|
||||
|
||||
const named = "prop";
|
||||
>named : "prop"
|
||||
>"prop" : "prop"
|
||||
|
||||
let { [named]: computed } = { prop: "b" };
|
||||
>named : "prop"
|
||||
>computed : string
|
||||
>{ prop: "b" } : { prop: string; }
|
||||
>prop : string
|
||||
>"b" : "b"
|
||||
|
||||
void computed;
|
||||
>void computed : undefined
|
||||
>computed : string
|
||||
|
||||
const notPresent = "prop2";
|
||||
>notPresent : "prop2"
|
||||
>"prop2" : "prop2"
|
||||
|
||||
let { [notPresent]: computed2 } = { prop: "b" };
|
||||
>notPresent : "prop2"
|
||||
>computed2 : any
|
||||
>{ prop: "b" } : { prop: string; }
|
||||
>prop : string
|
||||
>"b" : "b"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
tests/cases/conformance/salsa/first.js(1,1): error TS2539: Cannot assign to '"tests/cases/conformance/salsa/first"' because it is not a variable.
|
||||
tests/cases/conformance/salsa/first.js(1,11): error TS2304: Cannot find name 'require'.
|
||||
tests/cases/conformance/salsa/first.js(2,9): error TS2339: Property 'formatters' does not exist on type 'typeof import("tests/cases/conformance/salsa/first")'.
|
||||
tests/cases/conformance/salsa/second.js(1,1): error TS2539: Cannot assign to '"tests/cases/conformance/salsa/second"' because it is not a variable.
|
||||
tests/cases/conformance/salsa/second.js(1,11): error TS2304: Cannot find name 'require'.
|
||||
tests/cases/conformance/salsa/second.js(2,9): error TS2339: Property 'formatters' does not exist on type 'typeof import("tests/cases/conformance/salsa/second")'.
|
||||
|
||||
@@ -9,10 +7,8 @@ tests/cases/conformance/salsa/second.js(2,9): error TS2339: Property 'formatters
|
||||
==== tests/cases/conformance/salsa/mod.js (0 errors) ====
|
||||
// Based on a pattern from adonis
|
||||
exports.formatters = {}
|
||||
==== tests/cases/conformance/salsa/first.js (3 errors) ====
|
||||
==== tests/cases/conformance/salsa/first.js (2 errors) ====
|
||||
exports = require('./mod')
|
||||
~~~~~~~
|
||||
!!! error TS2539: Cannot assign to '"tests/cases/conformance/salsa/first"' because it is not a variable.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'require'.
|
||||
exports.formatters.j = function (v) {
|
||||
@@ -20,10 +16,8 @@ tests/cases/conformance/salsa/second.js(2,9): error TS2339: Property 'formatters
|
||||
!!! error TS2339: Property 'formatters' does not exist on type 'typeof import("tests/cases/conformance/salsa/first")'.
|
||||
return v
|
||||
}
|
||||
==== tests/cases/conformance/salsa/second.js (3 errors) ====
|
||||
==== tests/cases/conformance/salsa/second.js (2 errors) ====
|
||||
exports = require('./mod')
|
||||
~~~~~~~
|
||||
!!! error TS2539: Cannot assign to '"tests/cases/conformance/salsa/second"' because it is not a variable.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'require'.
|
||||
exports.formatters.o = function (v) {
|
||||
|
||||
@@ -10,7 +10,7 @@ exports.formatters = {}
|
||||
=== tests/cases/conformance/salsa/first.js ===
|
||||
exports = require('./mod')
|
||||
>exports = require('./mod') : typeof import("tests/cases/conformance/salsa/mod")
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/first")
|
||||
>require('./mod') : typeof import("tests/cases/conformance/salsa/mod")
|
||||
>require : any
|
||||
>'./mod' : "./mod"
|
||||
@@ -31,7 +31,7 @@ exports.formatters.j = function (v) {
|
||||
=== tests/cases/conformance/salsa/second.js ===
|
||||
exports = require('./mod')
|
||||
>exports = require('./mod') : typeof import("tests/cases/conformance/salsa/mod")
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/second")
|
||||
>require('./mod') : typeof import("tests/cases/conformance/salsa/mod")
|
||||
>require : any
|
||||
>'./mod' : "./mod"
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
tests/cases/conformance/jsdoc/0.js(56,20): error TS8024: JSDoc '@param' tag has name 'obj', but there is no parameter with that name.
|
||||
tests/cases/conformance/jsdoc/0.js(61,19): error TS2459: Type 'string' has no property 'a' and no string index signature.
|
||||
tests/cases/conformance/jsdoc/0.js(61,22): error TS2459: Type 'string' has no property 'b' and no string index signature.
|
||||
tests/cases/conformance/jsdoc/0.js(63,20): error TS8024: JSDoc '@param' tag has name 'y', but there is no parameter with that name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/0.js (4 errors) ====
|
||||
// Object literal syntax
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} x
|
||||
*/
|
||||
function good1({a, b}, x) {}
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {{c: number, d: number}} OBJECTION
|
||||
*/
|
||||
function good2({a, b}, {c, d}) {}
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} y
|
||||
*/
|
||||
function good3(x, {a, b}, y) {}
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function good4({a, b}) {}
|
||||
|
||||
// nested object syntax
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a - this is like the saddest way to specify a type
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {string} x
|
||||
*/
|
||||
function good5({a, b}, x) {}
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {Object} OBJECTION - documentation here too
|
||||
* @param {string} OBJECTION.c
|
||||
* @param {string} OBJECTION.d - meh
|
||||
*/
|
||||
function good6({a, b}, {c, d}) {}
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
* @param {string} y
|
||||
*/
|
||||
function good7(x, {a, b}, y) {}
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
*/
|
||||
function good8({a, b}) {}
|
||||
|
||||
/**
|
||||
* @param {object} obj - this type gets ignored
|
||||
~~~
|
||||
!!! error TS8024: JSDoc '@param' tag has name 'obj', but there is no parameter with that name.
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - and x's type gets used for both parameters
|
||||
* @param {string} x
|
||||
*/
|
||||
function bad1(x, {a, b}) {}
|
||||
~
|
||||
!!! error TS2459: Type 'string' has no property 'a' and no string index signature.
|
||||
~
|
||||
!!! error TS2459: Type 'string' has no property 'b' and no string index signature.
|
||||
/**
|
||||
* @param {string} y - here, y's type gets ignored but obj's is fine
|
||||
~
|
||||
!!! error TS8024: JSDoc '@param' tag has name 'y', but there is no parameter with that name.
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function bad2(x, {a, b}) {}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
=== tests/cases/conformance/jsdoc/0.js ===
|
||||
// Object literal syntax
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} x
|
||||
*/
|
||||
function good1({a, b}, x) {}
|
||||
>good1 : Symbol(good1, Decl(0.js, 0, 0))
|
||||
>a : Symbol(a, Decl(0.js, 5, 16))
|
||||
>b : Symbol(b, Decl(0.js, 5, 18))
|
||||
>x : Symbol(x, Decl(0.js, 5, 22))
|
||||
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {{c: number, d: number}} OBJECTION
|
||||
*/
|
||||
function good2({a, b}, {c, d}) {}
|
||||
>good2 : Symbol(good2, Decl(0.js, 5, 28))
|
||||
>a : Symbol(a, Decl(0.js, 10, 16))
|
||||
>b : Symbol(b, Decl(0.js, 10, 18))
|
||||
>c : Symbol(c, Decl(0.js, 10, 24))
|
||||
>d : Symbol(d, Decl(0.js, 10, 26))
|
||||
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} y
|
||||
*/
|
||||
function good3(x, {a, b}, y) {}
|
||||
>good3 : Symbol(good3, Decl(0.js, 10, 33))
|
||||
>x : Symbol(x, Decl(0.js, 16, 15))
|
||||
>a : Symbol(a, Decl(0.js, 16, 19))
|
||||
>b : Symbol(b, Decl(0.js, 16, 21))
|
||||
>y : Symbol(y, Decl(0.js, 16, 25))
|
||||
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function good4({a, b}) {}
|
||||
>good4 : Symbol(good4, Decl(0.js, 16, 31))
|
||||
>a : Symbol(a, Decl(0.js, 20, 16))
|
||||
>b : Symbol(b, Decl(0.js, 20, 18))
|
||||
|
||||
// nested object syntax
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a - this is like the saddest way to specify a type
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {string} x
|
||||
*/
|
||||
function good5({a, b}, x) {}
|
||||
>good5 : Symbol(good5, Decl(0.js, 20, 25))
|
||||
>a : Symbol(a, Decl(0.js, 29, 16))
|
||||
>b : Symbol(b, Decl(0.js, 29, 18))
|
||||
>x : Symbol(x, Decl(0.js, 29, 22))
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {Object} OBJECTION - documentation here too
|
||||
* @param {string} OBJECTION.c
|
||||
* @param {string} OBJECTION.d - meh
|
||||
*/
|
||||
function good6({a, b}, {c, d}) {}
|
||||
>good6 : Symbol(good6, Decl(0.js, 29, 28))
|
||||
>a : Symbol(a, Decl(0.js, 38, 16))
|
||||
>b : Symbol(b, Decl(0.js, 38, 18))
|
||||
>c : Symbol(c, Decl(0.js, 38, 24))
|
||||
>d : Symbol(d, Decl(0.js, 38, 26))
|
||||
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
* @param {string} y
|
||||
*/
|
||||
function good7(x, {a, b}, y) {}
|
||||
>good7 : Symbol(good7, Decl(0.js, 38, 33))
|
||||
>x : Symbol(x, Decl(0.js, 46, 15))
|
||||
>a : Symbol(a, Decl(0.js, 46, 19))
|
||||
>b : Symbol(b, Decl(0.js, 46, 21))
|
||||
>y : Symbol(y, Decl(0.js, 46, 25))
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
*/
|
||||
function good8({a, b}) {}
|
||||
>good8 : Symbol(good8, Decl(0.js, 46, 31))
|
||||
>a : Symbol(a, Decl(0.js, 52, 16))
|
||||
>b : Symbol(b, Decl(0.js, 52, 18))
|
||||
|
||||
/**
|
||||
* @param {object} obj - this type gets ignored
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - and x's type gets used for both parameters
|
||||
* @param {string} x
|
||||
*/
|
||||
function bad1(x, {a, b}) {}
|
||||
>bad1 : Symbol(bad1, Decl(0.js, 52, 25))
|
||||
>x : Symbol(x, Decl(0.js, 60, 14))
|
||||
>a : Symbol(a, Decl(0.js, 60, 18))
|
||||
>b : Symbol(b, Decl(0.js, 60, 20))
|
||||
|
||||
/**
|
||||
* @param {string} y - here, y's type gets ignored but obj's is fine
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function bad2(x, {a, b}) {}
|
||||
>bad2 : Symbol(bad2, Decl(0.js, 60, 27))
|
||||
>x : Symbol(x, Decl(0.js, 65, 14))
|
||||
>a : Symbol(a, Decl(0.js, 65, 18))
|
||||
>b : Symbol(b, Decl(0.js, 65, 20))
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
=== tests/cases/conformance/jsdoc/0.js ===
|
||||
// Object literal syntax
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} x
|
||||
*/
|
||||
function good1({a, b}, x) {}
|
||||
>good1 : ({ a, b }: { a: string; b: string; }, x: string) => void
|
||||
>a : string
|
||||
>b : string
|
||||
>x : string
|
||||
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {{c: number, d: number}} OBJECTION
|
||||
*/
|
||||
function good2({a, b}, {c, d}) {}
|
||||
>good2 : ({ a, b }: { a: string; b: string; }, { c, d }: { c: number; d: number; }) => void
|
||||
>a : string
|
||||
>b : string
|
||||
>c : number
|
||||
>d : number
|
||||
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} y
|
||||
*/
|
||||
function good3(x, {a, b}, y) {}
|
||||
>good3 : (x: number, { a, b }: { a: string; b: string; }, y: string) => void
|
||||
>x : number
|
||||
>a : string
|
||||
>b : string
|
||||
>y : string
|
||||
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function good4({a, b}) {}
|
||||
>good4 : ({ a, b }: { a: string; b: string; }) => void
|
||||
>a : string
|
||||
>b : string
|
||||
|
||||
// nested object syntax
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a - this is like the saddest way to specify a type
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {string} x
|
||||
*/
|
||||
function good5({a, b}, x) {}
|
||||
>good5 : ({ a, b }: { a: string; b: string; }, x: string) => void
|
||||
>a : string
|
||||
>b : string
|
||||
>x : string
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {Object} OBJECTION - documentation here too
|
||||
* @param {string} OBJECTION.c
|
||||
* @param {string} OBJECTION.d - meh
|
||||
*/
|
||||
function good6({a, b}, {c, d}) {}
|
||||
>good6 : ({ a, b }: { a: string; b: string; }, { c, d }: { c: string; d: string; }) => void
|
||||
>a : string
|
||||
>b : string
|
||||
>c : string
|
||||
>d : string
|
||||
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
* @param {string} y
|
||||
*/
|
||||
function good7(x, {a, b}, y) {}
|
||||
>good7 : (x: number, { a, b }: { a: string; b: string; }, y: string) => void
|
||||
>x : number
|
||||
>a : string
|
||||
>b : string
|
||||
>y : string
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
*/
|
||||
function good8({a, b}) {}
|
||||
>good8 : ({ a, b }: { a: string; b: string; }) => void
|
||||
>a : string
|
||||
>b : string
|
||||
|
||||
/**
|
||||
* @param {object} obj - this type gets ignored
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - and x's type gets used for both parameters
|
||||
* @param {string} x
|
||||
*/
|
||||
function bad1(x, {a, b}) {}
|
||||
>bad1 : (x: string, { a, b }: string) => void
|
||||
>x : string
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
/**
|
||||
* @param {string} y - here, y's type gets ignored but obj's is fine
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function bad2(x, {a, b}) {}
|
||||
>bad2 : (x: any, { a, b }: { a: string; b: string; }) => void
|
||||
>x : any
|
||||
>a : string
|
||||
>b : string
|
||||
|
||||
@@ -147,7 +147,7 @@ module.exports.func4 = function () { };
|
||||
var multipleDeclarationAlias1 = exports = module.exports;
|
||||
>multipleDeclarationAlias1 : any
|
||||
>exports = module.exports : any
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>module.exports : any
|
||||
>module : any
|
||||
>exports : any
|
||||
@@ -212,7 +212,7 @@ var multipleDeclarationAlias5 = module.exports = exports = {};
|
||||
>module : any
|
||||
>exports : any
|
||||
>exports = {} : {}
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>{} : {}
|
||||
|
||||
multipleDeclarationAlias5.func9 = function () { };
|
||||
@@ -225,7 +225,7 @@ multipleDeclarationAlias5.func9 = function () { };
|
||||
var multipleDeclarationAlias6 = exports = module.exports = {};
|
||||
>multipleDeclarationAlias6 : { [x: string]: any; }
|
||||
>exports = module.exports = {} : { [x: string]: any; }
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>module.exports = {} : { [x: string]: any; }
|
||||
>module.exports : any
|
||||
>module : any
|
||||
@@ -241,7 +241,7 @@ multipleDeclarationAlias6.func10 = function () { };
|
||||
|
||||
exports = module.exports = someOtherVariable = {};
|
||||
>exports = module.exports = someOtherVariable = {} : {}
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>module.exports = someOtherVariable = {} : {}
|
||||
>module.exports : any
|
||||
>module : any
|
||||
@@ -268,7 +268,7 @@ module.exports.func12 = function () { };
|
||||
|
||||
exports = module.exports = someOtherVariable = {};
|
||||
>exports = module.exports = someOtherVariable = {} : {}
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>module.exports = someOtherVariable = {} : {}
|
||||
>module.exports : any
|
||||
>module : any
|
||||
@@ -295,7 +295,7 @@ module.exports.func12 = function () { };
|
||||
|
||||
exports = module.exports = {};
|
||||
>exports = module.exports = {} : { [x: string]: any; }
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>module.exports = {} : { [x: string]: any; }
|
||||
>module.exports : any
|
||||
>module : any
|
||||
@@ -320,7 +320,7 @@ module.exports.func14 = function () { };
|
||||
|
||||
exports = module.exports = {};
|
||||
>exports = module.exports = {} : { [x: string]: any; }
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>module.exports = {} : { [x: string]: any; }
|
||||
>module.exports : any
|
||||
>module : any
|
||||
@@ -349,7 +349,7 @@ module.exports = exports = {};
|
||||
>module : any
|
||||
>exports : any
|
||||
>exports = {} : {}
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/b")
|
||||
>{} : {}
|
||||
|
||||
exports.func17 = function () { };
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/conformance/salsa/index.js ===
|
||||
/// <reference path='node.d.ts' />
|
||||
const C = require("./semver")
|
||||
>C : Symbol(C, Decl(index.js, 1, 5))
|
||||
>require : Symbol(require, Decl(node.d.ts, 0, 0))
|
||||
>"./semver" : Symbol("tests/cases/conformance/salsa/semver", Decl(semver.js, 0, 0))
|
||||
|
||||
var two = C.f(1)
|
||||
>two : Symbol(two, Decl(index.js, 2, 3))
|
||||
>C.f : Symbol(f, Decl(semver.js, 1, 28))
|
||||
>C : Symbol(C, Decl(index.js, 1, 5))
|
||||
>f : Symbol(f, Decl(semver.js, 1, 28))
|
||||
|
||||
var c = new C
|
||||
>c : Symbol(c, Decl(index.js, 3, 3))
|
||||
>C : Symbol(C, Decl(index.js, 1, 5))
|
||||
|
||||
=== tests/cases/conformance/salsa/node.d.ts ===
|
||||
declare function require(name: string): any;
|
||||
>require : Symbol(require, Decl(node.d.ts, 0, 0))
|
||||
>name : Symbol(name, Decl(node.d.ts, 0, 25))
|
||||
|
||||
declare var exports: any;
|
||||
>exports : Symbol(exports, Decl(node.d.ts, 1, 11))
|
||||
|
||||
declare var module: { exports: any };
|
||||
>module : Symbol(module, Decl(node.d.ts, 2, 11))
|
||||
>exports : Symbol(exports, Decl(node.d.ts, 2, 21))
|
||||
|
||||
=== tests/cases/conformance/salsa/semver.js ===
|
||||
/// <reference path='node.d.ts' />
|
||||
exports = module.exports = C
|
||||
>exports : Symbol("tests/cases/conformance/salsa/semver", Decl(semver.js, 0, 0))
|
||||
>module.exports : Symbol(exports, Decl(node.d.ts, 2, 21))
|
||||
>module : Symbol(export=, Decl(semver.js, 1, 9))
|
||||
>exports : Symbol(export=, Decl(semver.js, 1, 9))
|
||||
>C : Symbol(C, Decl(semver.js, 2, 22))
|
||||
|
||||
exports.f = n => n + 1
|
||||
>exports.f : Symbol(f, Decl(semver.js, 1, 28))
|
||||
>exports : Symbol(f, Decl(semver.js, 1, 28))
|
||||
>f : Symbol(f, Decl(semver.js, 1, 28))
|
||||
>n : Symbol(n, Decl(semver.js, 2, 11))
|
||||
>n : Symbol(n, Decl(semver.js, 2, 11))
|
||||
|
||||
function C() {
|
||||
>C : Symbol(C, Decl(semver.js, 2, 22))
|
||||
|
||||
this.p = 1
|
||||
>p : Symbol(C.p, Decl(semver.js, 3, 14))
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
=== tests/cases/conformance/salsa/index.js ===
|
||||
/// <reference path='node.d.ts' />
|
||||
const C = require("./semver")
|
||||
>C : typeof C
|
||||
>require("./semver") : typeof C
|
||||
>require : (name: string) => any
|
||||
>"./semver" : "./semver"
|
||||
|
||||
var two = C.f(1)
|
||||
>two : any
|
||||
>C.f(1) : any
|
||||
>C.f : (n: any) => any
|
||||
>C : typeof C
|
||||
>f : (n: any) => any
|
||||
>1 : 1
|
||||
|
||||
var c = new C
|
||||
>c : C
|
||||
>new C : C
|
||||
>C : typeof C
|
||||
|
||||
=== tests/cases/conformance/salsa/node.d.ts ===
|
||||
declare function require(name: string): any;
|
||||
>require : (name: string) => any
|
||||
>name : string
|
||||
|
||||
declare var exports: any;
|
||||
>exports : any
|
||||
|
||||
declare var module: { exports: any };
|
||||
>module : { exports: any; }
|
||||
>exports : any
|
||||
|
||||
=== tests/cases/conformance/salsa/semver.js ===
|
||||
/// <reference path='node.d.ts' />
|
||||
exports = module.exports = C
|
||||
>exports = module.exports = C : typeof C
|
||||
>exports : typeof import("tests/cases/conformance/salsa/semver")
|
||||
>module.exports = C : typeof C
|
||||
>module.exports : any
|
||||
>module : { exports: any; }
|
||||
>exports : any
|
||||
>C : typeof C
|
||||
|
||||
exports.f = n => n + 1
|
||||
>exports.f = n => n + 1 : (n: any) => any
|
||||
>exports.f : (n: any) => any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/semver")
|
||||
>f : (n: any) => any
|
||||
>n => n + 1 : (n: any) => any
|
||||
>n : any
|
||||
>n + 1 : any
|
||||
>n : any
|
||||
>1 : 1
|
||||
|
||||
function C() {
|
||||
>C : typeof C
|
||||
|
||||
this.p = 1
|
||||
>this.p = 1 : 1
|
||||
>this.p : any
|
||||
>this : any
|
||||
>p : any
|
||||
>1 : 1
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [tripleSlashInCommentNotParsed.ts]
|
||||
/*
|
||||
/// <reference path="non-existing-file.d.ts" />
|
||||
*/
|
||||
void 0;
|
||||
|
||||
//// [tripleSlashInCommentNotParsed.js]
|
||||
/*
|
||||
/// <reference path="non-existing-file.d.ts" />
|
||||
*/
|
||||
void 0;
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/tripleSlashInCommentNotParsed.ts ===
|
||||
/*
|
||||
No type information for this code./// <reference path="non-existing-file.d.ts" />
|
||||
No type information for this code.*/
|
||||
No type information for this code.void 0;
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/tripleSlashInCommentNotParsed.ts ===
|
||||
/*
|
||||
/// <reference path="non-existing-file.d.ts" />
|
||||
*/
|
||||
void 0;
|
||||
>void 0 : undefined
|
||||
>0 : 0
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
tests/cases/conformance/salsa/semver.js(2,1): error TS2539: Cannot assign to '"tests/cases/conformance/salsa/semver"' because it is not a variable.
|
||||
|
||||
|
||||
==== tests/cases/conformance/salsa/index.js (0 errors) ====
|
||||
/// <reference path='./types.d.ts'/>
|
||||
const C = require("./semver")
|
||||
var two = C.f(1)
|
||||
|
||||
==== tests/cases/conformance/salsa/types.d.ts (0 errors) ====
|
||||
declare var require: any;
|
||||
declare var module: any;
|
||||
==== tests/cases/conformance/salsa/semver.js (1 errors) ====
|
||||
/// <reference path='./types.d.ts'/>
|
||||
exports = module.exports = C
|
||||
~~~~~~~
|
||||
!!! error TS2539: Cannot assign to '"tests/cases/conformance/salsa/semver"' because it is not a variable.
|
||||
C.f = n => n + 1
|
||||
function C() {
|
||||
this.p = 1
|
||||
}
|
||||
@@ -25,7 +25,7 @@ declare var module: any;
|
||||
/// <reference path='./types.d.ts'/>
|
||||
exports = module.exports = C
|
||||
>exports = module.exports = C : typeof C
|
||||
>exports : any
|
||||
>exports : typeof import("tests/cases/conformance/salsa/semver")
|
||||
>module.exports = C : typeof C
|
||||
>module.exports : any
|
||||
>module : any
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/adonis-framework/lib/util.js(18,14): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/lib/util"' because it is not a variable.
|
||||
node_modules/adonis-framework/lib/util.js(24,13): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/providers/ConfigProvider.js(9,33): error TS2307: Cannot find module 'adonis-fold'.
|
||||
node_modules/adonis-framework/providers/EncryptionProvider.js(9,33): error TS2307: Cannot find module 'adonis-fold'.
|
||||
@@ -64,13 +63,10 @@ node_modules/adonis-framework/src/Exceptions/index.js(205,12): error TS2554: Exp
|
||||
node_modules/adonis-framework/src/File/index.js(175,5): error TS2322: Type 'Promise<any>' is not assignable to type 'boolean'.
|
||||
node_modules/adonis-framework/src/File/index.js(273,5): error TS2322: Type 'boolean | ""' is not assignable to type 'boolean'.
|
||||
Type '""' is not assignable to type 'boolean'.
|
||||
node_modules/adonis-framework/src/Hash/index.js(19,12): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Hash/index"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Helpers/index.js(49,15): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Helpers/index"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Helpers/index.js(105,3): error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
node_modules/adonis-framework/src/Helpers/index.js(106,3): error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
node_modules/adonis-framework/src/Helpers/index.js(330,23): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/adonis-framework/src/Middleware/index.js(13,21): error TS2307: Cannot find module 'adonis-fold'.
|
||||
node_modules/adonis-framework/src/Middleware/index.js(57,18): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Middleware/index"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Middleware/index.js(92,19): error TS2538: Type 'undefined' cannot be used as an index type.
|
||||
node_modules/adonis-framework/src/Middleware/index.js(230,20): error TS8024: JSDoc '@param' tag has name 'Middleware', but there is no parameter with that name.
|
||||
node_modules/adonis-framework/src/Request/index.js(64,15): error TS2304: Cannot find name 'Mixed'.
|
||||
@@ -103,8 +99,6 @@ node_modules/adonis-framework/src/Response/index.js(95,16): error TS2304: Cannot
|
||||
node_modules/adonis-framework/src/Response/index.js(172,15): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Response/index.js(299,15): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Response/index.js(323,15): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Route/domains.js(14,15): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Route/domains"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Route/helpers.js(15,20): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Route/helpers"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Route/helpers.js(22,13): error TS2304: Cannot find name 'Any'.
|
||||
node_modules/adonis-framework/src/Route/helpers.js(34,3): error TS2322: Type 'string | string[]' is not assignable to type 'string'.
|
||||
Type 'string[]' is not assignable to type 'string'.
|
||||
@@ -112,7 +106,6 @@ node_modules/adonis-framework/src/Route/helpers.js(42,13): error TS2304: Cannot
|
||||
node_modules/adonis-framework/src/Route/helpers.js(54,21): error TS8024: JSDoc '@param' tag has name 'url', but there is no parameter with that name.
|
||||
node_modules/adonis-framework/src/Route/helpers.js(131,21): error TS8024: JSDoc '@param' tag has name 'format', but there is no parameter with that name.
|
||||
node_modules/adonis-framework/src/Route/index.js(30,5): error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
node_modules/adonis-framework/src/Route/index.js(36,13): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Route/index"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Route/index.js(58,3): error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
node_modules/adonis-framework/src/Route/index.js(321,13): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Route/index.js(321,20): error TS8029: JSDoc '@param' tag has name 'keys', but there is no parameter with that name. It would match 'arguments' if it had an array type.
|
||||
@@ -134,7 +127,6 @@ node_modules/adonis-framework/src/Route/resource.js(198,22): error TS8029: JSDoc
|
||||
node_modules/adonis-framework/src/Route/resource.js(233,15): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Route/resource.js(261,15): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Route/resource.js(296,15): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Server/helpers.js(9,15): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Server/helpers"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Server/helpers.js(17,29): error TS8024: JSDoc '@param' tag has name 'appNamespace', but there is no parameter with that name.
|
||||
node_modules/adonis-framework/src/Server/index.js(17,21): error TS2307: Cannot find module 'adonis-fold'.
|
||||
node_modules/adonis-framework/src/Server/index.js(54,21): error TS2554: Expected 4 arguments, but got 3.
|
||||
@@ -156,7 +148,6 @@ node_modules/adonis-framework/src/Session/SessionManager.js(13,21): error TS2307
|
||||
node_modules/adonis-framework/src/Session/SessionManager.js(69,22): error TS2339: Property 'drivers' does not exist on type 'Function'.
|
||||
node_modules/adonis-framework/src/Session/SessionManager.js(69,49): error TS2339: Property 'drivers' does not exist on type 'Function'.
|
||||
node_modules/adonis-framework/src/Session/SessionManager.js(71,76): error TS2339: Property 'drivers' does not exist on type 'Function'.
|
||||
node_modules/adonis-framework/src/Session/Store.js(21,15): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/Session/Store"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/Session/Store.js(28,13): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Session/Store.js(80,13): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/Session/index.js(11,2): error TS1003: Identifier expected.
|
||||
@@ -197,11 +188,9 @@ node_modules/adonis-framework/src/View/Form/index.js(601,51): error TS2345: Argu
|
||||
Type 'number' is not assignable to type 'string | any[]'.
|
||||
node_modules/adonis-framework/src/View/index.js(50,23): error TS8024: JSDoc '@param' tag has name 'template_path', but there is no parameter with that name.
|
||||
node_modules/adonis-framework/src/View/index.js(113,15): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/adonis-framework/src/View/loader.js(18,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/View/loader"' because it is not a variable.
|
||||
node_modules/adonis-framework/src/View/services.js(10,21): error TS2307: Cannot find module 'adonis-fold'.
|
||||
node_modules/adonis-framework/src/View/services.js(25,23): error TS8024: JSDoc '@param' tag has name 'lexer', but there is no parameter with that name.
|
||||
node_modules/adonis-framework/src/View/services.js(34,22): error TS2339: Property 'CallExtensionAsync' does not exist on type 'Function'.
|
||||
node_modules/adonis-framework/src/View/services.js(65,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/adonis-framework/node_modules/adonis-framework/src/View/services"' because it is not a variable.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/antd/lib/badge/ScrollNumber.d.ts(28,81): error TS2344: Type '{ className: string; style: { transition: string | boolean; msTransform: string; WebkitTransform:...' does not satisfy the constraint 'HTMLAttributes<HTMLElement>'.
|
||||
Types of property 'style' are incompatible.
|
||||
Type '{ transition: string | boolean; msTransform: string; WebkitTransform: string; transform: string; }' is not assignable to type 'CSSProperties | undefined'.
|
||||
Type '{ transition: string | boolean; msTransform: string; WebkitTransform: string; transform: string; }' is not assignable to type 'CSSProperties'.
|
||||
Types of property 'transition' are incompatible.
|
||||
Type 'string | boolean' is not assignable to type 'string | undefined'.
|
||||
Type 'true' is not assignable to type 'string | undefined'.
|
||||
node_modules/antd/lib/badge/ScrollNumber.d.ts(38,77): error TS2344: Type '{ className: string; style: { transition: string | boolean; msTransform: string; WebkitTransform:...' does not satisfy the constraint 'HTMLAttributes<HTMLElement>'.
|
||||
Types of property 'style' are incompatible.
|
||||
Type '{ transition: string | boolean; msTransform: string; WebkitTransform: string; transform: string; }' is not assignable to type 'CSSProperties | undefined'.
|
||||
Type '{ transition: string | boolean; msTransform: string; WebkitTransform: string; transform: string; }' is not assignable to type 'CSSProperties'.
|
||||
Types of property 'transition' are incompatible.
|
||||
Type 'string | boolean' is not assignable to type 'string | undefined'.
|
||||
Type 'true' is not assignable to type 'string | undefined'.
|
||||
|
||||
|
||||
|
||||
Standard error:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/debug/src/browser.js(7,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/debug/node_modules/debug/src/browser"' because it is not a variable.
|
||||
node_modules/debug/src/browser.js(13,41): error TS2304: Cannot find name 'chrome'.
|
||||
node_modules/debug/src/browser.js(14,41): error TS2304: Cannot find name 'chrome'.
|
||||
node_modules/debug/src/browser.js(15,21): error TS2304: Cannot find name 'chrome'.
|
||||
@@ -12,7 +11,6 @@ node_modules/debug/src/browser.js(73,9): error TS2551: Property 'formatters' doe
|
||||
node_modules/debug/src/browser.js(96,21): error TS2339: Property 'humanize' does not exist on type 'typeof import("/home/nathansa/ts/tests/cases/user/debug/node_modules/debug/src/browser")'.
|
||||
node_modules/debug/src/browser.js(178,9): error TS2339: Property 'enable' does not exist on type 'typeof import("/home/nathansa/ts/tests/cases/user/debug/node_modules/debug/src/browser")'.
|
||||
node_modules/debug/src/browser.js(187,13): error TS2304: Cannot find name 'LocalStorage'.
|
||||
node_modules/debug/src/debug.js(9,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/debug/node_modules/debug/src/debug"' because it is not a variable.
|
||||
node_modules/debug/src/debug.js(25,1): error TS2323: Cannot redeclare exported variable 'names'.
|
||||
node_modules/debug/src/debug.js(26,1): error TS2323: Cannot redeclare exported variable 'skips'.
|
||||
node_modules/debug/src/debug.js(46,13): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type 'string'.
|
||||
@@ -34,7 +32,6 @@ node_modules/debug/src/debug.js(156,3): error TS2323: Cannot redeclare exported
|
||||
node_modules/debug/src/debug.js(217,12): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/debug/src/debug.js(218,13): error TS2304: Cannot find name 'Mixed'.
|
||||
node_modules/debug/src/index.js(6,47): error TS2339: Property 'type' does not exist on type 'Process'.
|
||||
node_modules/debug/src/node.js(14,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/debug/node_modules/debug/src/node"' because it is not a variable.
|
||||
node_modules/debug/src/node.js(26,1): error TS2323: Cannot redeclare exported variable 'colors'.
|
||||
node_modules/debug/src/node.js(31,5): error TS2323: Cannot redeclare exported variable 'colors'.
|
||||
node_modules/debug/src/node.js(60,39): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
|
||||
|
||||
@@ -6,7 +6,6 @@ node_modules/enhanced-resolve/lib/CachedInputFileSystem.js(129,18): error TS2345
|
||||
Type 'null' is not assignable to type 'number | undefined'.
|
||||
node_modules/enhanced-resolve/lib/CachedInputFileSystem.js(147,18): error TS2345: Argument of type 'Timer | null' is not assignable to parameter of type 'number | undefined'.
|
||||
Type 'null' is not assignable to type 'number | undefined'.
|
||||
node_modules/enhanced-resolve/lib/CachedInputFileSystem.js(154,19): error TS2569: Type 'IterableIterator<any>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
|
||||
node_modules/enhanced-resolve/lib/CachedInputFileSystem.js(176,19): error TS2322: Type 'null' is not assignable to type '(path: any, callback: any) => void'.
|
||||
node_modules/enhanced-resolve/lib/CachedInputFileSystem.js(179,23): error TS2322: Type 'null' is not assignable to type '(path: any) => any'.
|
||||
node_modules/enhanced-resolve/lib/CachedInputFileSystem.js(182,22): error TS2322: Type 'null' is not assignable to type '(path: any, callback: any) => void'.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/npm/bin/npm-cli.js(5,14): error TS2304: Cannot find name 'WScript'.
|
||||
node_modules/npm/bin/npm-cli.js(6,5): error TS2304: Cannot find name 'WScript'.
|
||||
node_modules/npm/bin/npm-cli.js(13,5): error TS2304: Cannot find name 'WScript'.
|
||||
node_modules/npm/bin/npm-cli.js(6,13): error TS2551: Property 'echo' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Echo'?
|
||||
node_modules/npm/bin/npm-cli.js(13,13): error TS2551: Property 'quit' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Quit'?
|
||||
node_modules/npm/bin/npm-cli.js(30,23): error TS2307: Cannot find module '../package.json'.
|
||||
node_modules/npm/bin/npm-cli.js(54,7): error TS2339: Property 'argv' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/bin/npm-cli.js(55,11): error TS2339: Property 'deref' does not exist on type 'EventEmitter'.
|
||||
@@ -63,7 +62,6 @@ node_modules/npm/lib/build.js(95,32): error TS2339: Property 'config' does not e
|
||||
node_modules/npm/lib/build.js(101,11): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/build.js(106,12): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/cache.js(16,34): error TS2339: Property 'commands' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/cache.js(40,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/cache"' because it is not a variable.
|
||||
node_modules/npm/lib/cache.js(49,30): error TS2339: Property 'prefix' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/cache.js(69,35): error TS2339: Property 'cache' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/cache.js(70,12): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
@@ -443,7 +441,6 @@ node_modules/npm/lib/logout.js(17,7): error TS2339: Property 'config' does not e
|
||||
node_modules/npm/lib/logout.js(23,26): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/logout.js(28,11): error TS2339: Property 'registry' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/logout.js(38,10): error TS2554: Expected 0-1 arguments, but got 3.
|
||||
node_modules/npm/lib/ls.js(7,18): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/ls"' because it is not a variable.
|
||||
node_modules/npm/lib/ls.js(37,30): error TS2339: Property 'dir' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/ls.js(88,18): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/ls.js(89,18): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
@@ -474,9 +471,8 @@ node_modules/npm/lib/ls.js(522,18): error TS2339: Property 'config' does not exi
|
||||
node_modules/npm/lib/ls.js(528,19): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/ls.js(538,12): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/ls.js(544,56): error TS2339: Property 'globalDir' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/npm.js(4,14): error TS2304: Cannot find name 'WScript'.
|
||||
node_modules/npm/lib/npm.js(5,5): error TS2304: Cannot find name 'WScript'.
|
||||
node_modules/npm/lib/npm.js(12,5): error TS2304: Cannot find name 'WScript'.
|
||||
node_modules/npm/lib/npm.js(5,13): error TS2551: Property 'echo' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Echo'?
|
||||
node_modules/npm/lib/npm.js(12,13): error TS2551: Property 'quit' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Quit'?
|
||||
node_modules/npm/lib/npm.js(30,14): error TS2345: Argument of type '"log"' is not assignable to parameter of type 'Signals'.
|
||||
node_modules/npm/lib/npm.js(58,7): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/npm.js(68,7): error TS2339: Property 'commands' does not exist on type 'EventEmitter'.
|
||||
@@ -627,7 +623,6 @@ node_modules/npm/lib/run-script.js(77,21): error TS2345: Argument of type 'strin
|
||||
node_modules/npm/lib/run-script.js(94,13): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/run-script.js(99,13): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/run-script.js(148,22): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/search.js(3,18): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/search"' because it is not a variable.
|
||||
node_modules/npm/lib/search.js(25,22): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/search.js(26,34): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/search.js(27,40): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
@@ -652,7 +647,6 @@ node_modules/npm/lib/search/format-package-stream.js(130,63): error TS2339: Prop
|
||||
node_modules/npm/lib/set.js(8,22): error TS2339: Property 'commands' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/set.js(12,7): error TS2339: Property 'commands' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/shrinkwrap.js(30,29): error TS2339: Property 'lockfileVersion' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/shrinkwrap.js(36,18): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/shrinkwrap"' because it is not a variable.
|
||||
node_modules/npm/lib/shrinkwrap.js(48,22): error TS2339: Property 'prefix' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/shrinkwrap.js(49,22): error TS2339: Property 'prefix' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/shrinkwrap.js(53,38): error TS2339: Property 'prefix' does not exist on type 'EventEmitter'.
|
||||
@@ -762,13 +756,10 @@ node_modules/npm/lib/utils/error-handler.js(236,7): error TS2322: Type 'string'
|
||||
node_modules/npm/lib/utils/error-message.js(66,37): error TS2339: Property 'prefix' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/error-message.js(295,24): error TS2339: Property 'version' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/error-message.js(296,25): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/gently-rm.js(4,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/utils/gently-rm"' because it is not a variable.
|
||||
node_modules/npm/lib/utils/git.js(9,17): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/is-windows-bash.js(3,53): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
node_modules/npm/lib/utils/lifecycle-cmd.js(1,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/utils/lifecycle-cmd"' because it is not a variable.
|
||||
node_modules/npm/lib/utils/lifecycle-cmd.js(8,9): error TS2339: Property 'commands' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/lifecycle.js(1,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/utils/lifecycle"' because it is not a variable.
|
||||
node_modules/npm/lib/utils/locker.js(16,23): error TS2339: Property 'cache' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/locker.js(22,29): error TS2339: Property 'cache' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/locker.js(27,18): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
@@ -792,7 +783,6 @@ node_modules/npm/lib/utils/parse-json.js(7,11): error TS2339: Property 'noExcept
|
||||
node_modules/npm/lib/utils/perf.js(9,12): error TS2345: Argument of type '"time"' is not assignable to parameter of type 'Signals'.
|
||||
node_modules/npm/lib/utils/perf.js(10,12): error TS2345: Argument of type '"timeEnd"' is not assignable to parameter of type 'Signals'.
|
||||
node_modules/npm/lib/utils/perf.js(21,18): error TS2345: Argument of type '"timing"' is not assignable to parameter of type '"removeListener"'.
|
||||
node_modules/npm/lib/utils/read-local-package.js(1,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npm/node_modules/npm/lib/utils/read-local-package"' because it is not a variable.
|
||||
node_modules/npm/lib/utils/read-local-package.js(7,11): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/read-local-package.js(9,29): error TS2339: Property 'prefix' does not exist on type 'EventEmitter'.
|
||||
node_modules/npm/lib/utils/spawn.js(26,8): error TS2339: Property 'file' does not exist on type 'Error'.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/npmlog/log.js(5,11): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/npmlog/node_modules/npmlog/log"' because it is not a variable.
|
||||
node_modules/npmlog/log.js(16,14): error TS2339: Property 'gauge' does not exist on type 'PropertyDescriptor'.
|
||||
node_modules/npmlog/log.js(16,26): error TS2339: Property 'gauge' does not exist on type 'PropertyDescriptor'.
|
||||
node_modules/npmlog/log.js(25,5): error TS2339: Property 'useColor' does not exist on type 'EventEmitter'.
|
||||
|
||||
@@ -6,94 +6,75 @@ node_modules/uglify-js/lib/ast.js(858,5): error TS2322: Type '{ [x: string]: any
|
||||
Object literal may only specify known properties, but '_visit' does not exist in type 'TreeWalker'. Did you mean to write 'visit'?
|
||||
node_modules/uglify-js/lib/compress.js(165,27): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(453,26): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(733,18): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(975,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(1001,51): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'true | ((node: any) => any)' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/compress.js(1085,53): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(1125,112): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/uglify-js/lib/compress.js(1126,29): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/uglify-js/lib/compress.js(1135,87): error TS2322: Type 'false' is not assignable to type 'number'.
|
||||
node_modules/uglify-js/lib/compress.js(1143,29): error TS2322: Type 'false' is not assignable to type 'never'.
|
||||
node_modules/uglify-js/lib/compress.js(1196,38): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(1289,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(1385,27): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(1417,26): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(1831,44): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(2009,19): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(2269,27): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(2767,13): error TS2322: Type 'string[]' is not assignable to type '() => boolean'.
|
||||
Type 'string[]' provides no match for the signature '(): boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(2769,13): error TS2322: Type 'string[]' is not assignable to type '() => boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(2771,13): error TS2322: Type 'string[]' is not assignable to type '() => boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(2773,13): error TS2322: Type 'string[]' is not assignable to type '() => boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(2775,13): error TS2322: Type 'string[]' is not assignable to type '() => boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(2777,13): error TS2322: Type 'string[]' is not assignable to type '() => boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(2779,16): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3006,23): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3019,33): error TS2322: Type '"f"' is not assignable to type 'boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(3156,18): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3166,33): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3170,32): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3176,40): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3185,41): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3202,14): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3204,40): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3212,33): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(3286,63): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3475,23): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3492,36): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(3498,38): error TS2339: Property 'set' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3502,40): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(3527,22): error TS2339: Property 'each' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3532,30): error TS2339: Property 'del' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3537,30): error TS2339: Property 'set' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3548,41): error TS2339: Property 'has' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3550,48): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3562,41): error TS2339: Property 'has' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3564,48): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3648,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(3650,36): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3667,22): error TS2339: Property 'set' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3687,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead.
|
||||
node_modules/uglify-js/lib/compress.js(3712,30): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3863,22): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(4141,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(4225,22): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(4553,30): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(4560,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ [x: string]: any; get: () => string; toString: () => string; indent: () => void; indentation: (...'.
|
||||
node_modules/uglify-js/lib/compress.js(4564,36): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/uglify-js/lib/compress.js(4569,41): error TS2339: Property 'get' does not exist on type 'string'.
|
||||
node_modules/uglify-js/lib/compress.js(5043,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned.
|
||||
node_modules/uglify-js/lib/compress.js(5508,32): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5568,24): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5640,24): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5646,26): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5996,43): error TS2454: Variable 'property' is used before being assigned.
|
||||
node_modules/uglify-js/lib/compress.js(6010,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(6013,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'.
|
||||
node_modules/uglify-js/lib/compress.js(6020,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(6073,19): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/minify.js(148,75): error TS2339: Property 'compress' does not exist on type 'Compressor'.
|
||||
node_modules/uglify-js/lib/compress.js(722,18): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(964,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(990,51): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'true | ((node: any) => any)' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/compress.js(1074,53): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(1114,112): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/uglify-js/lib/compress.js(1115,29): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/uglify-js/lib/compress.js(1124,87): error TS2322: Type 'false' is not assignable to type 'number'.
|
||||
node_modules/uglify-js/lib/compress.js(1132,29): error TS2322: Type 'false' is not assignable to type 'never'.
|
||||
node_modules/uglify-js/lib/compress.js(1185,38): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(1278,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(1374,27): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(1406,26): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(1820,44): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(1998,19): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(2258,27): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(2998,23): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3011,33): error TS2322: Type '"f"' is not assignable to type 'boolean'.
|
||||
node_modules/uglify-js/lib/compress.js(3148,18): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3158,33): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3162,32): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3168,40): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3177,41): error TS2339: Property 'add' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3194,14): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3196,40): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3204,33): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(3278,63): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3467,23): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3484,36): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(3490,38): error TS2339: Property 'set' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3494,40): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
|
||||
node_modules/uglify-js/lib/compress.js(3519,22): error TS2339: Property 'each' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3524,30): error TS2339: Property 'del' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3529,30): error TS2339: Property 'set' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3540,41): error TS2339: Property 'has' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3542,48): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3554,41): error TS2339: Property 'has' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3556,48): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3640,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(3642,36): error TS2339: Property 'get' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3659,22): error TS2339: Property 'set' does not exist on type 'Dictionary'.
|
||||
node_modules/uglify-js/lib/compress.js(3679,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead.
|
||||
node_modules/uglify-js/lib/compress.js(3704,30): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(3855,22): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(4133,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(4217,22): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(4545,30): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(4552,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ [x: string]: any; get: () => string; toString: () => string; indent: () => void; indentation: (...'.
|
||||
node_modules/uglify-js/lib/compress.js(4556,36): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/uglify-js/lib/compress.js(4561,41): error TS2339: Property 'get' does not exist on type 'string'.
|
||||
node_modules/uglify-js/lib/compress.js(5040,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned.
|
||||
node_modules/uglify-js/lib/compress.js(5505,32): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5565,24): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5637,24): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5643,26): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/compress.js(5993,43): error TS2454: Variable 'property' is used before being assigned.
|
||||
node_modules/uglify-js/lib/compress.js(6007,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(6010,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'.
|
||||
node_modules/uglify-js/lib/compress.js(6017,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'.
|
||||
node_modules/uglify-js/lib/compress.js(6070,19): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/minify.js(166,75): error TS2339: Property 'compress' does not exist on type 'Compressor'.
|
||||
node_modules/uglify-js/lib/mozilla-ast.js(569,18): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/output.js(471,22): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/output.js(765,23): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/output.js(1177,29): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/output.js(1247,37): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/output.js(1359,20): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/parse.js(53,1): error TS2322: Type 'Function' is not assignable to type 'string'.
|
||||
node_modules/uglify-js/lib/parse.js(54,1): error TS2322: Type 'Function' is not assignable to type 'string'.
|
||||
node_modules/uglify-js/lib/parse.js(55,1): error TS2322: Type 'Function' is not assignable to type 'string'.
|
||||
node_modules/uglify-js/lib/parse.js(56,1): error TS2322: Type 'Function' is not assignable to type 'string'.
|
||||
node_modules/uglify-js/lib/parse.js(168,13): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/parse.js(296,50): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/output.js(473,22): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/output.js(767,23): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/output.js(1179,29): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/parse.js(365,20): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
|
||||
Type 'undefined' is not assignable to type 'number'.
|
||||
node_modules/uglify-js/lib/parse.js(447,32): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
|
||||
node_modules/uglify-js/lib/parse.js(458,32): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
|
||||
node_modules/uglify-js/lib/parse.js(479,13): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/parse.js(509,20): error TS2339: Property 'raw_source' does not exist on type 'RegExp'.
|
||||
node_modules/uglify-js/lib/parse.js(553,16): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/parse.js(554,16): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/parse.js(620,57): error TS2339: Property 'push' does not exist on type 'never'.
|
||||
node_modules/uglify-js/lib/parse.js(630,32): error TS2345: Argument of type 'never[]' is not assignable to parameter of type 'never'.
|
||||
node_modules/uglify-js/lib/parse.js(636,40): error TS2339: Property 'length' does not exist on type 'never'.
|
||||
@@ -111,7 +92,6 @@ node_modules/uglify-js/lib/parse.js(1097,9): error TS2322: Type 'any[]' is not a
|
||||
Type 'any' is not assignable to type 'never'.
|
||||
node_modules/uglify-js/lib/parse.js(1156,17): error TS2531: Object is possibly 'null'.
|
||||
node_modules/uglify-js/lib/parse.js(1324,32): error TS2531: Object is possibly 'null'.
|
||||
node_modules/uglify-js/lib/parse.js(1409,18): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
node_modules/uglify-js/lib/parse.js(1430,20): error TS2531: Object is possibly 'null'.
|
||||
node_modules/uglify-js/lib/parse.js(1516,48): error TS2531: Object is possibly 'null'.
|
||||
node_modules/uglify-js/lib/parse.js(1542,35): error TS2531: Object is possibly 'null'.
|
||||
@@ -126,11 +106,11 @@ node_modules/uglify-js/lib/propmangle.js(139,14): error TS2554: Expected 0 argum
|
||||
node_modules/uglify-js/lib/scope.js(104,14): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/scope.js(165,14): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/scope.js(202,19): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/scope.js(410,14): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/scope.js(411,14): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/scope.js(466,15): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/scope.js(491,15): error TS2554: Expected 0 arguments, but got 1.
|
||||
node_modules/uglify-js/lib/sourcemap.js(56,25): error TS2304: Cannot find name 'MOZ_SourceMap'.
|
||||
node_modules/uglify-js/lib/sourcemap.js(60,40): error TS2304: Cannot find name 'MOZ_SourceMap'.
|
||||
node_modules/uglify-js/lib/sourcemap.js(62,23): error TS2304: Cannot find name 'MOZ_SourceMap'.
|
||||
node_modules/uglify-js/lib/utils.js(73,38): error TS2339: Property 'message' does not exist on type 'PropertyDescriptor'.
|
||||
node_modules/uglify-js/lib/utils.js(74,29): error TS2339: Property 'name' does not exist on type 'PropertyDescriptor'.
|
||||
node_modules/uglify-js/tools/exit.js(2,12): error TS2454: Variable 'process' is used before being assigned.
|
||||
|
||||
@@ -253,7 +253,6 @@ node_modules/webpack/lib/WebpackOptionsValidationError.js(309,5): error TS2345:
|
||||
node_modules/webpack/lib/debug/ProfilingPlugin.js(2,28): error TS2307: Cannot find module 'chrome-trace-event'.
|
||||
node_modules/webpack/lib/debug/ProfilingPlugin.js(3,33): error TS2307: Cannot find module 'schema-utils'.
|
||||
node_modules/webpack/lib/debug/ProfilingPlugin.js(4,24): error TS2307: Cannot find module '../../schemas/plugins/debug/ProfilingPlugin.json'.
|
||||
node_modules/webpack/lib/debug/ProfilingPlugin.js(326,56): error TS8024: JSDoc '@param' tag has name 'opts', but there is no parameter with that name.
|
||||
node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js(296,8): error TS2339: Property 'localModule' does not exist on type 'AMDDefineDependency'.
|
||||
node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js(226,5): error TS2532: Object is possibly 'undefined'.
|
||||
node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js(226,9): error TS2339: Property 'functionBindThis' does not exist on type 'AMDRequireDependenciesBlock'.
|
||||
@@ -388,7 +387,6 @@ node_modules/webpack/lib/web/JsonpMainTemplate.runtime.js(31,37): error TS2304:
|
||||
node_modules/webpack/lib/web/JsonpMainTemplatePlugin.js(7,39): error TS2307: Cannot find module 'tapable'.
|
||||
node_modules/webpack/lib/webpack.js(14,38): error TS2307: Cannot find module '../schemas/WebpackOptions.json'.
|
||||
node_modules/webpack/lib/webpack.js(16,25): error TS2307: Cannot find module '../package.json'.
|
||||
node_modules/webpack/lib/webpack.js(63,1): error TS2539: Cannot assign to '"/home/nathansa/ts/tests/cases/user/webpack/node_modules/webpack/lib/webpack"' because it is not a variable.
|
||||
node_modules/webpack/lib/webworker/WebWorkerChunkTemplatePlugin.js(7,34): error TS2307: Cannot find module 'webpack-sources'.
|
||||
node_modules/webpack/lib/webworker/WebWorkerHotUpdateChunkTemplatePlugin.js(6,34): error TS2307: Cannot find module 'webpack-sources'.
|
||||
node_modules/webpack/lib/webworker/WebWorkerMainTemplate.runtime.js(9,3): error TS2304: Cannot find name 'hotAddUpdateChunk'.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// @checkJs: true
|
||||
// @allowJs: true
|
||||
// @outDir: ./dist
|
||||
// @filename: func.ts
|
||||
interface ComponentOptions<V> {
|
||||
watch: Record<string, WatchHandler<any>>;
|
||||
}
|
||||
type WatchHandler<T> = (val: T) => void;
|
||||
declare function extend(options: ComponentOptions<{}>): void;
|
||||
export var vextend = extend;
|
||||
// @filename: app.js
|
||||
import {vextend} from './func';
|
||||
// hover on vextend
|
||||
export var a = vextend({
|
||||
watch: {
|
||||
data1(val) {
|
||||
this.data2 = 1;
|
||||
},
|
||||
data2(val) { },
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
// @target: es6
|
||||
let { [Symbol.iterator]: destructured } = [];
|
||||
void destructured;
|
||||
|
||||
const named = "prop";
|
||||
|
||||
let { [named]: computed } = { prop: "b" };
|
||||
void computed;
|
||||
|
||||
const notPresent = "prop2";
|
||||
|
||||
let { [notPresent]: computed2 } = { prop: "b" };
|
||||
@@ -0,0 +1,4 @@
|
||||
/*
|
||||
/// <reference path="non-existing-file.d.ts" />
|
||||
*/
|
||||
void 0;
|
||||
@@ -0,0 +1,71 @@
|
||||
// @allowJS: true
|
||||
// @checkJS: true
|
||||
// @noEmit: true
|
||||
// @Filename: 0.js
|
||||
|
||||
// Object literal syntax
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} x
|
||||
*/
|
||||
function good1({a, b}, x) {}
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {{c: number, d: number}} OBJECTION
|
||||
*/
|
||||
function good2({a, b}, {c, d}) {}
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {{a: string, b: string}} obj
|
||||
* @param {string} y
|
||||
*/
|
||||
function good3(x, {a, b}, y) {}
|
||||
/**
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function good4({a, b}) {}
|
||||
|
||||
// nested object syntax
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a - this is like the saddest way to specify a type
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {string} x
|
||||
*/
|
||||
function good5({a, b}, x) {}
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - but it sure does allow a lot of documentation
|
||||
* @param {Object} OBJECTION - documentation here too
|
||||
* @param {string} OBJECTION.c
|
||||
* @param {string} OBJECTION.d - meh
|
||||
*/
|
||||
function good6({a, b}, {c, d}) {}
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
* @param {string} y
|
||||
*/
|
||||
function good7(x, {a, b}, y) {}
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b
|
||||
*/
|
||||
function good8({a, b}) {}
|
||||
|
||||
/**
|
||||
* @param {object} obj - this type gets ignored
|
||||
* @param {string} obj.a
|
||||
* @param {string} obj.b - and x's type gets used for both parameters
|
||||
* @param {string} x
|
||||
*/
|
||||
function bad1(x, {a, b}) {}
|
||||
/**
|
||||
* @param {string} y - here, y's type gets ignored but obj's is fine
|
||||
* @param {{a: string, b: string}} obj
|
||||
*/
|
||||
function bad2(x, {a, b}) {}
|
||||
@@ -0,0 +1,19 @@
|
||||
// @checkJs: true
|
||||
// @allowJS: true
|
||||
// @noEmit: true
|
||||
// @Filename: node.d.ts
|
||||
declare function require(name: string): any;
|
||||
declare var exports: any;
|
||||
declare var module: { exports: any };
|
||||
// @Filename: semver.js
|
||||
/// <reference path='node.d.ts' />
|
||||
exports = module.exports = C
|
||||
exports.f = n => n + 1
|
||||
function C() {
|
||||
this.p = 1
|
||||
}
|
||||
// @filename: index.js
|
||||
/// <reference path='node.d.ts' />
|
||||
const C = require("./semver")
|
||||
var two = C.f(1)
|
||||
var c = new C
|
||||
@@ -23,7 +23,7 @@
|
||||
////}
|
||||
|
||||
// @Filename: /node_modules/b/node_modules/x/package.json
|
||||
////{ "name": "x", "version": "1.2./*bVersionPatch*/3" }
|
||||
////{ "name": "x", "version": "1.2.3" }
|
||||
|
||||
// @Filename: /src/a.ts
|
||||
////import { a } from "a";
|
||||
@@ -40,7 +40,5 @@ const aImport = { definition: "(alias) class X\nimport X", ranges: [r0, r1] };
|
||||
const def = { definition: "class X", ranges: [r2] };
|
||||
const bImport = { definition: "(alias) class X\nimport X", ranges: [r3, r4] };
|
||||
verify.referenceGroups([r0, r1], [aImport, def, bImport]);
|
||||
verify.referenceGroups([r2], [def, aImport, bImport]);
|
||||
verify.referenceGroups([r2, r5], [def, aImport, bImport]);
|
||||
verify.referenceGroups([r3, r4], [bImport, def, aImport]);
|
||||
|
||||
verify.referenceGroups(r5, [def, aImport, bImport]);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public a: string;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a: string;
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public a?: string = "foo";/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a?: string = "foo";
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public a!: string = "foo";/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a!: string = "foo";
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public get a/*b*/ () { return 1; }
|
||||
//// /*c*/public set a/*d*/ (v) { }
|
||||
//// /*e*/public ['b']/*f*/ () { }
|
||||
//// /*g*/public ['c'] = 1;/*h*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
verify.not.refactorAvailable("Generate 'get' and 'set' accessors");
|
||||
|
||||
goTo.select("c", "d");
|
||||
verify.not.refactorAvailable("Generate 'get' and 'set' accessors");
|
||||
|
||||
goTo.select("e", "f");
|
||||
verify.not.refactorAvailable("Generate 'get' and 'set' accessors");
|
||||
|
||||
goTo.select("g", "h");
|
||||
verify.not.refactorAvailable("Generate 'get' and 'set' accessors");
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public static a: string = "foo";/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private static /*RENAME*/_a: string = "foo";
|
||||
public static get a(): string {
|
||||
return A._a;
|
||||
}
|
||||
public static set a(value: string) {
|
||||
A._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public readonly a: string = "foo";/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
verify.not.refactorAvailable("Generate 'get' and 'set' accessors");
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public _a: number = 1;/*b*/
|
||||
//// /*c*/public a: string = "foo";/*d*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/__a: number = 1;
|
||||
public get _a(): number {
|
||||
return this.__a;
|
||||
}
|
||||
public set _a(value: number) {
|
||||
this.__a = value;
|
||||
}
|
||||
public a: string = "foo";
|
||||
}`,
|
||||
});
|
||||
|
||||
goTo.select("c", "d");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private __a: number = 1;
|
||||
public get _a(): number {
|
||||
return this.__a;
|
||||
}
|
||||
public set _a(value: number) {
|
||||
this.__a = value;
|
||||
}
|
||||
private /*RENAME*/_a_1: string = "foo";
|
||||
public get a(): string {
|
||||
return this._a_1;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a_1 = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// constructor(public /*a*/a/*b*/: string) { }
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a: string;
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
constructor() { }
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// constructor(protected /*a*/a/*b*/: string) { }
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a: string;
|
||||
protected get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
protected set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
constructor() { }
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// constructor(private /*a*/a/*b*/: string) { }
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a: string;
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
constructor() { }
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// constructor(/*a*/a/*b*/: string) { }
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
verify.not.refactorAvailable("Generate 'get' and 'set' accessors");
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/protected a: string;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a: string;
|
||||
protected get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
protected set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// public a_1: number;
|
||||
//// /*a*/public a: string;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
public a_1: number;
|
||||
private /*RENAME*/_a: string;
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// public a_2: number;
|
||||
//// /*a*/public a_1: string;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
public a_2: number;
|
||||
private /*RENAME*/_a_1: string;
|
||||
public get a_1(): string {
|
||||
return this._a_1;
|
||||
}
|
||||
public set a_1(value: string) {
|
||||
this._a_1 = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// public a_1: number;
|
||||
//// constructor(public /*a*/a/*b*/: string) { }
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a: string;
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
public a_1: number;
|
||||
constructor() { }
|
||||
}`,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public _a: number = 1;/*b*/
|
||||
//// /*c*/public a: string = "foo";/*d*/
|
||||
//// }
|
||||
|
||||
goTo.select("c", "d");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
public _a: number = 1;
|
||||
private /*RENAME*/_a_1: string = "foo";
|
||||
public get a(): string {
|
||||
return this._a_1;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a_1 = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/__a: number = 1;
|
||||
public get _a(): number {
|
||||
return this.__a;
|
||||
}
|
||||
public set _a(value: number) {
|
||||
this.__a = value;
|
||||
}
|
||||
private _a_1: string = "foo";
|
||||
public get a(): string {
|
||||
return this._a_1;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a_1 = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public a: number = 1;/*b*/
|
||||
//// public _a: string = "foo";
|
||||
//// public _a_1: string = "bar";
|
||||
//// public _a_2: string = "baz";
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a_3: number = 1;
|
||||
public get a(): number {
|
||||
return this._a_3;
|
||||
}
|
||||
public set a(value: number) {
|
||||
this._a_3 = value;
|
||||
}
|
||||
public _a: string = "foo";
|
||||
public _a_1: string = "bar";
|
||||
public _a_2: string = "baz";
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// public /*a*/"a"/*b*/: number = 1;
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/"_a": number = 1;
|
||||
public get "a"(): number {
|
||||
return this["_a"];
|
||||
}
|
||||
public set "a"(value: number) {
|
||||
this["_a"] = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// public _a: string = "";
|
||||
//// /*a*/public "a": number = 1;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
public _a: string = "";
|
||||
private /*RENAME*/"_a_1": number = 1;
|
||||
public get "a"(): number {
|
||||
return this["_a_1"];
|
||||
}
|
||||
public set "a"(value: number) {
|
||||
this["_a_1"] = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public "a-b": number = 1;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/"_a-b": number = 1;
|
||||
public get "a-b"(): number {
|
||||
return this["_a-b"];
|
||||
}
|
||||
public set "a-b"(value: number) {
|
||||
this["_a-b"] = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/public static "a": number = 1;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private static /*RENAME*/"_a": number = 1;
|
||||
public static get "a"(): number {
|
||||
return A["_a"];
|
||||
}
|
||||
public static set "a"(value: number) {
|
||||
A["_a"] = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// const A = {
|
||||
//// /*a*/a/*b*/: 1
|
||||
//// };
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `const A = {
|
||||
/*RENAME*/_a: 1,
|
||||
get a() {
|
||||
return this._a;
|
||||
},
|
||||
set a(value) {
|
||||
this._a = value;
|
||||
},
|
||||
};`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// /*a*/private a: string;/*b*/
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a: string;
|
||||
public get a(): string {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value: string) {
|
||||
this._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// const A = {
|
||||
//// /*a*/'a'/*b*/: 1
|
||||
//// };
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `const A = {
|
||||
/*RENAME*/"_a": 1,
|
||||
get "a"() {
|
||||
return this["_a"];
|
||||
},
|
||||
set "a"(value) {
|
||||
this["_a"] = value;
|
||||
},
|
||||
};`,
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// public /*a*/a/*b*/ = 1;
|
||||
//// }
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Generate 'get' and 'set' accessors",
|
||||
actionName: "Generate 'get' and 'set' accessors",
|
||||
actionDescription: "Generate 'get' and 'set' accessors",
|
||||
newContent: `class A {
|
||||
private /*RENAME*/_a = 1;
|
||||
public get a() {
|
||||
return this._a;
|
||||
}
|
||||
public set a(value) {
|
||||
this._a = value;
|
||||
}
|
||||
}`,
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user