mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into dev/aozgaa/tsserverProjectTestOrganization
This commit is contained in:
+109
-64
@@ -251,6 +251,7 @@ namespace ts {
|
||||
getSuggestionForNonexistentProperty: (node, type) => getSuggestionForNonexistentProperty(node, type),
|
||||
getSuggestionForNonexistentSymbol: (location, name, meaning) => getSuggestionForNonexistentSymbol(location, escapeLeadingUnderscores(name), meaning),
|
||||
getBaseConstraintOfType,
|
||||
getDefaultFromTypeParameter: type => type && type.flags & TypeFlags.TypeParameter ? getDefaultFromTypeParameter(type as TypeParameter) : undefined,
|
||||
resolveName(name, location, meaning) {
|
||||
return resolveName(location, escapeLeadingUnderscores(name), meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
|
||||
},
|
||||
@@ -1897,13 +1898,17 @@ namespace ts {
|
||||
|
||||
function tryGetMemberInModuleExportsAndProperties(memberName: __String, moduleSymbol: Symbol): Symbol | undefined {
|
||||
const symbol = tryGetMemberInModuleExports(memberName, moduleSymbol);
|
||||
if (!symbol) {
|
||||
const exportEquals = resolveExternalModuleSymbol(moduleSymbol);
|
||||
if (exportEquals !== moduleSymbol) {
|
||||
return getPropertyOfType(getTypeOfSymbol(exportEquals), memberName);
|
||||
}
|
||||
if (symbol) {
|
||||
return symbol;
|
||||
}
|
||||
return symbol;
|
||||
|
||||
const exportEquals = resolveExternalModuleSymbol(moduleSymbol);
|
||||
if (exportEquals === moduleSymbol) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = getTypeOfSymbol(exportEquals);
|
||||
return type.flags & TypeFlags.Primitive ? undefined : getPropertyOfType(type, memberName);
|
||||
}
|
||||
|
||||
function getExportsOfSymbol(symbol: Symbol): SymbolTable {
|
||||
@@ -4229,7 +4234,7 @@ namespace ts {
|
||||
/** Return the inferred type for a binding element */
|
||||
function getTypeForBindingElement(declaration: BindingElement): Type {
|
||||
const pattern = declaration.parent;
|
||||
const parentType = getTypeForBindingElementParent(pattern.parent);
|
||||
let parentType = getTypeForBindingElementParent(pattern.parent);
|
||||
// If parent has the unknown (error) type, then so does this binding element
|
||||
if (parentType === unknownType) {
|
||||
return unknownType;
|
||||
@@ -4271,6 +4276,10 @@ namespace ts {
|
||||
// or otherwise the type of the string index signature.
|
||||
const text = 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)) {
|
||||
parentType = getNonNullableType(parentType);
|
||||
}
|
||||
const declaredType = getTypeOfPropertyOfType(parentType, text);
|
||||
type = declaredType && getFlowTypeOfReference(declaration, declaredType) ||
|
||||
isNumericLiteralName(text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
|
||||
@@ -4470,7 +4479,7 @@ namespace ts {
|
||||
jsDocType = declarationType;
|
||||
}
|
||||
else if (jsDocType !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(jsDocType, declarationType)) {
|
||||
errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, jsDocType, declaration, declarationType);
|
||||
errorNextVariableOrPropertyDeclarationMustHaveSameType(jsDocType, declaration, declarationType);
|
||||
}
|
||||
}
|
||||
else if (!jsDocType) {
|
||||
@@ -13039,7 +13048,7 @@ namespace ts {
|
||||
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
|
||||
// behavior of class names in ES6.
|
||||
if (declaration.kind === SyntaxKind.ClassDeclaration
|
||||
&& nodeIsDecorated(declaration)) {
|
||||
&& nodeIsDecorated(declaration as ClassDeclaration)) {
|
||||
let container = getContainingClass(node);
|
||||
while (container !== undefined) {
|
||||
if (container === declaration && container.name !== node) {
|
||||
@@ -15744,61 +15753,95 @@ namespace ts {
|
||||
* except for candidates:
|
||||
* * With no name
|
||||
* * Whose meaning doesn't match the `meaning` parameter.
|
||||
* * Whose length differs from the target name by more than 0.3 of the length of the name.
|
||||
* * Whose length differs from the target name by more than 0.34 of the length of the name.
|
||||
* * Whose levenshtein distance is more than 0.4 of the length of the name
|
||||
* (0.4 allows 1 substitution/transposition for every 5 characters,
|
||||
* and 1 insertion/deletion at 3 characters)
|
||||
* Names longer than 30 characters don't get suggestions because Levenshtein distance is an n**2 algorithm.
|
||||
*/
|
||||
function getSpellingSuggestionForName(name: string, symbols: Symbol[], meaning: SymbolFlags): Symbol | undefined {
|
||||
const worstDistance = name.length * 0.4;
|
||||
const maximumLengthDifference = Math.min(3, name.length * 0.34);
|
||||
let bestDistance = Number.MAX_VALUE;
|
||||
let bestCandidate = undefined;
|
||||
const maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
|
||||
let bestDistance = Math.floor(name.length * 0.4) + 1; // If the best result isn't better than this, don't bother.
|
||||
let bestCandidate: Symbol | undefined;
|
||||
let justCheckExactMatches = false;
|
||||
if (name.length > 30) {
|
||||
return undefined;
|
||||
}
|
||||
name = name.toLowerCase();
|
||||
const nameLowerCase = name.toLowerCase();
|
||||
for (const candidate of symbols) {
|
||||
let candidateName = symbolName(candidate);
|
||||
if (candidate.flags & meaning &&
|
||||
candidateName &&
|
||||
Math.abs(candidateName.length - name.length) < maximumLengthDifference) {
|
||||
candidateName = candidateName.toLowerCase();
|
||||
if (candidateName === name) {
|
||||
return candidate;
|
||||
}
|
||||
if (justCheckExactMatches) {
|
||||
continue;
|
||||
}
|
||||
if (candidateName.length < 3 ||
|
||||
name.length < 3 ||
|
||||
candidateName === "eval" ||
|
||||
candidateName === "intl" ||
|
||||
candidateName === "undefined" ||
|
||||
candidateName === "map" ||
|
||||
candidateName === "nan" ||
|
||||
candidateName === "set") {
|
||||
continue;
|
||||
}
|
||||
const distance = levenshtein(name, candidateName);
|
||||
if (distance > worstDistance) {
|
||||
continue;
|
||||
}
|
||||
if (distance < 3) {
|
||||
justCheckExactMatches = true;
|
||||
bestCandidate = candidate;
|
||||
}
|
||||
else if (distance < bestDistance) {
|
||||
bestDistance = distance;
|
||||
bestCandidate = candidate;
|
||||
}
|
||||
const candidateName = symbolName(candidate);
|
||||
if (!(candidate.flags & meaning && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference)) {
|
||||
continue;
|
||||
}
|
||||
const candidateNameLowerCase = candidateName.toLowerCase();
|
||||
if (candidateNameLowerCase === nameLowerCase) {
|
||||
return candidate;
|
||||
}
|
||||
if (justCheckExactMatches) {
|
||||
continue;
|
||||
}
|
||||
if (candidateName.length < 3) {
|
||||
// Don't bother, user would have noticed a 2-character name having an extra character
|
||||
continue;
|
||||
}
|
||||
// Only care about a result better than the best so far.
|
||||
const distance = levenshteinWithMax(nameLowerCase, candidateNameLowerCase, bestDistance - 1);
|
||||
if (distance === undefined) {
|
||||
continue;
|
||||
}
|
||||
if (distance < 3) {
|
||||
justCheckExactMatches = true;
|
||||
bestCandidate = candidate;
|
||||
}
|
||||
else {
|
||||
Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
|
||||
bestDistance = distance;
|
||||
bestCandidate = candidate;
|
||||
}
|
||||
}
|
||||
return bestCandidate;
|
||||
}
|
||||
|
||||
function levenshteinWithMax(s1: string, s2: string, max: number): number | undefined {
|
||||
let previous = new Array(s2.length + 1);
|
||||
let current = new Array(s2.length + 1);
|
||||
/** Represents any value > max. We don't care about the particular value. */
|
||||
const big = max + 1;
|
||||
|
||||
for (let i = 0; i <= s2.length; i++) {
|
||||
previous[i] = i;
|
||||
}
|
||||
|
||||
for (let i = 1; i <= s1.length; i++) {
|
||||
const c1 = s1.charCodeAt(i - 1);
|
||||
const minJ = i > max ? i - max : 1;
|
||||
const maxJ = s2.length > max + i ? max + i : s2.length;
|
||||
current[0] = i;
|
||||
/** Smallest value of the matrix in the ith column. */
|
||||
let colMin = i;
|
||||
for (let j = 1; j < minJ; j++) {
|
||||
current[j] = big;
|
||||
}
|
||||
for (let j = minJ; j <= maxJ; j++) {
|
||||
const dist = c1 === s2.charCodeAt(j - 1)
|
||||
? previous[j - 1]
|
||||
: Math.min(/*delete*/ previous[j] + 1, /*insert*/ current[j - 1] + 1, /*substitute*/ previous[j - 1] + 2);
|
||||
current[j] = dist;
|
||||
colMin = Math.min(colMin, dist);
|
||||
}
|
||||
for (let j = maxJ + 1; j <= s2.length; j++) {
|
||||
current[j] = big;
|
||||
}
|
||||
if (colMin > max) {
|
||||
// Give up -- everything in this column is > max and it can't get better in future columns.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const temp = previous;
|
||||
previous = current;
|
||||
current = temp;
|
||||
}
|
||||
|
||||
const res = previous[s2.length];
|
||||
return res > max ? undefined : res;
|
||||
}
|
||||
|
||||
function markPropertyAsReferenced(prop: Symbol, nodeForCheckWriteOnly: Node | undefined, isThisAccess: boolean) {
|
||||
if (prop &&
|
||||
noUnusedIdentifiers &&
|
||||
@@ -18271,6 +18314,12 @@ namespace ts {
|
||||
(kind & TypeFlags.NonPrimitive && isTypeAssignableTo(source, nonPrimitiveType));
|
||||
}
|
||||
|
||||
function allTypesAssignableToKind(source: Type, kind: TypeFlags, strict?: boolean): boolean {
|
||||
return source.flags & TypeFlags.Union ?
|
||||
every((source as UnionType).types, subType => allTypesAssignableToKind(subType, kind, strict)) :
|
||||
isTypeAssignableToKind(source, kind, strict);
|
||||
}
|
||||
|
||||
function isConstEnumObjectType(type: Type): boolean {
|
||||
return getObjectFlags(type) & ObjectFlags.Anonymous && type.symbol && isConstEnumSymbol(type.symbol);
|
||||
}
|
||||
@@ -18288,7 +18337,8 @@ namespace ts {
|
||||
// and the right operand to be of type Any, a subtype of the 'Function' interface type, or have a call or construct signature.
|
||||
// The result is always of the Boolean primitive type.
|
||||
// NOTE: do not raise error if leftType is unknown as related error was already reported
|
||||
if (!isTypeAny(leftType) && isTypeAssignableToKind(leftType, TypeFlags.Primitive)) {
|
||||
if (!isTypeAny(leftType) &&
|
||||
allTypesAssignableToKind(leftType, TypeFlags.Primitive)) {
|
||||
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
||||
}
|
||||
// NOTE: do not raise error if right is unknown as related error was already reported
|
||||
@@ -20647,7 +20697,7 @@ namespace ts {
|
||||
|
||||
// skip this check for nodes that cannot have decorators. These should have already had an error reported by
|
||||
// checkGrammarDecorators.
|
||||
if (!nodeCanBeDecorated(node)) {
|
||||
if (!nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21391,7 +21441,7 @@ namespace ts {
|
||||
// initializer is consistent with type associated with the node
|
||||
const declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node));
|
||||
if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) {
|
||||
errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
|
||||
errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
|
||||
}
|
||||
if (node.initializer) {
|
||||
checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined);
|
||||
@@ -21415,21 +21465,16 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, nextType: Type): void {
|
||||
const firstSourceFile = getSourceFileOfNode(firstDeclaration);
|
||||
const firstSpan = getErrorSpanForNode(firstSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration);
|
||||
const firstLocation = getLineAndCharacterOfPosition(firstSourceFile, firstSpan.start);
|
||||
const firstLocationDescription = firstSourceFile.fileName + " " + firstLocation.line + ":" + firstLocation.character;
|
||||
function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType: Type, nextDeclaration: Declaration, nextType: Type): void {
|
||||
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
||||
const message = nextDeclaration.kind === SyntaxKind.PropertyDeclaration || nextDeclaration.kind === SyntaxKind.PropertySignature
|
||||
? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_has_type_1_at_2_but_here_has_type_3
|
||||
: Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_has_type_1_at_2_but_here_has_type_3;
|
||||
? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
|
||||
: Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
|
||||
error(
|
||||
nextDeclarationName,
|
||||
message,
|
||||
declarationNameToString(nextDeclarationName),
|
||||
typeToString(firstType),
|
||||
firstLocationDescription,
|
||||
typeToString(nextType));
|
||||
}
|
||||
|
||||
@@ -25153,7 +25198,7 @@ namespace ts {
|
||||
if (!node.decorators) {
|
||||
return false;
|
||||
}
|
||||
if (!nodeCanBeDecorated(node)) {
|
||||
if (!nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
|
||||
if (node.kind === SyntaxKind.MethodDeclaration && !nodeIsPresent((<MethodDeclaration>node).body)) {
|
||||
return grammarErrorOnFirstToken(node, Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
|
||||
}
|
||||
|
||||
+10
-4
@@ -2758,6 +2758,12 @@ namespace ts {
|
||||
VeryAggressive = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* Safer version of `Function` which should not be called.
|
||||
* Every function should be assignable to this, but this should not be assignable to every function.
|
||||
*/
|
||||
export type AnyFunction = (...args: never[]) => void;
|
||||
|
||||
export namespace Debug {
|
||||
export let currentAssertionLevel = AssertionLevel.None;
|
||||
export let isDebugging = false;
|
||||
@@ -2766,7 +2772,7 @@ namespace ts {
|
||||
return currentAssertionLevel >= level;
|
||||
}
|
||||
|
||||
export function assert(expression: boolean, message?: string, verboseDebugInfo?: string | (() => string), stackCrawlMark?: Function): void {
|
||||
export function assert(expression: boolean, message?: string, verboseDebugInfo?: string | (() => string), stackCrawlMark?: AnyFunction): void {
|
||||
if (!expression) {
|
||||
if (verboseDebugInfo) {
|
||||
message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
|
||||
@@ -2800,7 +2806,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function fail(message?: string, stackCrawlMark?: Function): never {
|
||||
export function fail(message?: string, stackCrawlMark?: AnyFunction): never {
|
||||
debugger;
|
||||
const e = new Error(message ? `Debug Failure. ${message}` : "Debug Failure.");
|
||||
if ((<any>Error).captureStackTrace) {
|
||||
@@ -2809,11 +2815,11 @@ namespace ts {
|
||||
throw e;
|
||||
}
|
||||
|
||||
export function assertNever(member: never, message?: string, stackCrawlMark?: Function): never {
|
||||
export function assertNever(member: never, message?: string, stackCrawlMark?: AnyFunction): never {
|
||||
return fail(message || `Illegal value: ${member}`, stackCrawlMark || assertNever);
|
||||
}
|
||||
|
||||
export function getFunctionName(func: Function) {
|
||||
export function getFunctionName(func: AnyFunction) {
|
||||
if (typeof func !== "function") {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1344,7 +1344,7 @@
|
||||
"category": "Error",
|
||||
"code": 2402
|
||||
},
|
||||
"Subsequent variable declarations must have the same type. Variable '{0}' has type '{1}' at {2}, but here has type '{3}'.": {
|
||||
"Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2403
|
||||
},
|
||||
@@ -2264,7 +2264,7 @@
|
||||
"category": "Error",
|
||||
"code": 2716
|
||||
},
|
||||
"Subsequent property declarations must have the same type. Property '{0}' has type '{1}' at {2}, but here has type '{3}'.": {
|
||||
"Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2717
|
||||
},
|
||||
@@ -2606,7 +2606,7 @@
|
||||
"category": "Error",
|
||||
"code": 4102
|
||||
},
|
||||
|
||||
|
||||
"The current host does not support the '{0}' option.": {
|
||||
"category": "Error",
|
||||
"code": 5001
|
||||
|
||||
@@ -1261,7 +1261,7 @@ namespace ts {
|
||||
* the class.
|
||||
*/
|
||||
function getDecoratedClassElements(node: ClassExpression | ClassDeclaration, isStatic: boolean): ReadonlyArray<ClassElement> {
|
||||
return filter(node.members, isStatic ? isStaticDecoratedClassElement : isInstanceDecoratedClassElement);
|
||||
return filter(node.members, isStatic ? m => isStaticDecoratedClassElement(m, node) : m => isInstanceDecoratedClassElement(m, node));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1270,8 +1270,8 @@ namespace ts {
|
||||
*
|
||||
* @param member The class member.
|
||||
*/
|
||||
function isStaticDecoratedClassElement(member: ClassElement) {
|
||||
return isDecoratedClassElement(member, /*isStatic*/ true);
|
||||
function isStaticDecoratedClassElement(member: ClassElement, parent: ClassLikeDeclaration) {
|
||||
return isDecoratedClassElement(member, /*isStatic*/ true, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1280,8 +1280,8 @@ namespace ts {
|
||||
*
|
||||
* @param member The class member.
|
||||
*/
|
||||
function isInstanceDecoratedClassElement(member: ClassElement) {
|
||||
return isDecoratedClassElement(member, /*isStatic*/ false);
|
||||
function isInstanceDecoratedClassElement(member: ClassElement, parent: ClassLikeDeclaration) {
|
||||
return isDecoratedClassElement(member, /*isStatic*/ false, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1290,8 +1290,8 @@ namespace ts {
|
||||
*
|
||||
* @param member The class member.
|
||||
*/
|
||||
function isDecoratedClassElement(member: ClassElement, isStatic: boolean) {
|
||||
return nodeOrChildIsDecorated(member)
|
||||
function isDecoratedClassElement(member: ClassElement, isStatic: boolean, parent: ClassLikeDeclaration) {
|
||||
return nodeOrChildIsDecorated(member, parent)
|
||||
&& isStatic === hasModifier(member, ModifierFlags.Static);
|
||||
}
|
||||
|
||||
|
||||
+11
-5
@@ -2766,12 +2766,16 @@ namespace ts {
|
||||
getAmbientModules(): Symbol[];
|
||||
|
||||
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
||||
/** Unlike `tryGetMemberInModuleExports`, this includes properties of an `export =` value. */
|
||||
/**
|
||||
* Unlike `tryGetMemberInModuleExports`, this includes properties of an `export =` value.
|
||||
* Does *not* return properties of primitive types.
|
||||
*/
|
||||
/* @internal */ tryGetMemberInModuleExportsAndProperties(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
||||
getApparentType(type: Type): Type;
|
||||
getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined;
|
||||
getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined;
|
||||
/* @internal */ getBaseConstraintOfType(type: Type): Type | undefined;
|
||||
getBaseConstraintOfType(type: Type): Type | undefined;
|
||||
getDefaultFromTypeParameter(type: Type): Type | undefined;
|
||||
|
||||
/* @internal */ getAnyType(): Type;
|
||||
/* @internal */ getStringType(): Type;
|
||||
@@ -3575,15 +3579,17 @@ namespace ts {
|
||||
|
||||
export interface TypeVariable extends Type {
|
||||
/* @internal */
|
||||
resolvedBaseConstraint: Type;
|
||||
resolvedBaseConstraint?: Type;
|
||||
/* @internal */
|
||||
resolvedIndexType: IndexType;
|
||||
resolvedIndexType?: IndexType;
|
||||
}
|
||||
|
||||
// Type parameters (TypeFlags.TypeParameter)
|
||||
export interface TypeParameter extends TypeVariable {
|
||||
/** Retrieve using getConstraintFromTypeParameter */
|
||||
constraint: Type; // Constraint
|
||||
/* @internal */
|
||||
constraint?: Type; // Constraint
|
||||
/* @internal */
|
||||
default?: Type;
|
||||
/* @internal */
|
||||
target?: TypeParameter; // Instantiation target
|
||||
|
||||
+26
-38
@@ -1205,7 +1205,10 @@ namespace ts {
|
||||
return (<CallExpression | Decorator>node).expression;
|
||||
}
|
||||
|
||||
export function nodeCanBeDecorated(node: Node): boolean {
|
||||
export function nodeCanBeDecorated(node: ClassDeclaration): true;
|
||||
export function nodeCanBeDecorated(node: ClassElement, parent: Node): boolean;
|
||||
export function nodeCanBeDecorated(node: Node, parent: Node, grandparent: Node): boolean;
|
||||
export function nodeCanBeDecorated(node: Node, parent?: Node, grandparent?: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
// classes are valid targets
|
||||
@@ -1213,43 +1216,51 @@ namespace ts {
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
// property declarations are valid if their parent is a class declaration.
|
||||
return node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
return parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
// if this method has a body and its parent is a class declaration, this is a valid target.
|
||||
return (<FunctionLikeDeclaration>node).body !== undefined
|
||||
&& node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
&& parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
|
||||
return (<FunctionLikeDeclaration>node.parent).body !== undefined
|
||||
&& (node.parent.kind === SyntaxKind.Constructor
|
||||
|| node.parent.kind === SyntaxKind.MethodDeclaration
|
||||
|| node.parent.kind === SyntaxKind.SetAccessor)
|
||||
&& node.parent.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
return (<FunctionLikeDeclaration>parent).body !== undefined
|
||||
&& (parent.kind === SyntaxKind.Constructor
|
||||
|| parent.kind === SyntaxKind.MethodDeclaration
|
||||
|| parent.kind === SyntaxKind.SetAccessor)
|
||||
&& grandparent.kind === SyntaxKind.ClassDeclaration;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function nodeIsDecorated(node: Node): boolean {
|
||||
export function nodeIsDecorated(node: ClassDeclaration): boolean;
|
||||
export function nodeIsDecorated(node: ClassElement, parent: Node): boolean;
|
||||
export function nodeIsDecorated(node: Node, parent: Node, grandparent: Node): boolean;
|
||||
export function nodeIsDecorated(node: Node, parent?: Node, grandparent?: Node): boolean {
|
||||
return node.decorators !== undefined
|
||||
&& nodeCanBeDecorated(node);
|
||||
&& nodeCanBeDecorated(node, parent, grandparent);
|
||||
}
|
||||
|
||||
export function nodeOrChildIsDecorated(node: Node): boolean {
|
||||
return nodeIsDecorated(node) || childIsDecorated(node);
|
||||
export function nodeOrChildIsDecorated(node: ClassDeclaration): boolean;
|
||||
export function nodeOrChildIsDecorated(node: ClassElement, parent: Node): boolean;
|
||||
export function nodeOrChildIsDecorated(node: Node, parent: Node, grandparent: Node): boolean;
|
||||
export function nodeOrChildIsDecorated(node: Node, parent?: Node, grandparent?: Node): boolean {
|
||||
return nodeIsDecorated(node, parent, grandparent) || childIsDecorated(node, parent);
|
||||
}
|
||||
|
||||
export function childIsDecorated(node: Node): boolean {
|
||||
export function childIsDecorated(node: ClassDeclaration): boolean;
|
||||
export function childIsDecorated(node: Node, parent: Node): boolean;
|
||||
export function childIsDecorated(node: Node, parent?: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return forEach((<ClassDeclaration>node).members, nodeOrChildIsDecorated);
|
||||
return forEach((<ClassDeclaration>node).members, m => nodeOrChildIsDecorated(m, node, parent));
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return forEach((<FunctionLikeDeclaration>node).parameters, nodeIsDecorated);
|
||||
return forEach((<FunctionLikeDeclaration>node).parameters, p => nodeIsDecorated(p, node, parent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3518,29 +3529,6 @@ namespace ts {
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function levenshtein(s1: string, s2: string): number {
|
||||
let previous: number[] = new Array(s2.length + 1);
|
||||
let current: number[] = new Array(s2.length + 1);
|
||||
for (let i = 0; i < s2.length + 1; i++) {
|
||||
previous[i] = i;
|
||||
current[i] = -1;
|
||||
}
|
||||
for (let i = 1; i < s1.length + 1; i++) {
|
||||
current[0] = i;
|
||||
for (let j = 1; j < s2.length + 1; j++) {
|
||||
current[j] = Math.min(
|
||||
previous[j] + 1,
|
||||
current[j - 1] + 1,
|
||||
previous[j - 1] + (s1[i - 1] === s2[j - 1] ? 0 : 2));
|
||||
}
|
||||
// shift current back to previous, and then reuse previous' array
|
||||
const tmp = previous;
|
||||
previous = current;
|
||||
current = tmp;
|
||||
}
|
||||
return previous[previous.length - 1];
|
||||
}
|
||||
|
||||
export function skipAlias(symbol: Symbol, checker: TypeChecker) {
|
||||
return symbol.flags & SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Utils {
|
||||
return content;
|
||||
}
|
||||
|
||||
export function memoize<T extends Function>(f: T, memoKey: (...anything: any[]) => string): T {
|
||||
export function memoize<T extends ts.AnyFunction>(f: T, memoKey: (...anything: any[]) => string): T {
|
||||
const cache = ts.createMap<any>();
|
||||
|
||||
return <any>(function(this: any, ...args: any[]) {
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace Playback {
|
||||
};
|
||||
}
|
||||
|
||||
function recordReplay<T extends Function>(original: T, underlying: any) {
|
||||
function recordReplay<T extends ts.AnyFunction>(original: T, underlying: any) {
|
||||
function createWrapper(record: T, replay: T): T {
|
||||
// tslint:disable-next-line only-arrow-functions
|
||||
return <any>(function () {
|
||||
|
||||
@@ -2,7 +2,10 @@ namespace Harness.Parallel.Worker {
|
||||
let errors: ErrorInfo[] = [];
|
||||
let passing = 0;
|
||||
|
||||
type Executor = {name: string, callback: Function, kind: "suite" | "test"} | never;
|
||||
type MochaCallback = (this: Mocha.ISuiteCallbackContext, done: MochaDone) => void;
|
||||
type Callable = () => void;
|
||||
|
||||
type Executor = {name: string, callback: MochaCallback, kind: "suite" | "test"} | never;
|
||||
|
||||
function resetShimHarnessAndExecute(runner: RunnerBase) {
|
||||
errors = [];
|
||||
@@ -15,7 +18,7 @@ namespace Harness.Parallel.Worker {
|
||||
}
|
||||
|
||||
|
||||
let beforeEachFunc: Function;
|
||||
let beforeEachFunc: Callable;
|
||||
const namestack: string[] = [];
|
||||
let testList: Executor[] = [];
|
||||
function shimMochaHarness() {
|
||||
@@ -33,19 +36,19 @@ namespace Harness.Parallel.Worker {
|
||||
}) as Mocha.ITestDefinition;
|
||||
}
|
||||
|
||||
function executeSuiteCallback(name: string, callback: Function) {
|
||||
function executeSuiteCallback(name: string, callback: MochaCallback) {
|
||||
const fakeContext: Mocha.ISuiteCallbackContext = {
|
||||
retries() { return this; },
|
||||
slow() { return this; },
|
||||
timeout() { return this; },
|
||||
};
|
||||
namestack.push(name);
|
||||
let beforeFunc: Function;
|
||||
(before as any) = (cb: Function) => beforeFunc = cb;
|
||||
let afterFunc: Function;
|
||||
(after as any) = (cb: Function) => afterFunc = cb;
|
||||
let beforeFunc: Callable;
|
||||
(before as any) = (cb: Callable) => beforeFunc = cb;
|
||||
let afterFunc: Callable;
|
||||
(after as any) = (cb: Callable) => afterFunc = cb;
|
||||
const savedBeforeEach = beforeEachFunc;
|
||||
(beforeEach as any) = (cb: Function) => beforeEachFunc = cb;
|
||||
(beforeEach as any) = (cb: Callable) => beforeEachFunc = cb;
|
||||
const savedTestList = testList;
|
||||
|
||||
testList = [];
|
||||
@@ -90,7 +93,7 @@ namespace Harness.Parallel.Worker {
|
||||
}
|
||||
}
|
||||
|
||||
function executeCallback(name: string, callback: Function, kind: "suite" | "test") {
|
||||
function executeCallback(name: string, callback: MochaCallback, kind: "suite" | "test") {
|
||||
if (kind === "suite") {
|
||||
executeSuiteCallback(name, callback);
|
||||
}
|
||||
@@ -99,7 +102,7 @@ namespace Harness.Parallel.Worker {
|
||||
}
|
||||
}
|
||||
|
||||
function executeTestCallback(name: string, callback: Function) {
|
||||
function executeTestCallback(name: string, callback: MochaCallback) {
|
||||
const fakeContext: Mocha.ITestCallbackContext = {
|
||||
skip() { return this; },
|
||||
timeout() { return this; },
|
||||
@@ -238,7 +241,7 @@ namespace Harness.Parallel.Worker {
|
||||
}
|
||||
|
||||
const unittest: "unittest" = "unittest";
|
||||
let unitTests: {[name: string]: Function};
|
||||
let unitTests: {[name: string]: MochaCallback};
|
||||
function collectUnitTestsIfNeeded() {
|
||||
if (!unitTests && testList.length) {
|
||||
unitTests = {};
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
// Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test
|
||||
let oldPrepare: Function;
|
||||
let oldPrepare: AnyFunction;
|
||||
before(() => {
|
||||
oldPrepare = (Error as any).prepareStackTrace;
|
||||
delete (Error as any).prepareStackTrace;
|
||||
@@ -402,7 +402,7 @@ namespace ts.server {
|
||||
describe("exceptions", () => {
|
||||
|
||||
// Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test
|
||||
let oldPrepare: Function;
|
||||
let oldPrepare: AnyFunction;
|
||||
before(() => {
|
||||
oldPrepare = (Error as any).prepareStackTrace;
|
||||
delete (Error as any).prepareStackTrace;
|
||||
|
||||
@@ -224,6 +224,32 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// https://github.com/Microsoft/TypeScript/issues/17384
|
||||
testBaseline("transformAddDecoratedNode", () => {
|
||||
return ts.transpileModule("", {
|
||||
transformers: {
|
||||
before: [transformAddDecoratedNode],
|
||||
},
|
||||
compilerOptions: {
|
||||
target: ts.ScriptTarget.ES5,
|
||||
newLine: NewLineKind.CarriageReturnLineFeed,
|
||||
}
|
||||
}).outputText;
|
||||
|
||||
function transformAddDecoratedNode(_context: ts.TransformationContext) {
|
||||
return (sourceFile: ts.SourceFile): ts.SourceFile => {
|
||||
return visitNode(sourceFile);
|
||||
};
|
||||
function visitNode(sf: ts.SourceFile) {
|
||||
// produce `class Foo { @Bar baz() {} }`;
|
||||
const classDecl = ts.createClassDeclaration([], [], "Foo", /*typeParameters*/ undefined, /*heritageClauses*/ undefined, [
|
||||
ts.createMethod([ts.createDecorator(ts.createIdentifier("Bar"))], [], /**/ undefined, "baz", /**/ undefined, /**/ undefined, [], /**/ undefined, ts.createBlock([]))
|
||||
]);
|
||||
return ts.updateSourceFileNode(sf, [classDecl]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -4737,7 +4737,7 @@ namespace ts.projectSystem {
|
||||
|
||||
describe("cancellationToken", () => {
|
||||
// Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test
|
||||
let oldPrepare: Function;
|
||||
let oldPrepare: ts.AnyFunction;
|
||||
before(() => {
|
||||
oldPrepare = (Error as any).prepareStackTrace;
|
||||
delete (Error as any).prepareStackTrace;
|
||||
|
||||
@@ -309,6 +309,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[此上下文中不允许明确的赋值断言 "!"。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3765,32 +3768,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[从 {1} 导入 {0}。]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[导入“{0}”= 要求("{1}")。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[从“{1}”将 * 作为“{0}”导入。]]></Val>
|
||||
<Val><![CDATA[从模块“{1}”导入“{0}”。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -309,6 +309,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[此內容不允許明確的指派判斷提示 '!'。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3765,32 +3768,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[從 "{1}" 匯入 '{0}'。]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[匯入 '{0}' = 需要 ("{1}")。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[將 * 從 "{1}" 匯入成 '{0}' 。]]></Val>
|
||||
<Val><![CDATA[從模組 "{1}" 匯入 '{0}'。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -318,6 +318,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Určitý kontrolní výraz přiřazení '!' není v tomto kontextu povolený.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3774,32 +3777,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importujte {0} z: {1}.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importovat {0} = vyžadovat({1})]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importovat * jako {0} z {1}]]></Val>
|
||||
<Val><![CDATA[Import {0} z modulu {1}]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -309,6 +309,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Eine definitive Zuweisungsassertion "!" ist in diesem Kontext nicht zulässig.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3753,32 +3756,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importieren Sie "{0}" aus "{1}".]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA["{0}" importieren = require("{1}").]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[* als "{0}" aus "{1}" importieren]]></Val>
|
||||
<Val><![CDATA[Import von "{0}" aus Modul "{1}".]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -318,6 +318,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[En este contexto no se permite una aserción de asignación definitiva "!".]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3774,32 +3777,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importe "{0}" desde "{1}".]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importación de "{0}" = requiere ("{1}").]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importe * como "{0}" desde "{1}".]]></Val>
|
||||
<Val><![CDATA[Importar "{0}" desde el módulo "{1}".]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -318,6 +318,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Une assertion d'affectation définie ' !' n'est pas autorisée dans ce contexte.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3774,32 +3777,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importez '{0}' à partir de "{1}".]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importer '{0}' = require("{1}").]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importer * en tant que '{0}' à partir de "{1}".]]></Val>
|
||||
<Val><![CDATA[Importez '{0}' à partir du module "{1}".]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -309,6 +309,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[In questo contesto non sono consentite asserzioni di assegnazione definite '!'.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3765,32 +3768,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importare '{0}' da "{1}".]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importa '{0}' = obbligatorio ("{1}").]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importa * come '{0}' da "{1}".]]></Val>
|
||||
<Val><![CDATA[Importa '{0}' dal modulo "{1}".]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -309,6 +309,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[限定代入アサーション '!' は、このコンテキストで許可されていません。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3765,32 +3768,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA["{1}" から '{0}' をインポートします。]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}")。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}"。]]></Val>
|
||||
<Val><![CDATA[モジュール "{1}" から '{0}' をインポートします。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -309,6 +309,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[이 컨텍스트에서는 한정된 할당 어설션 '!'가 허용되지 않습니다.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3765,32 +3768,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA["{1}"에서 '{0}'을(를) 가져옵니다.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA['{0}' 가져오기 = 필수입니다("{1}").]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA["{1}"에서 '{0}'(으)로서 *를 가져옵니다.]]></Val>
|
||||
<Val><![CDATA["{1}" 모듈에서 '{0}'을(를) 가져옵니다.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -302,6 +302,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Asercja określonego przydziału „!” nie jest dozwolona w tym kontekście.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3746,32 +3749,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importuj element „{0}” z elementu „{1}”.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importuj „{0}” = wymagaj(„{1}”).]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importuj * jako „{0}” z „{1}”.]]></Val>
|
||||
<Val><![CDATA[Import „{0}” z modułu „{1}”.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -302,6 +302,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Uma declaração de atribuição definitiva '!' não é permitida neste contexto.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3746,32 +3749,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importar "{0}" de "{1}".]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importar '{0}' = exigir ("{1}").]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Importar * como '{0}' de "{1}".]]></Val>
|
||||
<Val><![CDATA[Importar '{0}' do módulo "{1}".]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -308,6 +308,9 @@
|
||||
<Item ItemId=";A_definite_assignment_assertion_is_not_permitted_in_this_context_1255" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[A definite assignment assertion '!' is not permitted in this context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Утверждение определенного присваивания "!" запрещено в этом контексте.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -3764,32 +3767,11 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_from_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Import_0_from_module_1_90013" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' from "{1}".]]></Val>
|
||||
<Val><![CDATA[Import '{0}' from module "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Импортируйте "{0}" из "{1}".]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Import {0} from {1}.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_0_require_1_95015" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import '{0}' = require("{1}").]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Import "{0}" = require("{1}").]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Import_Asterisk_as_0_from_1_95016" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import * as '{0}' from "{1}".]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Import * as "{0}" from "{1}".]]></Val>
|
||||
<Val><![CDATA[Импорт "{0}" из модуля "{1}".]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -209,8 +209,7 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
}
|
||||
actions.push(getCodeActionForAddImport(moduleSymbols, context, declarations));
|
||||
return actions;
|
||||
return [...actions, ...getCodeActionsForAddImport(moduleSymbols, context, declarations)];
|
||||
}
|
||||
|
||||
function getNamespaceImportName(declaration: AnyImportSyntax): Identifier {
|
||||
@@ -309,19 +308,84 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
|
||||
export function getModuleSpecifierForNewImport(sourceFile: SourceFile, moduleSymbols: ReadonlyArray<Symbol>, options: CompilerOptions, getCanonicalFileName: (file: string) => string, host: LanguageServiceHost): string | undefined {
|
||||
const choices = mapIterator(arrayIterator(moduleSymbols), moduleSymbol => {
|
||||
export function getModuleSpecifiersForNewImport(
|
||||
sourceFile: SourceFile,
|
||||
moduleSymbols: ReadonlyArray<Symbol>,
|
||||
options: CompilerOptions,
|
||||
getCanonicalFileName: (file: string) => string,
|
||||
host: LanguageServiceHost,
|
||||
): string[] {
|
||||
const { baseUrl, paths, rootDirs } = options;
|
||||
const choicesForEachExportingModule = mapIterator(arrayIterator(moduleSymbols), moduleSymbol => {
|
||||
const moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().fileName;
|
||||
const sourceDirectory = getDirectoryPath(sourceFile.fileName);
|
||||
const global = tryGetModuleNameFromAmbientModule(moduleSymbol)
|
||||
|| tryGetModuleNameFromTypeRoots(options, host, getCanonicalFileName, moduleFileName)
|
||||
|| tryGetModuleNameAsNodeModule(options, moduleFileName, host, getCanonicalFileName, sourceDirectory)
|
||||
|| rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName);
|
||||
if (global) {
|
||||
return [global];
|
||||
}
|
||||
|
||||
return tryGetModuleNameFromAmbientModule(moduleSymbol) ||
|
||||
tryGetModuleNameFromTypeRoots(options, host, getCanonicalFileName, moduleFileName) ||
|
||||
tryGetModuleNameAsNodeModule(options, moduleFileName, host, getCanonicalFileName, sourceDirectory) ||
|
||||
tryGetModuleNameFromBaseUrl(options, moduleFileName, getCanonicalFileName) ||
|
||||
options.rootDirs && tryGetModuleNameFromRootDirs(options.rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) ||
|
||||
removeExtensionAndIndexPostFix(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName), options);
|
||||
const relativePath = removeExtensionAndIndexPostFix(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName), options);
|
||||
if (!baseUrl) {
|
||||
return [relativePath];
|
||||
}
|
||||
|
||||
const relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseUrl, getCanonicalFileName);
|
||||
if (!relativeToBaseUrl) {
|
||||
return [relativePath];
|
||||
}
|
||||
|
||||
const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, options);
|
||||
if (paths) {
|
||||
const fromPaths = tryGetModuleNameFromPaths(removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
|
||||
if (fromPaths) {
|
||||
return [fromPaths];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Prefer a relative import over a baseUrl import if it doesn't traverse up to baseUrl.
|
||||
|
||||
Suppose we have:
|
||||
baseUrl = /base
|
||||
sourceDirectory = /base/a/b
|
||||
moduleFileName = /base/foo/bar
|
||||
Then:
|
||||
relativePath = ../../foo/bar
|
||||
getRelativePathNParents(relativePath) = 2
|
||||
pathFromSourceToBaseUrl = ../../
|
||||
getRelativePathNParents(pathFromSourceToBaseUrl) = 2
|
||||
2 < 2 = false
|
||||
In this case we should prefer using the baseUrl path "/a/b" instead of the relative path "../../foo/bar".
|
||||
|
||||
Suppose we have:
|
||||
baseUrl = /base
|
||||
sourceDirectory = /base/foo/a
|
||||
moduleFileName = /base/foo/bar
|
||||
Then:
|
||||
relativePath = ../a
|
||||
getRelativePathNParents(relativePath) = 1
|
||||
pathFromSourceToBaseUrl = ../../
|
||||
getRelativePathNParents(pathFromSourceToBaseUrl) = 2
|
||||
1 < 2 = true
|
||||
In this case we should prefer using the relative path "../a" instead of the baseUrl path "foo/a".
|
||||
*/
|
||||
const pathFromSourceToBaseUrl = getRelativePath(baseUrl, sourceDirectory, getCanonicalFileName);
|
||||
const relativeFirst = getRelativePathNParents(pathFromSourceToBaseUrl) < getRelativePathNParents(relativePath);
|
||||
return relativeFirst ? [relativePath, importRelativeToBaseUrl] : [importRelativeToBaseUrl, relativePath];
|
||||
});
|
||||
return best(choices, (a, b) => a.length < b.length);
|
||||
// Only return results for the re-export with the shortest possible path (and also give the other path even if that's long.)
|
||||
return best(choicesForEachExportingModule, (a, b) => a[0].length < b[0].length);
|
||||
}
|
||||
|
||||
function getRelativePathNParents(relativePath: string): number {
|
||||
let count = 0;
|
||||
for (let i = 0; i + 3 <= relativePath.length && relativePath.slice(i, i + 3) === "../"; i += 3) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function tryGetModuleNameFromAmbientModule(moduleSymbol: Symbol): string | undefined {
|
||||
@@ -331,44 +395,28 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
|
||||
function tryGetModuleNameFromBaseUrl(options: CompilerOptions, moduleFileName: string, getCanonicalFileName: (file: string) => string): string | undefined {
|
||||
if (!options.baseUrl) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let relativeName = getRelativePathIfInDirectory(moduleFileName, options.baseUrl, getCanonicalFileName);
|
||||
if (!relativeName) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const relativeNameWithIndex = removeFileExtension(relativeName);
|
||||
relativeName = removeExtensionAndIndexPostFix(relativeName, options);
|
||||
|
||||
if (options.paths) {
|
||||
for (const key in options.paths) {
|
||||
for (const pattern of options.paths[key]) {
|
||||
const indexOfStar = pattern.indexOf("*");
|
||||
if (indexOfStar === 0 && pattern.length === 1) {
|
||||
continue;
|
||||
}
|
||||
else if (indexOfStar !== -1) {
|
||||
const prefix = pattern.substr(0, indexOfStar);
|
||||
const suffix = pattern.substr(indexOfStar + 1);
|
||||
if (relativeName.length >= prefix.length + suffix.length &&
|
||||
startsWith(relativeName, prefix) &&
|
||||
endsWith(relativeName, suffix)) {
|
||||
const matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length);
|
||||
return key.replace("\*", matchedStar);
|
||||
}
|
||||
}
|
||||
else if (pattern === relativeName || pattern === relativeNameWithIndex) {
|
||||
return key;
|
||||
function tryGetModuleNameFromPaths(relativeNameWithIndex: string, relativeName: string, paths: MapLike<ReadonlyArray<string>>): string | undefined {
|
||||
for (const key in paths) {
|
||||
for (const pattern of paths[key]) {
|
||||
const indexOfStar = pattern.indexOf("*");
|
||||
if (indexOfStar === 0 && pattern.length === 1) {
|
||||
continue;
|
||||
}
|
||||
else if (indexOfStar !== -1) {
|
||||
const prefix = pattern.substr(0, indexOfStar);
|
||||
const suffix = pattern.substr(indexOfStar + 1);
|
||||
if (relativeName.length >= prefix.length + suffix.length &&
|
||||
startsWith(relativeName, prefix) &&
|
||||
endsWith(relativeName, suffix)) {
|
||||
const matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length);
|
||||
return key.replace("\*", matchedStar);
|
||||
}
|
||||
}
|
||||
else if (pattern === relativeName || pattern === relativeNameWithIndex) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return relativeName;
|
||||
}
|
||||
|
||||
function tryGetModuleNameFromRootDirs(rootDirs: ReadonlyArray<string>, moduleFileName: string, sourceDirectory: string, getCanonicalFileName: (file: string) => string): string | undefined {
|
||||
@@ -541,10 +589,11 @@ namespace ts.codefix {
|
||||
return !pathIsRelative(relativePath) ? "./" + relativePath : relativePath;
|
||||
}
|
||||
|
||||
function getCodeActionForAddImport(
|
||||
function getCodeActionsForAddImport(
|
||||
moduleSymbols: ReadonlyArray<Symbol>,
|
||||
ctx: ImportCodeFixOptions,
|
||||
declarations: ReadonlyArray<AnyImportSyntax>): ImportCodeAction {
|
||||
declarations: ReadonlyArray<AnyImportSyntax>
|
||||
): ImportCodeAction[] {
|
||||
const fromExistingImport = firstDefined(declarations, declaration => {
|
||||
if (declaration.kind === SyntaxKind.ImportDeclaration && declaration.importClause) {
|
||||
const changes = tryUpdateExistingImport(ctx, isImportClause(declaration.importClause) && declaration.importClause || undefined);
|
||||
@@ -560,12 +609,12 @@ namespace ts.codefix {
|
||||
}
|
||||
});
|
||||
if (fromExistingImport) {
|
||||
return fromExistingImport;
|
||||
return [fromExistingImport];
|
||||
}
|
||||
|
||||
const moduleSpecifier = firstDefined(declarations, moduleSpecifierFromAnyImport)
|
||||
|| getModuleSpecifierForNewImport(ctx.sourceFile, moduleSymbols, ctx.compilerOptions, ctx.getCanonicalFileName, ctx.host);
|
||||
return getCodeActionForNewImport(ctx, moduleSpecifier);
|
||||
const existingDeclaration = firstDefined(declarations, moduleSpecifierFromAnyImport);
|
||||
const moduleSpecifiers = existingDeclaration ? [existingDeclaration] : getModuleSpecifiersForNewImport(ctx.sourceFile, moduleSymbols, ctx.compilerOptions, ctx.getCanonicalFileName, ctx.host);
|
||||
return moduleSpecifiers.map(spec => getCodeActionForNewImport(ctx, spec));
|
||||
}
|
||||
|
||||
function moduleSpecifierFromAnyImport(node: AnyImportSyntax): string | undefined {
|
||||
|
||||
@@ -488,7 +488,7 @@ namespace ts.Completions {
|
||||
const moduleSymbols = getAllReExportingModules(exportedSymbol, checker, allSourceFiles);
|
||||
Debug.assert(contains(moduleSymbols, moduleSymbol));
|
||||
|
||||
const sourceDisplay = [textPart(codefix.getModuleSpecifierForNewImport(sourceFile, moduleSymbols, compilerOptions, getCanonicalFileName, host))];
|
||||
const sourceDisplay = [textPart(first(codefix.getModuleSpecifiersForNewImport(sourceFile, moduleSymbols, compilerOptions, getCanonicalFileName, host)))];
|
||||
const codeActions = codefix.getCodeActionForImport(moduleSymbols, {
|
||||
host,
|
||||
checker,
|
||||
|
||||
@@ -1427,10 +1427,7 @@ namespace ts.FindAllReferences.Core {
|
||||
// we should include both parameter declaration symbol and property declaration symbol
|
||||
// Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals.
|
||||
// Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members
|
||||
if (symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.Parameter &&
|
||||
isParameterPropertyDeclaration(<ParameterDeclaration>symbol.valueDeclaration)) {
|
||||
addRange(result, checker.getSymbolsOfParameterPropertyDeclaration(<ParameterDeclaration>symbol.valueDeclaration, symbol.name));
|
||||
}
|
||||
addRange(result, getParameterPropertySymbols(symbol, checker));
|
||||
|
||||
// If this is symbol of binding element without propertyName declaration in Object binding pattern
|
||||
// Include the property in the search
|
||||
@@ -1460,6 +1457,12 @@ namespace ts.FindAllReferences.Core {
|
||||
}
|
||||
}
|
||||
|
||||
function getParameterPropertySymbols(symbol: Symbol, checker: TypeChecker): Symbol[] {
|
||||
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isParameterPropertyDeclaration(symbol.valueDeclaration)
|
||||
? checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find symbol of the given property-name and add the symbol to the given result array
|
||||
* @param symbol a symbol to start searching for the given propertyName
|
||||
@@ -1519,17 +1522,26 @@ namespace ts.FindAllReferences.Core {
|
||||
}
|
||||
|
||||
function getRelatedSymbol(search: Search, referenceSymbol: Symbol, referenceLocation: Node, state: State): Symbol | undefined {
|
||||
const { checker } = state;
|
||||
if (search.includes(referenceSymbol)) {
|
||||
return referenceSymbol;
|
||||
}
|
||||
|
||||
if (referenceSymbol.flags & SymbolFlags.FunctionScopedVariable) {
|
||||
Debug.assert(!(referenceSymbol.flags & SymbolFlags.Property));
|
||||
const paramProps = getParameterPropertySymbols(referenceSymbol, checker);
|
||||
if (paramProps) {
|
||||
return getRelatedSymbol(search, find(paramProps, x => !!(x.flags & SymbolFlags.Property))!, referenceLocation, state);
|
||||
}
|
||||
}
|
||||
|
||||
// If the reference location is in an object literal, try to get the contextual type for the
|
||||
// object literal, lookup the property symbol in the contextual type, and use this symbol to
|
||||
// compare to our searchSymbol
|
||||
const containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation);
|
||||
if (containingObjectLiteralElement) {
|
||||
const contextualSymbol = forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, state.checker), contextualSymbol =>
|
||||
find(state.checker.getRootSymbols(contextualSymbol), search.includes));
|
||||
const contextualSymbol = forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), contextualSymbol =>
|
||||
find(checker.getRootSymbols(contextualSymbol), search.includes));
|
||||
|
||||
if (contextualSymbol) {
|
||||
return contextualSymbol;
|
||||
@@ -1539,7 +1551,7 @@ namespace ts.FindAllReferences.Core {
|
||||
// Get the property symbol from the object literal's type and look if thats the search symbol
|
||||
// In below eg. get 'property' from type of elems iterating type
|
||||
// for ( { property: p2 } of elems) { }
|
||||
const propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, state.checker);
|
||||
const propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, checker);
|
||||
if (propertySymbol && search.includes(propertySymbol)) {
|
||||
return propertySymbol;
|
||||
}
|
||||
@@ -1548,7 +1560,7 @@ namespace ts.FindAllReferences.Core {
|
||||
// If the reference location is the binding element and doesn't have property name
|
||||
// then include the binding element in the related symbols
|
||||
// let { a } : { a };
|
||||
const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, state.checker);
|
||||
const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, checker);
|
||||
if (bindingElementPropertySymbol) {
|
||||
const fromBindingElement = findRootSymbol(bindingElementPropertySymbol);
|
||||
if (fromBindingElement) return fromBindingElement;
|
||||
|
||||
@@ -472,6 +472,12 @@ namespace ts {
|
||||
getNonNullableType(): Type {
|
||||
return this.checker.getNonNullableType(this);
|
||||
}
|
||||
getConstraint(): Type | undefined {
|
||||
return this.checker.getBaseConstraintOfType(this);
|
||||
}
|
||||
getDefault(): Type | undefined {
|
||||
return this.checker.getDefaultFromTypeParameter(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SignatureObject implements Signature {
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace ts {
|
||||
getNumberIndexType(): Type | undefined;
|
||||
getBaseTypes(): BaseType[] | undefined;
|
||||
getNonNullableType(): Type;
|
||||
getConstraint(): Type | undefined;
|
||||
getDefault(): Type | undefined;
|
||||
}
|
||||
|
||||
export interface Signature {
|
||||
|
||||
@@ -1329,13 +1329,17 @@ namespace ts {
|
||||
return getTokenAtPosition(sourceFile, declaration.members.pos - 1, /*includeJsDocComment*/ false);
|
||||
}
|
||||
|
||||
export function getSourceFileImportLocation(node: SourceFile) {
|
||||
// For a source file, it is possible there are detached comments we should not skip
|
||||
const text = node.text;
|
||||
const textLength = text.length;
|
||||
let ranges = getLeadingCommentRanges(text, 0);
|
||||
if (!ranges) return 0;
|
||||
export function getSourceFileImportLocation({ text }: SourceFile) {
|
||||
const shebang = getShebang(text);
|
||||
let position = 0;
|
||||
if (shebang !== undefined) {
|
||||
position = shebang.length;
|
||||
advancePastLineBreak();
|
||||
}
|
||||
|
||||
// For a source file, it is possible there are detached comments we should not skip
|
||||
let ranges = getLeadingCommentRanges(text, position);
|
||||
if (!ranges) return position;
|
||||
// However we should still skip a pinned comment at the top
|
||||
if (ranges.length && ranges[0].kind === SyntaxKind.MultiLineCommentTrivia && isPinnedComment(text, ranges[0])) {
|
||||
position = ranges[0].end;
|
||||
@@ -1344,7 +1348,7 @@ namespace ts {
|
||||
}
|
||||
// As well as any triple slash references
|
||||
for (const range of ranges) {
|
||||
if (range.kind === SyntaxKind.SingleLineCommentTrivia && isRecognizedTripleSlashComment(node.text, range.pos, range.end)) {
|
||||
if (range.kind === SyntaxKind.SingleLineCommentTrivia && isRecognizedTripleSlashComment(text, range.pos, range.end)) {
|
||||
position = range.end;
|
||||
advancePastLineBreak();
|
||||
continue;
|
||||
@@ -1354,12 +1358,12 @@ namespace ts {
|
||||
return position;
|
||||
|
||||
function advancePastLineBreak() {
|
||||
if (position < textLength) {
|
||||
if (position < text.length) {
|
||||
const charCode = text.charCodeAt(position);
|
||||
if (isLineBreak(charCode)) {
|
||||
position++;
|
||||
|
||||
if (position < textLength && charCode === CharacterCodes.carriageReturn && text.charCodeAt(position) === CharacterCodes.lineFeed) {
|
||||
if (position < text.length && charCode === CharacterCodes.carriageReturn && text.charCodeAt(position) === CharacterCodes.lineFeed) {
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts 1:8, but here has type 'any[]'.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts (1 errors) ====
|
||||
@@ -9,5 +9,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS
|
||||
for (var v of []) {
|
||||
var x = [w, v];
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts 1:8, but here has type 'any[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'.
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/function.ts (0 errors) ====
|
||||
@@ -23,7 +23,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T
|
||||
var fn: () => { x: number; y: number };
|
||||
var fn = A.Point;
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
|
||||
|
||||
var cl: { x: number; y: number; }
|
||||
var cl = A.Point();
|
||||
@@ -45,7 +45,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T
|
||||
var fn: () => { x: number; y: number };
|
||||
var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
|
||||
|
||||
var cl: { x: number; y: number; }
|
||||
var cl = B.Point();
|
||||
|
||||
+4
-3
@@ -1783,6 +1783,8 @@ declare namespace ts {
|
||||
getApparentType(type: Type): Type;
|
||||
getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined;
|
||||
getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined;
|
||||
getBaseConstraintOfType(type: Type): Type | undefined;
|
||||
getDefaultFromTypeParameter(type: Type): Type | undefined;
|
||||
}
|
||||
enum NodeBuilderFlags {
|
||||
None = 0,
|
||||
@@ -2119,9 +2121,6 @@ declare namespace ts {
|
||||
interface TypeVariable extends Type {
|
||||
}
|
||||
interface TypeParameter extends TypeVariable {
|
||||
/** Retrieve using getConstraintFromTypeParameter */
|
||||
constraint: Type;
|
||||
default?: Type;
|
||||
}
|
||||
interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
@@ -3843,6 +3842,8 @@ declare namespace ts {
|
||||
getNumberIndexType(): Type | undefined;
|
||||
getBaseTypes(): BaseType[] | undefined;
|
||||
getNonNullableType(): Type;
|
||||
getConstraint(): Type | undefined;
|
||||
getDefault(): Type | undefined;
|
||||
}
|
||||
interface Signature {
|
||||
getDeclaration(): SignatureDeclaration;
|
||||
|
||||
+4
-3
@@ -1783,6 +1783,8 @@ declare namespace ts {
|
||||
getApparentType(type: Type): Type;
|
||||
getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined;
|
||||
getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined;
|
||||
getBaseConstraintOfType(type: Type): Type | undefined;
|
||||
getDefaultFromTypeParameter(type: Type): Type | undefined;
|
||||
}
|
||||
enum NodeBuilderFlags {
|
||||
None = 0,
|
||||
@@ -2119,9 +2121,6 @@ declare namespace ts {
|
||||
interface TypeVariable extends Type {
|
||||
}
|
||||
interface TypeParameter extends TypeVariable {
|
||||
/** Retrieve using getConstraintFromTypeParameter */
|
||||
constraint: Type;
|
||||
default?: Type;
|
||||
}
|
||||
interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
@@ -3843,6 +3842,8 @@ declare namespace ts {
|
||||
getNumberIndexType(): Type | undefined;
|
||||
getBaseTypes(): BaseType[] | undefined;
|
||||
getNonNullableType(): Type;
|
||||
getConstraint(): Type | undefined;
|
||||
getDefault(): Type | undefined;
|
||||
}
|
||||
interface Signature {
|
||||
getDeclaration(): SignatureDeclaration;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,18): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,24): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,33): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,40): error TS1109: Expression expected.
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es20
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,18): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,24): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,33): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,40): error TS1109: Expression expected.
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,18): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,24): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,33): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,40): error TS1109: Expression expected.
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,18): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,37): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,46): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,53): error TS1109: Expression expected.
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es20
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,18): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,37): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,46): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,53): error TS1109: Expression expected.
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,18): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,37): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,46): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,53): error TS1109: Expression expected.
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/augmentedTypesVar.ts(6,5): error TS2300: Duplicate identifier 'x2'.
|
||||
tests/cases/compiler/augmentedTypesVar.ts(7,10): error TS2300: Duplicate identifier 'x2'.
|
||||
tests/cases/compiler/augmentedTypesVar.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'number' at tests/cases/compiler/augmentedTypesVar.ts 8:4, but here has type '() => void'.
|
||||
tests/cases/compiler/augmentedTypesVar.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'.
|
||||
tests/cases/compiler/augmentedTypesVar.ts(13,5): error TS2300: Duplicate identifier 'x4'.
|
||||
tests/cases/compiler/augmentedTypesVar.ts(14,7): error TS2300: Duplicate identifier 'x4'.
|
||||
tests/cases/compiler/augmentedTypesVar.ts(16,5): error TS2300: Duplicate identifier 'x4a'.
|
||||
@@ -29,7 +29,7 @@ tests/cases/compiler/augmentedTypesVar.ts(31,8): error TS2300: Duplicate identif
|
||||
var x3 = 1;
|
||||
var x3 = () => { } // error
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'number' at tests/cases/compiler/augmentedTypesVar.ts 8:4, but here has type '() => void'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'.
|
||||
|
||||
// var then class
|
||||
var x4 = 1; // error
|
||||
|
||||
@@ -11,7 +11,7 @@ tests/cases/conformance/types/tuple/castingTuple.ts(30,10): error TS2352: Type '
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(31,10): error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'.
|
||||
Type 'C' is not comparable to type 'A'.
|
||||
Property 'a' is missing in type 'C'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' has type '{}[]' at tests/cases/conformance/types/tuple/castingTuple.ts 22:4, but here has type 'number[]'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(33,1): error TS2304: Cannot find name 't4'.
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ tests/cases/conformance/types/tuple/castingTuple.ts(33,1): error TS2304: Cannot
|
||||
!!! error TS2352: Property 'a' is missing in type 'C'.
|
||||
var array1 = <number[]>numStrTuple;
|
||||
~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' has type '{}[]' at tests/cases/conformance/types/tuple/castingTuple.ts 22:4, but here has type 'number[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
|
||||
t4[2] = 10;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 't4'.
|
||||
|
||||
@@ -2,7 +2,7 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(3,5): error TS2300: Duplica
|
||||
tests/cases/compiler/classWithDuplicateIdentifier.ts(6,5): error TS2300: Duplicate identifier 'b'.
|
||||
tests/cases/compiler/classWithDuplicateIdentifier.ts(7,5): error TS2300: Duplicate identifier 'b'.
|
||||
tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2300: Duplicate identifier 'c'.
|
||||
tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2717: Subsequent property declarations must have the same type. Property 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'.
|
||||
tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2717: Subsequent property declarations must have the same type. Property 'c' must be of type 'number', but here has type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classWithDuplicateIdentifier.ts (5 errors) ====
|
||||
@@ -26,6 +26,6 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2717: Subseq
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'c'.
|
||||
~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'c' must be of type 'number', but here has type 'string'.
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25):
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(58,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string | 1' at tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts 55:16, but here has type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(58,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | 1', but here has type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
@@ -99,7 +99,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
var x: number;
|
||||
var y: string;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string | 1' at tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts 55:16, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | 1', but here has type 'string'.
|
||||
}
|
||||
|
||||
function f8() {
|
||||
|
||||
@@ -16,7 +16,7 @@ tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate id
|
||||
tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2300: Duplicate identifier 'x2'.
|
||||
tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2717: Subsequent property declarations must have the same type. Property 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'.
|
||||
tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2717: Subsequent property declarations must have the same type. Property 'x2' must be of type 'number', but here has type 'any'.
|
||||
tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/duplicateClassElements.ts(36,9): error TS2300: Duplicate identifier 'z2'.
|
||||
tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -96,7 +96,7 @@ tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate i
|
||||
~~
|
||||
!!! error TS2300: Duplicate identifier 'x2'.
|
||||
~~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x2' must be of type 'number', but here has type 'any'.
|
||||
|
||||
get z2() {
|
||||
~~
|
||||
|
||||
@@ -4,7 +4,7 @@ tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(6,10): error TS2300: Dup
|
||||
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(8,9): error TS2300: Duplicate identifier 'w'.
|
||||
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(12,9): error TS2300: Duplicate identifier 'x'.
|
||||
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(13,14): error TS2300: Duplicate identifier 'x'.
|
||||
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'string' at tests/cases/compiler/duplicateIdentifierInCatchBlock.ts 14:8, but here has type 'number'.
|
||||
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateIdentifierInCatchBlock.ts (7 errors) ====
|
||||
@@ -37,5 +37,5 @@ tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Sub
|
||||
var p: string;
|
||||
var p: number; // error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'string' at tests/cases/compiler/duplicateIdentifierInCatchBlock.ts 14:8, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(1,4): error TS1005: ';' expected.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(1,11): error TS1146: Declaration expected.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(1,13): error TS2304: Cannot find name 'commonjs'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(186,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable1.ts 180:21, but here has type 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(186,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(186,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(186,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
|
||||
@@ -200,7 +200,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(186,37): error TS2356: An arithm
|
||||
var bytes = [];
|
||||
for (var i = 0; i < 14; i++) {
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable1.ts 180:21, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable2.ts 21:21, but here has type 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
|
||||
@@ -32,7 +32,7 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithme
|
||||
var bytes = [];
|
||||
for (var i = 0; i < 14; i++) {
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable2.ts 21:21, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateLocalVariable3.ts 9:8, but here has type 'string'.
|
||||
tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateLocalVariable3.ts (1 errors) ====
|
||||
@@ -14,5 +14,5 @@ tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent
|
||||
var z = 3;
|
||||
var z = "";
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateLocalVariable3.ts 9:8, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/duplicateLocalVariable4.ts 4:4, but here has type 'E'.
|
||||
tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateLocalVariable4.ts (1 errors) ====
|
||||
@@ -9,4 +9,4 @@ tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent v
|
||||
var x = E;
|
||||
var x = E.a;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/duplicateLocalVariable4.ts 4:4, but here has type 'E'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 1:4, but here has type 'number'.
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 4:4, but here has type 'any'.
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(10,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 8:8, but here has type 'number'.
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 11:8, but here has type 'any'.
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'.
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(10,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateVariablesWithAny.ts (4 errors) ====
|
||||
@@ -9,23 +9,23 @@ tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequen
|
||||
var x: any;
|
||||
var x = 2; //error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 1:4, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
|
||||
var y = "";
|
||||
var y; //error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 4:4, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'.
|
||||
|
||||
module N {
|
||||
var x: any;
|
||||
var x = 2; //error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 8:8, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
|
||||
var y = "";
|
||||
var y; //error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 11:8, but here has type 'any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'.
|
||||
}
|
||||
|
||||
var z: any;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'boolean'.
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'string'.
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 1:4, but here has type 'number'.
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts 1:4, but here has type 'boolean'.
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'.
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts (0 errors) ====
|
||||
@@ -11,19 +11,19 @@ tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403:
|
||||
==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts (1 errors) ====
|
||||
var x = true;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'boolean'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'.
|
||||
var z = 3;
|
||||
|
||||
==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts (3 errors) ====
|
||||
var x = "";
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'.
|
||||
var y = 3;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 1:4, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'.
|
||||
var z = false;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts 1:4, but here has type 'boolean'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'.
|
||||
|
||||
==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_3.ts (0 errors) ====
|
||||
var x = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/dynamicNamesErrors.ts(5,5): error TS2718: Duplicate declaration '[c0]'.
|
||||
tests/cases/compiler/dynamicNamesErrors.ts(6,5): error TS2718: Duplicate declaration '[c0]'.
|
||||
tests/cases/compiler/dynamicNamesErrors.ts(19,5): error TS2717: Subsequent property declarations must have the same type. Property '[c1]' has type 'number' at tests/cases/compiler/dynamicNamesErrors.ts 17:4, but here has type 'string'.
|
||||
tests/cases/compiler/dynamicNamesErrors.ts(19,5): error TS2717: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/compiler/dynamicNamesErrors.ts(24,1): error TS2322: Type 'T2' is not assignable to type 'T1'.
|
||||
Types of property '[c0]' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
@@ -50,7 +50,7 @@ tests/cases/compiler/dynamicNamesErrors.ts(54,14): error TS4025: Exported variab
|
||||
[c0]: number;
|
||||
[c1]: string;
|
||||
~~~~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property '[c1]' has type 'number' at tests/cases/compiler/dynamicNamesErrors.ts 17:4, but here has type 'string'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'.
|
||||
}
|
||||
|
||||
let t1: T1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(104,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(104,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts (2 errors) ====
|
||||
@@ -108,11 +108,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
|
||||
|
||||
var r4 = foo16(E.A);
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'.
|
||||
|
||||
declare function foo17(x: {}): {};
|
||||
declare function foo17(x: E): E;
|
||||
|
||||
var r4 = foo16(E.A);
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'.
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(33,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 30:17, but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(50,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 47:17, but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(33,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(50,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15):
|
||||
for (var x in this.biz) { }
|
||||
for (var x in this) { }
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 30:17, but here has type 'keyof this'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15):
|
||||
for (var x in this.biz) { }
|
||||
for (var x in this) { }
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 47:17, but here has type 'keyof this'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
|
||||
for (var x in super.biz) { }
|
||||
for (var x in super.biz()) { }
|
||||
|
||||
@@ -2,8 +2,8 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(5,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,9): error TS2365: Operator '===' cannot be applied to types 'string' and 'number'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(8,16): error TS2339: Property 'unknownProperty' does not exist on type 'string'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(12,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'number' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 10:4, but here has type 'string'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(16,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type 'any' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 14:4, but here has type 'string'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(12,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(16,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts (6 errors) ====
|
||||
@@ -28,12 +28,12 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.
|
||||
var i: number;
|
||||
for (var i in a ) {
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'number' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 10:4, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'.
|
||||
}
|
||||
|
||||
var j: any;
|
||||
for (var j in a ) {
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type 'any' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 14:4, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'.
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(1
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(20,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(22,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(29,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(31,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 28:17, but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(31,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(38,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(46,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(48,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 45:17, but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(48,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(51,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(62,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
|
||||
@@ -72,7 +72,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6
|
||||
for (var x in this.biz) { }
|
||||
for (var x in this) { }
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 28:17, but here has type 'keyof this'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6
|
||||
for (var x in this.biz) { }
|
||||
for (var x in this) { }
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 45:17, but here has type 'keyof this'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'.
|
||||
|
||||
for (var x in super.biz) { }
|
||||
for (var x in super.biz()) { }
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(32,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'number'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(33,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'string'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(34,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'C'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(35,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'D<string>'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(36,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'typeof M'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(39,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C2'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 41:8, but here has type '(x: number) => string'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type 'number[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type '(C | D<string>)[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D<string>[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 48:8, but here has type 'D<number>[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 51:8, but here has type 'typeof A'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(32,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(33,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(34,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(35,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D<string>'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(36,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(39,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D<string>[]', but here has type 'D<number>[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts (12 errors) ====
|
||||
@@ -46,47 +46,47 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec
|
||||
for( var a: any;;){}
|
||||
for( var a = 1;;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'.
|
||||
for( var a = 'a string';;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'.
|
||||
for( var a = new C();;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'C'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'.
|
||||
for( var a = new D<string>();;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'D<string>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D<string>'.
|
||||
for( var a = M;;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'typeof M'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'.
|
||||
|
||||
for( var b: I;;){}
|
||||
for( var b = new C();;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'.
|
||||
for( var b = new C2();;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C2'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'.
|
||||
|
||||
for(var f = F;;){}
|
||||
for( var f = (x: number) => '';;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 41:8, but here has type '(x: number) => string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'.
|
||||
|
||||
for(var arr: string[];;){}
|
||||
for( var arr = [1, 2, 3, 4];;){}
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type 'number[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
for( var arr = [new C(), new C2(), new D<string>()];;){}
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type '(C | D<string>)[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
|
||||
for(var arr2 = [new D<string>()];;){}
|
||||
for( var arr2 = new Array<D<number>>();;){}
|
||||
~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D<string>[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 48:8, but here has type 'D<number>[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D<string>[]', but here has type 'D<number>[]'.
|
||||
|
||||
for(var m: typeof M;;){}
|
||||
for( var m = M.A;;){}
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 51:8, but here has type 'typeof A'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'.
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/functionArgShadowing.ts(4,8): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'A' at tests/cases/compiler/functionArgShadowing.ts 2:13, but here has type 'B'.
|
||||
tests/cases/compiler/functionArgShadowing.ts(4,8): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'.
|
||||
tests/cases/compiler/functionArgShadowing.ts(5,8): error TS2339: Property 'bar' does not exist on type 'A'.
|
||||
tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'number' at tests/cases/compiler/functionArgShadowing.ts 8:20, but here has type 'string'.
|
||||
tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionArgShadowing.ts (3 errors) ====
|
||||
@@ -9,7 +9,7 @@ tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent var
|
||||
function foo(x: A) {
|
||||
var x: B = new B();
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'A' at tests/cases/compiler/functionArgShadowing.ts 2:13, but here has type 'B'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'.
|
||||
x.bar(); // the property bar does not exist on a value of type A
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'A'.
|
||||
@@ -19,7 +19,7 @@ tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent var
|
||||
constructor(public p: number) {
|
||||
var p: string;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'number' at tests/cases/compiler/functionArgShadowing.ts 8:20, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'.
|
||||
|
||||
var n: number = p;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'.
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2717: Subsequent property declarations must have the same type. Property 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'.
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2717: Subsequent property declarations must have the same type. Property 'Foo' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -23,7 +23,7 @@ tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'Foo'.
|
||||
~~~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'Foo' must be of type 'string', but here has type 'number'.
|
||||
public get Goo(v:string):string {return null;} // error - getters must not have a parameter
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'g' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 3:4, but here has type '<T>(x: any, y: any) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'h' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 6:4, but here has type '(x: any, y: any) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 9:4, but here has type '<T, U>(x: any, y: string) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 12:4, but here has type '<T, U>(x: any, y: any) => string'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T>(x: any, y: any) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '<T, U>(x: T, y: U) => T', but here has type '(x: any, y: any) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: string) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: any) => string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts (4 errors) ====
|
||||
@@ -11,19 +11,19 @@ tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): err
|
||||
var g: <T, U>(x: T, y: U) => T;
|
||||
var g: <T>(x: any, y: any) => any;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'g' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 3:4, but here has type '<T>(x: any, y: any) => any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T>(x: any, y: any) => any'.
|
||||
|
||||
var h: <T, U>(x: T, y: U) => T;
|
||||
var h: (x: any, y: any) => any;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'h' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 6:4, but here has type '(x: any, y: any) => any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '<T, U>(x: T, y: U) => T', but here has type '(x: any, y: any) => any'.
|
||||
|
||||
var i: <T, U>(x: T, y: U) => T;
|
||||
var i: <T, U>(x: any, y: string) => any;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 9:4, but here has type '<T, U>(x: any, y: string) => any'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: string) => any'.
|
||||
|
||||
var j: <T, U>(x: T, y: U) => T;
|
||||
var j: <T, U>(x: any, y: any) => string;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type '<T, U>(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 12:4, but here has type '<T, U>(x: any, y: any) => string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: any) => string'.
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [initializedParameterBeforeNonoptionalNotOptional.ts]
|
||||
export declare function foo({a}?: {
|
||||
a?: string;
|
||||
}): void;
|
||||
export declare function foo2({a}: {
|
||||
a?: string | undefined;
|
||||
} | undefined, b: string): void;
|
||||
|
||||
//// [initializedParameterBeforeNonoptionalNotOptional.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/compiler/index.d.ts ===
|
||||
export declare function foo({a}?: {
|
||||
>foo : Symbol(foo, Decl(index.d.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(index.d.ts, 0, 29))
|
||||
|
||||
a?: string;
|
||||
>a : Symbol(a, Decl(index.d.ts, 0, 35))
|
||||
|
||||
}): void;
|
||||
export declare function foo2({a}: {
|
||||
>foo2 : Symbol(foo2, Decl(index.d.ts, 2, 9))
|
||||
>a : Symbol(a, Decl(index.d.ts, 3, 30))
|
||||
|
||||
a?: string | undefined;
|
||||
>a : Symbol(a, Decl(index.d.ts, 3, 35))
|
||||
|
||||
} | undefined, b: string): void;
|
||||
>b : Symbol(b, Decl(index.d.ts, 5, 14))
|
||||
|
||||
export declare function foo3({a, b: {c}}: {
|
||||
>foo3 : Symbol(foo3, Decl(index.d.ts, 5, 32))
|
||||
>a : Symbol(a, Decl(index.d.ts, 6, 30))
|
||||
>c : Symbol(c, Decl(index.d.ts, 6, 37))
|
||||
|
||||
a?: string | undefined;
|
||||
>a : Symbol(a, Decl(index.d.ts, 6, 43))
|
||||
|
||||
b?: {c?: string | undefined;} | undefined;
|
||||
>b : Symbol(b, Decl(index.d.ts, 7, 27))
|
||||
>c : Symbol(c, Decl(index.d.ts, 8, 9))
|
||||
|
||||
} | undefined, b: string): void;
|
||||
>b : Symbol(b, Decl(index.d.ts, 9, 14))
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/compiler/index.d.ts ===
|
||||
export declare function foo({a}?: {
|
||||
>foo : ({ a }?: { a?: string | undefined; } | undefined) => void
|
||||
>a : string | undefined
|
||||
|
||||
a?: string;
|
||||
>a : string | undefined
|
||||
|
||||
}): void;
|
||||
export declare function foo2({a}: {
|
||||
>foo2 : ({ a }: { a?: string | undefined; } | undefined, b: string) => void
|
||||
>a : string | undefined
|
||||
|
||||
a?: string | undefined;
|
||||
>a : string | undefined
|
||||
|
||||
} | undefined, b: string): void;
|
||||
>b : string
|
||||
|
||||
export declare function foo3({a, b: {c}}: {
|
||||
>foo3 : ({ a, b: { c } }: { a?: string | undefined; b?: { c?: string | undefined; } | undefined; } | undefined, b: string) => void
|
||||
>a : string | undefined
|
||||
>b : any
|
||||
>c : string | undefined
|
||||
|
||||
a?: string | undefined;
|
||||
>a : string | undefined
|
||||
|
||||
b?: {c?: string | undefined;} | undefined;
|
||||
>b : { c?: string | undefined; } | undefined
|
||||
>c : string | undefined
|
||||
|
||||
} | undefined, b: string): void;
|
||||
>b : string
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
tests/cases/compiler/instanceofWithPrimitiveUnion.ts(2,9): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/compiler/instanceofWithPrimitiveUnion.ts(8,9): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
|
||||
|
||||
==== tests/cases/compiler/instanceofWithPrimitiveUnion.ts (2 errors) ====
|
||||
function test1(x: number | string) {
|
||||
if (x instanceof Object) {
|
||||
~
|
||||
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
x;
|
||||
}
|
||||
}
|
||||
|
||||
function test2(x: (number | string) | number) {
|
||||
if (x instanceof Object) {
|
||||
~
|
||||
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [instanceofWithPrimitiveUnion.ts]
|
||||
function test1(x: number | string) {
|
||||
if (x instanceof Object) {
|
||||
x;
|
||||
}
|
||||
}
|
||||
|
||||
function test2(x: (number | string) | number) {
|
||||
if (x instanceof Object) {
|
||||
x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [instanceofWithPrimitiveUnion.js]
|
||||
function test1(x) {
|
||||
if (x instanceof Object) {
|
||||
x;
|
||||
}
|
||||
}
|
||||
function test2(x) {
|
||||
if (x instanceof Object) {
|
||||
x;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
=== tests/cases/compiler/instanceofWithPrimitiveUnion.ts ===
|
||||
function test1(x: number | string) {
|
||||
>test1 : Symbol(test1, Decl(instanceofWithPrimitiveUnion.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(instanceofWithPrimitiveUnion.ts, 0, 15))
|
||||
|
||||
if (x instanceof Object) {
|
||||
>x : Symbol(x, Decl(instanceofWithPrimitiveUnion.ts, 0, 15))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
x;
|
||||
>x : Symbol(x, Decl(instanceofWithPrimitiveUnion.ts, 0, 15))
|
||||
}
|
||||
}
|
||||
|
||||
function test2(x: (number | string) | number) {
|
||||
>test2 : Symbol(test2, Decl(instanceofWithPrimitiveUnion.ts, 4, 1))
|
||||
>x : Symbol(x, Decl(instanceofWithPrimitiveUnion.ts, 6, 15))
|
||||
|
||||
if (x instanceof Object) {
|
||||
>x : Symbol(x, Decl(instanceofWithPrimitiveUnion.ts, 6, 15))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
x;
|
||||
>x : Symbol(x, Decl(instanceofWithPrimitiveUnion.ts, 6, 15))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/instanceofWithPrimitiveUnion.ts ===
|
||||
function test1(x: number | string) {
|
||||
>test1 : (x: string | number) => void
|
||||
>x : string | number
|
||||
|
||||
if (x instanceof Object) {
|
||||
>x instanceof Object : boolean
|
||||
>x : string | number
|
||||
>Object : ObjectConstructor
|
||||
|
||||
x;
|
||||
>x : string | number
|
||||
}
|
||||
}
|
||||
|
||||
function test2(x: (number | string) | number) {
|
||||
>test2 : (x: string | number) => void
|
||||
>x : string | number
|
||||
|
||||
if (x instanceof Object) {
|
||||
>x instanceof Object : boolean
|
||||
>x : string | number
|
||||
>Object : ObjectConstructor
|
||||
|
||||
x;
|
||||
>x : string | number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(2,5): error TS2300: Duplicate iden
|
||||
tests/cases/compiler/interfaceDeclaration1.ts(3,5): error TS2300: Duplicate identifier 'item'.
|
||||
tests/cases/compiler/interfaceDeclaration1.ts(7,5): error TS2300: Duplicate identifier 'item'.
|
||||
tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2300: Duplicate identifier 'item'.
|
||||
tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2717: Subsequent property declarations must have the same type. Property 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'.
|
||||
tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2717: Subsequent property declarations must have the same type. Property 'item' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/compiler/interfaceDeclaration1.ts(22,11): error TS2310: Type 'I5' recursively references itself as a base type.
|
||||
tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' incorrectly implements interface 'I3'.
|
||||
Property 'prototype' is missing in type 'C1'.
|
||||
@@ -29,7 +29,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i
|
||||
~~~~
|
||||
!!! error TS2300: Duplicate identifier 'item'.
|
||||
~~~~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'item' must be of type 'any', but here has type 'number'.
|
||||
}
|
||||
|
||||
interface I3 {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(33,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'string'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(34,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'C'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(35,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'D<string>'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(36,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'typeof M'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(39,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C2'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 41:4, but here has type '(x: number) => string'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type 'number[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type '(C | D<string>)[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D<string>[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 48:4, but here has type 'D<number>[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 51:4, but here has type 'typeof A'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(33,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(34,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(35,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D<string>'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(36,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(39,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D<string>[]', but here has type 'D<number>[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts (12 errors) ====
|
||||
@@ -46,47 +46,47 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec
|
||||
var a: any;
|
||||
var a = 1;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'.
|
||||
var a = 'a string';
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'.
|
||||
var a = new C();
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'C'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'.
|
||||
var a = new D<string>();
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'D<string>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D<string>'.
|
||||
var a = M;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'typeof M'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'.
|
||||
|
||||
var b: I;
|
||||
var b = new C();
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'.
|
||||
var b = new C2();
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C2'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'.
|
||||
|
||||
var f = F;
|
||||
var f = (x: number) => '';
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 41:4, but here has type '(x: number) => string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'.
|
||||
|
||||
var arr: string[];
|
||||
var arr = [1, 2, 3, 4];
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type 'number[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
var arr = [new C(), new C2(), new D<string>()];
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type '(C | D<string>)[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
|
||||
var arr2 = [new D<string>()];
|
||||
var arr2 = new Array<D<number>>();
|
||||
~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D<string>[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 48:4, but here has type 'D<number>[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D<string>[]', but here has type 'D<number>[]'.
|
||||
|
||||
var m: typeof M;
|
||||
var m = M.A;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 51:4, but here has type 'typeof A'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'.
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/compiler/b.js 0:4, but here has type 'number'.
|
||||
tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
@@ -9,4 +9,4 @@ tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations m
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
var x = 10; // Error reported so no declaration file generated?
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/compiler/b.js 0:4, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'.
|
||||
@@ -16,10 +16,10 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(37,24): error TS2344: T
|
||||
Type 'T' is not assignable to type '"visible"'.
|
||||
Type 'string | number' is not assignable to type '"visible"'.
|
||||
Type 'string' is not assignable to type '"visible"'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(59,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ [P in keyof T]?: T[P] | undefined; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]: T[P]; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(66,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 64:8, but here has type '{ [P in keyof T]: T[P][]; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(59,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(66,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(75,45): error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'.
|
||||
Property 'y' is missing in type '{ x: number; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(77,59): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'.
|
||||
@@ -138,20 +138,20 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536:
|
||||
var x: { [P in keyof T]: T[P] };
|
||||
var x: { [P in keyof T]?: T[P] }; // Error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ [P in keyof T]?: T[P] | undefined; }'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'.
|
||||
var x: { readonly [P in keyof T]: T[P] }; // Error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]: T[P]; }'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'.
|
||||
var x: { readonly [P in keyof T]?: T[P] }; // Error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'.
|
||||
}
|
||||
|
||||
function f12<T>() {
|
||||
var x: { [P in keyof T]: T[P] };
|
||||
var x: { [P in keyof T]: T[P][] }; // Error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 64:8, but here has type '{ [P in keyof T]: T[P][]; }'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'.
|
||||
}
|
||||
|
||||
// Check that inferences to mapped types are secondary
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'.
|
||||
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'.
|
||||
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'.
|
||||
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
|
||||
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (3 errors) ====
|
||||
@@ -11,7 +11,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
|
||||
interface A {
|
||||
x: number;
|
||||
~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'string', but here has type 'number'.
|
||||
}
|
||||
|
||||
module M {
|
||||
@@ -22,7 +22,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
|
||||
interface A<T> {
|
||||
x: number; // error
|
||||
~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,6 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
|
||||
export interface A<T> {
|
||||
x: number; // error
|
||||
~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(13,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
@@ -30,19 +30,19 @@ tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(31,16):
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var { x = 1, y } = {};
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var { x, y = 1 } = {};
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
|
||||
var { x = 1, y = 1 } = {};
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
|
||||
}
|
||||
|
||||
// Missing properties
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperator
|
||||
tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,24): error TS2531: Object is possibly 'null'.
|
||||
tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,17): error TS2532: Object is possibly 'undefined'.
|
||||
tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,29): error TS2532: Object is possibly 'undefined'.
|
||||
tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'NUMBER' has type 'any' at tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts 3:18, but here has type 'number'.
|
||||
tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'NUMBER' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(12,14): error TS1109: Expression expected.
|
||||
|
||||
|
||||
@@ -43,6 +43,6 @@ tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperator
|
||||
// miss operand
|
||||
var NUMBER =-;
|
||||
~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'NUMBER' has type 'any' at tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts 3:18, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'NUMBER' must be of type 'any', but here has type 'number'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -3,7 +3,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString
|
||||
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(12,5): error TS2300: Duplicate identifier '1'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(16,5): error TS2300: Duplicate identifier '1'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2717: Subsequent property declarations must have the same type. Property '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2717: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(22,5): error TS2300: Duplicate identifier '0'.
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier '1'.
|
||||
~~~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'.
|
||||
}
|
||||
|
||||
var b = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts(3,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'options' has type 'number | undefined' at tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts 1:16, but here has type 'number'.
|
||||
tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts(3,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'options' must be of type 'number | undefined', but here has type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts (1 errors) ====
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts(3,13): error TS2
|
||||
constructor(options?: number) {
|
||||
var options = (options || 0);
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'options' has type 'number | undefined' at tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts 1:16, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'options' must be of type 'number | undefined', but here has type 'number'.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(19,5): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'.
|
||||
Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'.
|
||||
tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'w' has type 'A' at tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts 20:4, but here has type 'C'.
|
||||
tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'.
|
||||
tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'.
|
||||
Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'.
|
||||
|
||||
@@ -32,7 +32,7 @@ tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS234
|
||||
var w: A;
|
||||
var w: C;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'w' has type 'A' at tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts 20:4, but here has type 'C'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'.
|
||||
|
||||
w({ s: "", n: 0 }).toLowerCase();
|
||||
~~~~~
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21):
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'number'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,5): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,11): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolution.ts 53:4, but here has type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): error TS2339: Property 'toFixed' does not exist on type 'string'.
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22):
|
||||
function fn5() { return undefined; }
|
||||
var n = fn5((n) => n.toFixed());
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolution.ts 53:4, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'.
|
||||
~~~~~~~
|
||||
!!! error TS2339: Property 'toFixed' does not exist on type 'string'.
|
||||
var s = fn5((n) => n.substr(0));
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'number'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,9): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,15): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts 57:4, but here has type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,26): error TS2339: Property 'toFixed' does not exist on type 'string'.
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors
|
||||
var fn5: fn5;
|
||||
var n = new fn5((n) => n.toFixed());
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts 57:4, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'.
|
||||
~~~~~~~
|
||||
!!! error TS2339: Property 'toFixed' does not exist on type 'string'.
|
||||
var s = new fn5((n) => n.substr(0));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(2,10): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(2,12): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '<T>() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '<T>(a: any) => number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '<T>() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '<T>(a: any, b: any) => number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '<T>() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '<T>(a?: number, b?: number) => number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '<T>() => number', but here has type '<T>(a: any) => number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '<T>() => number', but here has type '<T>(a: any, b: any) => number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '<T>() => number', but here has type '<T>(a?: number, b?: number) => number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(8,10): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(8,13): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(9,10): error TS2304: Cannot find name 'T'.
|
||||
@@ -24,13 +24,13 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunctio
|
||||
|
||||
var v = <T>(a) => 1;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '<T>() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '<T>(a: any) => number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '<T>() => number', but here has type '<T>(a: any) => number'.
|
||||
var v = <T>(a, b) => 1;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '<T>() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '<T>(a: any, b: any) => number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '<T>() => number', but here has type '<T>(a: any, b: any) => number'.
|
||||
var v = <T>(a = 1, b = 2) => 1;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '<T>() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '<T>(a?: number, b?: number) => number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '<T>() => number', but here has type '<T>(a?: number, b?: number) => number'.
|
||||
|
||||
var v = <T>(a);
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise<string, number>' at tests/cases/compiler/promiseIdentity2.ts 9:4, but here has type 'Promise<any, string>'.
|
||||
tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<any, string>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseIdentity2.ts (1 errors) ====
|
||||
@@ -14,4 +14,4 @@ tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variabl
|
||||
var x: IPromise<string, number>;
|
||||
var x: Promise<any, string>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise<string, number>' at tests/cases/compiler/promiseIdentity2.ts 9:4, but here has type 'Promise<any, string>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<any, string>'.
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/promiseIdentityWithAny2.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise<string, number>' at tests/cases/compiler/promiseIdentityWithAny2.ts 8:4, but here has type 'Promise<string, boolean>'.
|
||||
tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'IPromise2<string, number>' at tests/cases/compiler/promiseIdentityWithAny2.ts 20:4, but here has type 'Promise2<string, boolean>'.
|
||||
tests/cases/compiler/promiseIdentityWithAny2.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<string, boolean>'.
|
||||
tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2<string, number>', but here has type 'Promise2<string, boolean>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseIdentityWithAny2.ts (2 errors) ====
|
||||
@@ -14,7 +14,7 @@ tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent
|
||||
var x: IPromise<string, number>;
|
||||
var x: Promise<string, boolean>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise<string, number>' at tests/cases/compiler/promiseIdentityWithAny2.ts 8:4, but here has type 'Promise<string, boolean>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<string, boolean>'.
|
||||
|
||||
|
||||
interface IPromise2<T, V> {
|
||||
@@ -28,4 +28,4 @@ tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent
|
||||
var y: IPromise2<string, number>;
|
||||
var y: Promise2<string, boolean>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'IPromise2<string, number>' at tests/cases/compiler/promiseIdentityWithAny2.ts 20:4, but here has type 'Promise2<string, boolean>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2<string, number>', but here has type 'Promise2<string, boolean>'.
|
||||
@@ -4,7 +4,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): err
|
||||
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,19): error TS2538: Type '{ name: string; }' cannot be used as an index type.
|
||||
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,18): error TS2538: Type '{ name: string; }' cannot be used as an index type.
|
||||
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,22): error TS2538: Type '{ name: string; }' cannot be used as an index type.
|
||||
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'A | B' at tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts 147:4, but here has type 'A'.
|
||||
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'A | B', but here has type 'A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (6 errors) ====
|
||||
@@ -169,5 +169,5 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): err
|
||||
var x3 = bothIndex[stringOrNumber];
|
||||
var x3: A;
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'A | B' at tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts 147:4, but here has type 'A'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'A | B', but here has type 'A'.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'Foo' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 3:4, but here has type 'Foo'.
|
||||
tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'Foo1' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 11:4, but here has type 'Foo2'.
|
||||
tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'Foo', but here has type 'Foo'.
|
||||
tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'Foo1', but here has type 'Foo2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts (2 errors) ====
|
||||
@@ -9,7 +9,7 @@ tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS240
|
||||
var x: m1.Foo;
|
||||
var x: m2.Foo; // Should be error (mod1.Foo !== mod2.Foo)
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'Foo' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 3:4, but here has type 'Foo'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'Foo', but here has type 'Foo'.
|
||||
class Foo1 {
|
||||
private n;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS240
|
||||
var y: Foo1;
|
||||
var y: Foo2;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'Foo1' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 11:4, but here has type 'Foo2'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'Foo1', but here has type 'Foo2'.
|
||||
==== tests/cases/compiler/propertyIdentityWithPrivacyMismatch_0.ts (0 errors) ====
|
||||
declare module 'mod1' {
|
||||
class Foo {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2300: Duplicate identifier 'bar'.
|
||||
tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2717: Subsequent property declarations must have the same type. Property 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'.
|
||||
tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2717: Subsequent property declarations must have the same type. Property 'bar' must be of type 'number', but here has type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/reassignStaticProp.ts (2 errors) ====
|
||||
@@ -11,7 +11,7 @@ tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2717: Subsequent prope
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'bar'.
|
||||
~~~
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'.
|
||||
!!! error TS2717: Subsequent property declarations must have the same type. Property 'bar' must be of type 'number', but here has type 'string'.
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o1' has type '{} | { a: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 3:4, but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o2' has type '{} | { b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 6:4, but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' has type '{} | { a: number; } | { b: number; } | { a: number; b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 9:4, but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' has type '{} | { a: number; } | { b: number; } | { a: number; b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 9:4, but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o4' has type '{} | { a: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 13:4, but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o5' has type '{} | { b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 16:4, but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o1' must be of type '{} | { a: number; }', but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o2' must be of type '{} | { b: number; }', but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o4' must be of type '{} | { a: number; }', but here has type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion2.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o5' must be of type '{} | { b: number; }', but here has type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/spread/spreadUnion2.ts (6 errors) ====
|
||||
@@ -13,29 +13,29 @@ tests/cases/conformance/types/spread/spreadUnion2.ts(18,5): error TS2403: Subseq
|
||||
var o1: {} | { a: number };
|
||||
var o1 = { ...undefinedUnion };
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o1' has type '{} | { a: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 3:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o1' must be of type '{} | { a: number; }', but here has type '{}'.
|
||||
|
||||
var o2: {} | { b: number };
|
||||
var o2 = { ...nullUnion };
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o2' has type '{} | { b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 6:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o2' must be of type '{} | { b: number; }', but here has type '{}'.
|
||||
|
||||
var o3: {} | { a: number } | { b: number } | { a: number, b: number };
|
||||
var o3 = { ...undefinedUnion, ...nullUnion };
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' has type '{} | { a: number; } | { b: number; } | { a: number; b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 9:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
|
||||
var o3 = { ...nullUnion, ...undefinedUnion };
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' has type '{} | { a: number; } | { b: number; } | { a: number; b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 9:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
|
||||
|
||||
var o4: {} | { a: number };
|
||||
var o4 = { ...undefinedUnion, ...undefinedUnion };
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o4' has type '{} | { a: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 13:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o4' must be of type '{} | { a: number; }', but here has type '{}'.
|
||||
|
||||
var o5: {} | { b: number };
|
||||
var o5 = { ...nullUnion, ...nullUnion };
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o5' has type '{} | { b: number; }' at tests/cases/conformance/types/spread/spreadUnion2.ts 16:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o5' must be of type '{} | { b: number; }', but here has type '{}'.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/types/tuple/strictTupleLength.ts(1,9): error TS1122: A tuple type element list cannot be empty.
|
||||
tests/cases/conformance/types/tuple/strictTupleLength.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 't1' has type '[number]' at tests/cases/conformance/types/tuple/strictTupleLength.ts 1:4, but here has type '[number, number]'.
|
||||
tests/cases/conformance/types/tuple/strictTupleLength.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 't2' has type '[number, number]' at tests/cases/conformance/types/tuple/strictTupleLength.ts 2:4, but here has type '[number]'.
|
||||
tests/cases/conformance/types/tuple/strictTupleLength.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 't1' must be of type '[number]', but here has type '[number, number]'.
|
||||
tests/cases/conformance/types/tuple/strictTupleLength.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 't2' must be of type '[number, number]', but here has type '[number]'.
|
||||
tests/cases/conformance/types/tuple/strictTupleLength.ts(18,1): error TS2322: Type 'number[]' is not assignable to type '[number]'.
|
||||
Property '0' is missing in type 'number[]'.
|
||||
|
||||
@@ -20,10 +20,10 @@ tests/cases/conformance/types/tuple/strictTupleLength.ts(18,1): error TS2322: Ty
|
||||
|
||||
var t1 = t2; // error
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't1' has type '[number]' at tests/cases/conformance/types/tuple/strictTupleLength.ts 1:4, but here has type '[number, number]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't1' must be of type '[number]', but here has type '[number, number]'.
|
||||
var t2 = t1; // error
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't2' has type '[number, number]' at tests/cases/conformance/types/tuple/strictTupleLength.ts 2:4, but here has type '[number]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't2' must be of type '[number, number]', but here has type '[number]'.
|
||||
|
||||
type A<T extends any[]> = T['length'];
|
||||
var b: A<[boolean]>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(62,36): error TS2345: Argument of type '0' is not assignable to parameter of type '""'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(76,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts 74:4, but here has type '{}'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(76,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (2 errors) ====
|
||||
@@ -82,7 +82,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
|
||||
var a9e = someGenerics9 `${ undefined }${ { x: 6, z: new Date() } }${ { x: 6, y: '' } }`;
|
||||
var a9e: {};
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts 74:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with a single best common type
|
||||
var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts(62,36): error TS2345: Argument of type '0' is not assignable to parameter of type '""'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts(76,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts 74:4, but here has type '{}'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts(76,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts (2 errors) ====
|
||||
@@ -82,7 +82,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
|
||||
var a9e = someGenerics9 `${ undefined }${ { x: 6, z: new Date() } }${ { x: 6, y: '' } }`;
|
||||
var a9e: {};
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts 74:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with a single best common type
|
||||
var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`;
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var Foo = /** @class */ (function () {
|
||||
function Foo() {
|
||||
}
|
||||
Foo.prototype.baz = function () { };
|
||||
__decorate([
|
||||
Bar
|
||||
], Foo.prototype, "baz", null);
|
||||
Foo = __decorate([], Foo);
|
||||
return Foo;
|
||||
}());
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,29): error TS2345: Argument of type '0' is not assignable to parameter of type '""'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(83,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts 81:4, but here has type '{}'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(83,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(84,74): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'.
|
||||
Object literal may only specify known properties, and 'y' does not exist in type 'A92'.
|
||||
|
||||
@@ -91,7 +91,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(84,74
|
||||
var a9e = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' });
|
||||
var a9e: {};
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts 81:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
var a9f = someGenerics9<A92>(undefined, { x: 6, z: new Date() }, { x: 6, y: '' });
|
||||
~~~~~
|
||||
!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'.
|
||||
|
||||
@@ -12,7 +12,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(106,33): error TS2345: Argument of type '0' is not assignable to parameter of type '""'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(118,9): error TS2304: Cannot find name 'Window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,51): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(121,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts 119:4, but here has type '{}'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(121,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,56): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,74): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'.
|
||||
Object literal may only specify known properties, and 'y' does not exist in type 'A92'.
|
||||
@@ -163,7 +163,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
|
||||
!!! error TS2304: Cannot find name 'window'.
|
||||
var a9e: {};
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts 119:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
var a9f = new someGenerics9<A92>(undefined, { x: 6, z: window }, { x: 6, y: '' });
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'window'.
|
||||
|
||||
@@ -17,7 +17,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(73,29): error TS2345: Argument of type '0' is not assignable to parameter of type '""'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(85,9): error TS2304: Cannot find name 'Window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,47): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(88,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts 86:4, but here has type '{}'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(88,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,52): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,70): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'.
|
||||
Object literal may only specify known properties, and 'y' does not exist in type 'A92'.
|
||||
@@ -145,7 +145,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
|
||||
!!! error TS2304: Cannot find name 'window'.
|
||||
var a9e: {};
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' has type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }' at tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts 86:4, but here has type '{}'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: any; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'.
|
||||
var a9f = someGenerics9<A92>(undefined, { x: 6, z: window }, { x: 6, y: '' });
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'window'.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 9:8, but here has type 'number'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 16:8, but here has type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 23:8, but here has type 'boolean'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(30,5): error TS2365: Operator '==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'C' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 30:8, but here has type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts (5 errors) ====
|
||||
@@ -20,7 +20,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa
|
||||
else {
|
||||
var r1 = strOrNum; // string | number
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 9:8, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'.
|
||||
}
|
||||
|
||||
if (typeof strOrBool == "boolean") {
|
||||
@@ -29,7 +29,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa
|
||||
else {
|
||||
var r2 = strOrBool; // string | boolean
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 16:8, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'.
|
||||
}
|
||||
|
||||
if (typeof numOrBool == "number") {
|
||||
@@ -38,7 +38,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa
|
||||
else {
|
||||
var r3 = numOrBool; // number | boolean
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 23:8, but here has type 'boolean'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'.
|
||||
}
|
||||
|
||||
if (typeof strOrC == "Object") {
|
||||
@@ -49,5 +49,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa
|
||||
else {
|
||||
var r4 = strOrC; // string | C
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'C' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 30:8, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'.
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 9:8, but here has type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 16:8, but here has type 'boolean'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 23:8, but here has type 'number'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(30,5): error TS2365: Operator '!=' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 30:8, but here has type 'C'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts (5 errors) ====
|
||||
@@ -20,7 +20,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN
|
||||
else {
|
||||
var r1 = strOrNum; // string | number
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 9:8, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'.
|
||||
}
|
||||
|
||||
if (typeof strOrBool != "boolean") {
|
||||
@@ -29,7 +29,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN
|
||||
else {
|
||||
var r2 = strOrBool; // string | boolean
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 16:8, but here has type 'boolean'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'.
|
||||
}
|
||||
|
||||
if (typeof numOrBool != "number") {
|
||||
@@ -38,7 +38,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN
|
||||
else {
|
||||
var r3 = numOrBool; // number | boolean
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 23:8, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'.
|
||||
}
|
||||
|
||||
if (typeof strOrC != "Object") {
|
||||
@@ -49,5 +49,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN
|
||||
else {
|
||||
var r4 = strOrC; // string | C
|
||||
~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 30:8, but here has type 'C'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'.
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 6:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 8:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,70): error TS2375: Duplicate number index signature.
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,70): error TS2375: Dup
|
||||
var x = E;
|
||||
var x: { readonly a: E; readonly b: E; readonly [x: number]: string; }; // Shouldnt error
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 6:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
var y = E;
|
||||
var y: { readonly a: E; readonly b: E; readonly [x: number]: string; readonly [x: number]: string } // two errors: the types are not identical and duplicate signatures
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 8:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2375: Duplicate number index signature.
|
||||
@@ -1,19 +1,19 @@
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(14,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 12:15, but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(18,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 16:12, but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(14,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(18,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(22,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(24,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 22:12, but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(24,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(27,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(29,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 27:12, but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(37,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 35:12, but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(29,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(37,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(53,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(61,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(83,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 81:15, but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(87,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 85:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(83,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(87,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(91,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(93,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 91:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(93,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(96,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(98,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 96:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 104:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(98,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(122,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@@ -34,13 +34,13 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
memberFunc(t = this) {
|
||||
var t: MyTestClass;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 12:15, but here has type 'MyTestClass'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'.
|
||||
|
||||
//type of 'this' in member function body is the class instance type
|
||||
var p = this;
|
||||
var p: MyTestClass;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 16:12, but here has type 'MyTestClass'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'.
|
||||
}
|
||||
|
||||
//type of 'this' in member accessor(get and set) body is the class instance type
|
||||
@@ -50,7 +50,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
var p = this;
|
||||
var p: MyTestClass;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 22:12, but here has type 'MyTestClass'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'.
|
||||
return this;
|
||||
}
|
||||
set prop(v) {
|
||||
@@ -59,7 +59,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
var p = this;
|
||||
var p: MyTestClass;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 27:12, but here has type 'MyTestClass'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'.
|
||||
p = v;
|
||||
v = p;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
var t = this;
|
||||
var t: MyTestClass;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 35:12, but here has type 'MyTestClass'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'.
|
||||
};
|
||||
|
||||
//type of 'this' in static function param list is constructor function type
|
||||
@@ -121,13 +121,13 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
memberFunc(t = this) {
|
||||
var t: MyGenericTestClass<T, U>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 81:15, but here has type 'MyGenericTestClass<T, U>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
|
||||
//type of 'this' in member function body is the class instance type
|
||||
var p = this;
|
||||
var p: MyGenericTestClass<T, U>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 85:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
}
|
||||
|
||||
//type of 'this' in member accessor(get and set) body is the class instance type
|
||||
@@ -137,7 +137,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
var p = this;
|
||||
var p: MyGenericTestClass<T, U>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 91:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
return this;
|
||||
}
|
||||
set prop(v) {
|
||||
@@ -146,7 +146,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
var p = this;
|
||||
var p: MyGenericTestClass<T, U>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 96:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
p = v;
|
||||
v = p;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1
|
||||
var t = this;
|
||||
var t: MyGenericTestClass<T, U>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 104:12, but here has type 'MyGenericTestClass<T, U>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass<T, U>'.
|
||||
};
|
||||
|
||||
//type of 'this' in static function param list is constructor function type
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/types/union/unionTypeEquivalence.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'C' at tests/cases/conformance/types/union/unionTypeEquivalence.ts 3:4, but here has type 'C | D'.
|
||||
tests/cases/conformance/types/union/unionTypeEquivalence.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'C', but here has type 'C | D'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/union/unionTypeEquivalence.ts (1 errors) ====
|
||||
@@ -8,7 +8,7 @@ tests/cases/conformance/types/union/unionTypeEquivalence.ts(5,5): error TS2403:
|
||||
var x: C;
|
||||
var x : C | D;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'C' at tests/cases/conformance/types/union/unionTypeEquivalence.ts 3:4, but here has type 'C | D'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'C', but here has type 'C | D'.
|
||||
|
||||
// A | B is equivalent to B | A.
|
||||
var y: string | number;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'boolean'.
|
||||
tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'boolean'.
|
||||
tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts (3 errors) ====
|
||||
@@ -11,10 +11,10 @@ tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeI
|
||||
var strOrNum: boolean | string | boolean;
|
||||
var strOrNum: string; // error
|
||||
~~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'string'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'string'.
|
||||
var strOrNum: boolean; // error
|
||||
~~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'boolean'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'boolean'.
|
||||
var strOrNum: number; // error
|
||||
~~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'number'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'number'.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user