Merge branch 'master' into strictNullChecks

Conflicts:
	src/compiler/checker.ts
	src/compiler/types.ts
This commit is contained in:
Anders Hejlsberg
2016-02-18 18:48:10 -08:00
277 changed files with 4305 additions and 1689 deletions
+27
View File
@@ -0,0 +1,27 @@
<!--
Thank you for contributing to TypeScript! Please review this checklist
before submitting your issue.
[ ] Many common issues and suggestions are addressed in the FAQ
https://github.com/Microsoft/TypeScript/wiki/FAQ
[ ] Search for duplicates before logging new issues
https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue
[ ] Questions are best asked and answered at Stack Overflow
http://stackoverflow.com/questions/tagged/typescript
For bug reports, please include the information below.
__________________________________________________________ -->
**TypeScript Version:**
1.7.5 / 1.8.0-beta / nightly (1.9.0-dev.20160217)
**Code**
```ts
// A self-contained demonstration of the problem follows...
```
**Expected behavior:**
**Actual behavior:**
+16
View File
@@ -0,0 +1,16 @@
<!--
Thank you for submitting a pull request!
Here's a checklist you might find useful.
[ ] There is an associated issue that is labelled
'Bug' or 'Accepting PRs' or is in the Community milestone
[ ] Code is up-to-date with the `master` branch
[ ] You've successfully run `jake runtests` locally
[ ] You've signed the CLA
[ ] There are new or updated unit tests validating the change
Refer to CONTRIBUTING.MD for more details.
https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md
-->
**Fixes issue:** #
+436 -283
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1313,7 +1313,7 @@ namespace ts {
if (node.kind === SyntaxKind.FunctionDeclaration) {
emitModuleElementDeclarationFlags(node);
}
else if (node.kind === SyntaxKind.MethodDeclaration) {
else if (node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.Constructor) {
emitClassMemberDeclarationFlags(node.flags);
}
if (node.kind === SyntaxKind.FunctionDeclaration) {
+26 -7
View File
@@ -687,7 +687,7 @@
"category": "Error",
"code": 1218
},
"Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.": {
"Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.": {
"category": "Error",
"code": 1219
},
@@ -723,6 +723,10 @@
"category": "Error",
"code": 1227
},
"A type predicate is only allowed in return type position for functions and methods.": {
"category": "Error",
"code": 1228
},
"A type predicate cannot reference a rest parameter.": {
"category": "Error",
"code": 1229
@@ -1699,6 +1703,10 @@
"category": "Error",
"code": 2529
},
"Property '{0}' is incompatible with index signature.": {
"category": "Error",
"code": 2530
},
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
"code": 2600
@@ -1819,6 +1827,22 @@
"category": "Error",
"code": 2671
},
"Cannot assign a '{0}' constructor type to a '{1}' constructor type.": {
"category": "Error",
"code": 2672
},
"Constructor of class '{0}' is private and only accessible within the class declaration.": {
"category": "Error",
"code": 2673
},
"Constructor of class '{0}' is protected and only accessible within the class declaration.": {
"category": "Error",
"code": 2674
},
"Cannot extend a class '{0}'. Class constructor is marked as private.": {
"category": "Error",
"code": 2675
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
@@ -2733,11 +2757,6 @@
"category": "Error",
"code": 8016
},
"'decorators' can only be used in a .ts file.": {
"category": "Error",
"code": 8017
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
"category": "Error",
"code": 9002
@@ -2786,4 +2805,4 @@
"category": "Error",
"code": 17009
}
}
}
+2 -2
View File
@@ -1940,7 +1940,7 @@ namespace ts {
return finishNode(node);
}
function parseTypePredicate(lhs: Identifier | ThisTypeNode): TypePredicateNode {
function parseThisTypePredicate(lhs: ThisTypeNode): TypePredicateNode {
nextToken();
const node = createNode(SyntaxKind.TypePredicate, lhs.pos) as TypePredicateNode;
node.parameterName = lhs;
@@ -2365,7 +2365,7 @@ namespace ts {
case SyntaxKind.ThisKeyword: {
const thisKeyword = parseThisTypeNode();
if (token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
return parseTypePredicate(thisKeyword);
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
+37 -14
View File
@@ -533,18 +533,25 @@ namespace ts {
}
let referencedSourceFile: string;
while (true) {
const searchName = normalizePath(combinePaths(containingDirectory, moduleName));
referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
if (referencedSourceFile) {
break;
if (moduleHasNonRelativeName(moduleName)) {
while (true) {
const searchName = normalizePath(combinePaths(containingDirectory, moduleName));
referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
if (referencedSourceFile) {
break;
}
const parentPath = getDirectoryPath(containingDirectory);
if (parentPath === containingDirectory) {
break;
}
containingDirectory = parentPath;
}
const parentPath = getDirectoryPath(containingDirectory);
if (parentPath === containingDirectory) {
break;
}
containingDirectory = parentPath;
}
else {
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
}
return referencedSourceFile
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations }
@@ -946,13 +953,27 @@ namespace ts {
}
function emitWorker(program: Program, sourceFile: SourceFile, writeFileCallback: WriteFileCallback, cancellationToken: CancellationToken): EmitResult {
let declarationDiagnostics: Diagnostic[] = [];
if (options.noEmit) {
return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emitSkipped: true };
}
// If the noEmitOnError flag is set, then check if we have any errors so far. If so,
// immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we
// get any preEmit diagnostics, not just the ones
if (options.noEmitOnError) {
const preEmitDiagnostics = getPreEmitDiagnostics(program, /*sourceFile:*/ undefined, cancellationToken);
if (preEmitDiagnostics.length > 0) {
return { diagnostics: preEmitDiagnostics, sourceMaps: undefined, emitSkipped: true };
const diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(
program.getSyntacticDiagnostics(sourceFile, cancellationToken),
program.getGlobalDiagnostics(cancellationToken),
program.getSemanticDiagnostics(sourceFile, cancellationToken));
if (diagnostics.length === 0 && program.getCompilerOptions().declaration) {
declarationDiagnostics = program.getDeclarationDiagnostics(/*sourceFile*/ undefined, cancellationToken);
}
if (diagnostics.length > 0 || declarationDiagnostics.length > 0) {
return { diagnostics, sourceMaps: undefined, emitSkipped: true };
}
}
@@ -1169,7 +1190,9 @@ namespace ts {
diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return true;
case SyntaxKind.Decorator:
diagnostics.push(createDiagnosticForNode(node, Diagnostics.decorators_can_only_be_used_in_a_ts_file));
if (!options.experimentalDecorators) {
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
}
return true;
}
+12 -19
View File
@@ -590,30 +590,21 @@ namespace ts {
}
}
reportDiagnostics(diagnostics, compilerHost);
// If the user doesn't want us to emit, then we're done at this point.
if (compilerOptions.noEmit) {
return diagnostics.length
? ExitStatus.DiagnosticsPresent_OutputsSkipped
: ExitStatus.Success;
}
// Otherwise, emit and report any errors we ran into.
const emitOutput = program.emit();
reportDiagnostics(emitOutput.diagnostics, compilerHost);
diagnostics = diagnostics.concat(emitOutput.diagnostics);
// If the emitter didn't emit anything, then pass that value along.
if (emitOutput.emitSkipped) {
reportDiagnostics(sortAndDeduplicateDiagnostics(diagnostics), compilerHost);
if (emitOutput.emitSkipped && diagnostics.length > 0) {
// If the emitter didn't emit anything, then pass that value along.
return ExitStatus.DiagnosticsPresent_OutputsSkipped;
}
// The emitter emitted something, inform the caller if that happened in the presence
// of diagnostics or not.
if (diagnostics.length > 0 || emitOutput.diagnostics.length > 0) {
else if (diagnostics.length > 0) {
// The emitter emitted something, inform the caller if that happened in the presence
// of diagnostics or not.
return ExitStatus.DiagnosticsPresent_OutputsGenerated;
}
return ExitStatus.Success;
}
}
@@ -719,14 +710,16 @@ namespace ts {
else {
const compilerOptions = extend(options, defaultInitCompilerOptions);
const configurations: any = {
compilerOptions: serializeCompilerOptions(compilerOptions),
exclude: ["node_modules"]
compilerOptions: serializeCompilerOptions(compilerOptions)
};
if (fileNames && fileNames.length) {
// only set the files property if we have at least one file
configurations.files = fileNames;
}
else {
configurations.exclude = ["node_modules"];
}
sys.writeFile(file, JSON.stringify(configurations, undefined, 4));
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* compilerHost */ undefined);
+1 -2
View File
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
@@ -8,9 +7,9 @@
"sourceMap": true
},
"files": [
"types.ts",
"core.ts",
"sys.ts",
"types.ts",
"diagnosticInformationMap.generated.ts",
"scanner.ts",
"parser.ts",
+15 -15
View File
@@ -428,7 +428,6 @@ namespace ts {
IntrinsicElement = IntrinsicNamedElement | IntrinsicIndexedElement,
}
/* @internal */
export const enum RelationComparisonResult {
Succeeded = 1, // Should be truthy
@@ -1693,6 +1692,7 @@ namespace ts {
export interface EmitResult {
emitSkipped: boolean;
/** Contains declaration emit diagnostics */
diagnostics: Diagnostic[];
/* @internal */ sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps
}
@@ -1761,6 +1761,7 @@ namespace ts {
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
@@ -1826,22 +1827,24 @@ namespace ts {
Identifier
}
export interface TypePredicate {
export interface TypePredicateBase {
kind: TypePredicateKind;
type: Type;
}
// @kind (TypePredicateKind.This)
export interface ThisTypePredicate extends TypePredicate {
export interface ThisTypePredicate extends TypePredicateBase {
_thisTypePredicateBrand: any;
}
// @kind (TypePredicateKind.Identifier)
export interface IdentifierTypePredicate extends TypePredicate {
export interface IdentifierTypePredicate extends TypePredicateBase {
parameterName: string;
parameterIndex: number;
}
export type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
/* @internal */
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
@@ -2049,10 +2052,9 @@ namespace ts {
LoopWithCapturedBlockScopedBinding = 0x00010000, // Loop that contains block scoped variable captured in closure
CapturedBlockScopedBinding = 0x00020000, // Block-scoped binding that is captured in some function
BlockScopedBindingInLoop = 0x00040000, // Block-scoped binding with declaration nested inside iteration statement
HasSeenSuperCall = 0x00080000, // Set during the binding when encounter 'super'
ClassWithBodyScopedClassBinding = 0x00100000, // Decorated class that contains a binding to itself inside of the class body.
BodyScopedClassBinding = 0x00200000, // Binding to a decorated class inside of the class's body.
NeedsLoopOutParameter = 0x00400000, // Block scoped binding whose value should be explicitly copied outside of the converted loop
ClassWithBodyScopedClassBinding = 0x00080000, // Decorated class that contains a binding to itself inside of the class body.
BodyScopedClassBinding = 0x00100000, // Binding to a decorated class inside of the class's body.
NeedsLoopOutParameter = 0x00200000, // Block scoped binding whose value should be explicitly copied outside of the converted loop
}
/* @internal */
@@ -2072,6 +2074,8 @@ namespace ts {
importOnRightSide?: Symbol; // for import declarations - import that appear on the right side
jsxFlags?: JsxFlags; // flags for knowing what kind of element/attributes we're dealing with
resolvedJsxType?: Type; // resolved element attributes type of a JSX openinglike element
hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt.
superCall?: ExpressionStatement; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
}
export const enum TypeFlags {
@@ -2106,7 +2110,6 @@ namespace ts {
ESSymbol = 0x01000000, // Type of symbol primitive introduced in ES6
ThisType = 0x02000000, // This type
ObjectLiteralPatternWithComputedProperties = 0x04000000, // Object literal type implied by binding pattern has computed properties
PredicateType = 0x08000000, // Predicate types are also Boolean types, but should not be considered Intrinsics - there's no way to capture this with flags
/* @internal */
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined,
@@ -2118,7 +2121,7 @@ namespace ts {
UnionOrIntersection = Union | Intersection,
StructuredType = ObjectType | Union | Intersection,
/* @internal */
RequiresWidening = ContainsUndefined | ContainsObjectLiteral | PredicateType,
RequiresWidening = ContainsUndefined | ContainsObjectLiteral,
/* @internal */
PropagatingFlags = ContainsUndefined | ContainsObjectLiteral | ContainsAnyFunctionType
}
@@ -2140,11 +2143,6 @@ namespace ts {
intrinsicName: string; // Name of intrinsic type
}
// Predicate types (TypeFlags.Predicate)
export interface PredicateType extends Type {
predicate: ThisTypePredicate | IdentifierTypePredicate;
}
// String literal types (TypeFlags.StringLiteral)
export interface StringLiteralType extends Type {
text: string; // Text of string literal
@@ -2281,6 +2279,8 @@ namespace ts {
erasedSignatureCache?: Signature; // Erased version of signature (deferred)
/* @internal */
isolatedSignatureType?: ObjectType; // A manufactured type that just contains the signature for purposes of signature comparison
/* @internal */
typePredicate?: TypePredicate;
}
export const enum IndexKind {
+4
View File
@@ -748,6 +748,10 @@ namespace ts {
return predicate && predicate.kind === TypePredicateKind.Identifier;
}
export function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate {
return predicate && predicate.kind === TypePredicateKind.This;
}
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
while (true) {
node = node.parent;
-1
View File
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
-1
View File
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
@@ -16,7 +16,7 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
var program = ts.createProgram(fileNames, options);
var emitResult = program.emit();
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
var allDiagnostics = ts.getPreEmitDiagnostics(program);
allDiagnostics.forEach(diagnostic => {
var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
@@ -45,7 +45,7 @@ var ts = require("typescript");
function compile(fileNames, options) {
var program = ts.createProgram(fileNames, options);
var emitResult = program.emit();
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
var allDiagnostics = ts.getPreEmitDiagnostics(program);
allDiagnostics.forEach(function (diagnostic) {
var _a = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start), line = _a.line, character = _a.character;
var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
@@ -1,9 +0,0 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS1089: 'protected' modifier cannot appear on a constructor declaration.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts (1 errors) ====
class C {
protected constructor() { }
~~~~~~~~~
!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration.
}
@@ -0,0 +1,6 @@
=== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts ===
class C {
>C : Symbol(C, Decl(Protected3.ts, 0, 0))
protected constructor() { }
}
@@ -0,0 +1,6 @@
=== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts ===
class C {
>C : C
protected constructor() { }
}
@@ -4,7 +4,7 @@ var obj: Object;
>Object : Object
if (ArrayBuffer.isView(obj)) {
>ArrayBuffer.isView(obj) : arg is ArrayBufferView
>ArrayBuffer.isView(obj) : boolean
>ArrayBuffer.isView : (arg: any) => arg is ArrayBufferView
>ArrayBuffer : ArrayBufferConstructor
>isView : (arg: any) => arg is ArrayBufferView
@@ -1,10 +1,8 @@
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(15,5): error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
Index signature is missing in type '{}'.
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(19,5): error TS2322: Type '() => void' is not assignable to type '{ [n: number]: Bar; }'.
Index signature is missing in type '() => void'.
==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (2 errors) ====
==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (1 errors) ====
interface Foo { a }
interface Bar { b }
@@ -20,9 +18,6 @@ tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignatur
var f = () => { };
var v1: {
~~
!!! error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
!!! error TS2322: Index signature is missing in type '{}'.
[n: number]: Foo
} = o; // Should be allowed
@@ -6,6 +6,6 @@ function method() {
>dictionary : { [index: string]: string; }
><{ [index: string]: string; }>{} : { [index: string]: string; }
>index : string
>{} : { [x: string]: undefined; }
>{} : {}
}
@@ -36,7 +36,7 @@ var obj: { [s: string]: Contextual } = { s: e }; // { s: Ellement; [s: string]:
>obj : { [s: string]: Contextual; }
>s : string
>Contextual : Contextual
>{ s: e } : { [x: string]: Ellement; s: Ellement; }
>{ s: e } : { s: Ellement; }
>s : Ellement
>e : Ellement
@@ -1,29 +1,30 @@
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(6,5): error TS1089: 'private' modifier cannot appear on a constructor declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(10,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(23,9): error TS1089: 'private' modifier cannot appear on a constructor declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(27,9): error TS1089: 'protected' modifier cannot appear on a constructor declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(15,9): error TS2673: Constructor of class 'D' is private and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(16,9): error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(32,13): error TS2673: Constructor of class 'D<T>' is private and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(33,13): error TS2674: Constructor of class 'E<T>' is protected and only accessible within the class declaration.
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (4 errors) ====
class C {
public constructor(public x: number) { }
}
class D {
private constructor(public x: number) { } // error
~~~~~~~
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
private constructor(public x: number) { }
}
class E {
protected constructor(public x: number) { } // error
~~~~~~~~~
!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration.
protected constructor(public x: number) { }
}
var c = new C(1);
var d = new D(1);
var e = new E(1);
var d = new D(1); // error
~~~~~~~~
!!! error TS2673: Constructor of class 'D' is private and only accessible within the class declaration.
var e = new E(1); // error
~~~~~~~~
!!! error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration.
module Generic {
class C<T> {
@@ -31,19 +32,19 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessib
}
class D<T> {
private constructor(public x: T) { } // error
~~~~~~~
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
private constructor(public x: T) { }
}
class E<T> {
protected constructor(public x: T) { } // error
~~~~~~~~~
!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration.
protected constructor(public x: T) { }
}
var c = new C(1);
var d = new D(1);
var e = new E(1);
var d = new D(1); // error
~~~~~~~~
!!! error TS2673: Constructor of class 'D<T>' is private and only accessible within the class declaration.
var e = new E(1); // error
~~~~~~~~
!!! error TS2674: Constructor of class 'E<T>' is protected and only accessible within the class declaration.
}
@@ -1,19 +1,20 @@
//// [classConstructorAccessibility.ts]
class C {
public constructor(public x: number) { }
}
class D {
private constructor(public x: number) { } // error
private constructor(public x: number) { }
}
class E {
protected constructor(public x: number) { } // error
protected constructor(public x: number) { }
}
var c = new C(1);
var d = new D(1);
var e = new E(1);
var d = new D(1); // error
var e = new E(1); // error
module Generic {
class C<T> {
@@ -21,16 +22,16 @@ module Generic {
}
class D<T> {
private constructor(public x: T) { } // error
private constructor(public x: T) { }
}
class E<T> {
protected constructor(public x: T) { } // error
protected constructor(public x: T) { }
}
var c = new C(1);
var d = new D(1);
var e = new E(1);
var d = new D(1); // error
var e = new E(1); // error
}
@@ -44,18 +45,18 @@ var C = (function () {
var D = (function () {
function D(x) {
this.x = x;
} // error
}
return D;
}());
var E = (function () {
function E(x) {
this.x = x;
} // error
}
return E;
}());
var c = new C(1);
var d = new D(1);
var e = new E(1);
var d = new D(1); // error
var e = new E(1); // error
var Generic;
(function (Generic) {
var C = (function () {
@@ -67,16 +68,36 @@ var Generic;
var D = (function () {
function D(x) {
this.x = x;
} // error
}
return D;
}());
var E = (function () {
function E(x) {
this.x = x;
} // error
}
return E;
}());
var c = new C(1);
var d = new D(1);
var e = new E(1);
var d = new D(1); // error
var e = new E(1); // error
})(Generic || (Generic = {}));
//// [classConstructorAccessibility.d.ts]
declare class C {
x: number;
constructor(x: number);
}
declare class D {
x: number;
private constructor(x);
}
declare class E {
x: number;
protected constructor(x: number);
}
declare var c: C;
declare var d: any;
declare var e: any;
declare module Generic {
}
@@ -0,0 +1,59 @@
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(26,28): error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(29,24): error TS2675: Cannot extend a class 'BaseC'. Class constructor is marked as private.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(32,28): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(36,10): error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(37,10): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts (5 errors) ====
class BaseA {
public constructor(public x: number) { }
createInstance() { new BaseA(1); }
}
class BaseB {
protected constructor(public x: number) { }
createInstance() { new BaseB(1); }
}
class BaseC {
private constructor(public x: number) { }
createInstance() { new BaseC(1); }
}
class DerivedA extends BaseA {
constructor(public x: number) { super(x); }
createInstance() { new DerivedA(1); }
createBaseInstance() { new BaseA(1); }
}
class DerivedB extends BaseB {
constructor(public x: number) { super(x); }
createInstance() { new DerivedB(1); }
createBaseInstance() { new BaseB(1); } // error
~~~~~~~~~~~~
!!! error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
}
class DerivedC extends BaseC { // error
~~~~~
!!! error TS2675: Cannot extend a class 'BaseC'. Class constructor is marked as private.
constructor(public x: number) { super(x); }
createInstance() { new DerivedC(1); }
createBaseInstance() { new BaseC(1); } // error
~~~~~~~~~~~~
!!! error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
}
var ba = new BaseA(1);
var bb = new BaseB(1); // error
~~~~~~~~~~~~
!!! error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
var bc = new BaseC(1); // error
~~~~~~~~~~~~
!!! error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
var da = new DerivedA(1);
var db = new DerivedB(1);
var dc = new DerivedC(1);
@@ -0,0 +1,148 @@
//// [classConstructorAccessibility2.ts]
class BaseA {
public constructor(public x: number) { }
createInstance() { new BaseA(1); }
}
class BaseB {
protected constructor(public x: number) { }
createInstance() { new BaseB(1); }
}
class BaseC {
private constructor(public x: number) { }
createInstance() { new BaseC(1); }
}
class DerivedA extends BaseA {
constructor(public x: number) { super(x); }
createInstance() { new DerivedA(1); }
createBaseInstance() { new BaseA(1); }
}
class DerivedB extends BaseB {
constructor(public x: number) { super(x); }
createInstance() { new DerivedB(1); }
createBaseInstance() { new BaseB(1); } // error
}
class DerivedC extends BaseC { // error
constructor(public x: number) { super(x); }
createInstance() { new DerivedC(1); }
createBaseInstance() { new BaseC(1); } // error
}
var ba = new BaseA(1);
var bb = new BaseB(1); // error
var bc = new BaseC(1); // error
var da = new DerivedA(1);
var db = new DerivedB(1);
var dc = new DerivedC(1);
//// [classConstructorAccessibility2.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var BaseA = (function () {
function BaseA(x) {
this.x = x;
}
BaseA.prototype.createInstance = function () { new BaseA(1); };
return BaseA;
}());
var BaseB = (function () {
function BaseB(x) {
this.x = x;
}
BaseB.prototype.createInstance = function () { new BaseB(1); };
return BaseB;
}());
var BaseC = (function () {
function BaseC(x) {
this.x = x;
}
BaseC.prototype.createInstance = function () { new BaseC(1); };
return BaseC;
}());
var DerivedA = (function (_super) {
__extends(DerivedA, _super);
function DerivedA(x) {
_super.call(this, x);
this.x = x;
}
DerivedA.prototype.createInstance = function () { new DerivedA(1); };
DerivedA.prototype.createBaseInstance = function () { new BaseA(1); };
return DerivedA;
}(BaseA));
var DerivedB = (function (_super) {
__extends(DerivedB, _super);
function DerivedB(x) {
_super.call(this, x);
this.x = x;
}
DerivedB.prototype.createInstance = function () { new DerivedB(1); };
DerivedB.prototype.createBaseInstance = function () { new BaseB(1); }; // error
return DerivedB;
}(BaseB));
var DerivedC = (function (_super) {
__extends(DerivedC, _super);
function DerivedC(x) {
_super.call(this, x);
this.x = x;
}
DerivedC.prototype.createInstance = function () { new DerivedC(1); };
DerivedC.prototype.createBaseInstance = function () { new BaseC(1); }; // error
return DerivedC;
}(BaseC));
var ba = new BaseA(1);
var bb = new BaseB(1); // error
var bc = new BaseC(1); // error
var da = new DerivedA(1);
var db = new DerivedB(1);
var dc = new DerivedC(1);
//// [classConstructorAccessibility2.d.ts]
declare class BaseA {
x: number;
constructor(x: number);
createInstance(): void;
}
declare class BaseB {
x: number;
protected constructor(x: number);
createInstance(): void;
}
declare class BaseC {
x: number;
private constructor(x);
createInstance(): void;
}
declare class DerivedA extends BaseA {
x: number;
constructor(x: number);
createInstance(): void;
createBaseInstance(): void;
}
declare class DerivedB extends BaseB {
x: number;
constructor(x: number);
createInstance(): void;
createBaseInstance(): void;
}
declare class DerivedC extends BaseC {
x: number;
constructor(x: number);
createInstance(): void;
createBaseInstance(): void;
}
declare var ba: BaseA;
declare var bb: any;
declare var bc: any;
declare var da: DerivedA;
declare var db: DerivedB;
declare var dc: DerivedC;
@@ -0,0 +1,52 @@
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts(21,1): error TS2322: Type 'typeof Baz' is not assignable to type 'typeof Foo'.
Cannot assign a 'protected' constructor type to a 'public' constructor type.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts(22,1): error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Foo'.
Cannot assign a 'private' constructor type to a 'public' constructor type.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts(28,1): error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Baz'.
Cannot assign a 'private' constructor type to a 'protected' constructor type.
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts (3 errors) ====
class Foo {
constructor(public x: number) { }
}
class Bar {
public constructor(public x: number) { }
}
class Baz {
protected constructor(public x: number) { }
}
class Qux {
private constructor(public x: number) { }
}
// b is public
let a = Foo;
a = Bar;
a = Baz; // error Baz is protected
~
!!! error TS2322: Type 'typeof Baz' is not assignable to type 'typeof Foo'.
!!! error TS2322: Cannot assign a 'protected' constructor type to a 'public' constructor type.
a = Qux; // error Qux is private
~
!!! error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Foo'.
!!! error TS2322: Cannot assign a 'private' constructor type to a 'public' constructor type.
// b is protected
let b = Baz;
b = Foo;
b = Bar;
b = Qux; // error Qux is private
~
!!! error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Baz'.
!!! error TS2322: Cannot assign a 'private' constructor type to a 'protected' constructor type.
// c is private
let c = Qux;
c = Foo;
c = Bar;
c = Baz;
@@ -0,0 +1,98 @@
//// [classConstructorAccessibility3.ts]
class Foo {
constructor(public x: number) { }
}
class Bar {
public constructor(public x: number) { }
}
class Baz {
protected constructor(public x: number) { }
}
class Qux {
private constructor(public x: number) { }
}
// b is public
let a = Foo;
a = Bar;
a = Baz; // error Baz is protected
a = Qux; // error Qux is private
// b is protected
let b = Baz;
b = Foo;
b = Bar;
b = Qux; // error Qux is private
// c is private
let c = Qux;
c = Foo;
c = Bar;
c = Baz;
//// [classConstructorAccessibility3.js]
var Foo = (function () {
function Foo(x) {
this.x = x;
}
return Foo;
}());
var Bar = (function () {
function Bar(x) {
this.x = x;
}
return Bar;
}());
var Baz = (function () {
function Baz(x) {
this.x = x;
}
return Baz;
}());
var Qux = (function () {
function Qux(x) {
this.x = x;
}
return Qux;
}());
// b is public
var a = Foo;
a = Bar;
a = Baz; // error Baz is protected
a = Qux; // error Qux is private
// b is protected
var b = Baz;
b = Foo;
b = Bar;
b = Qux; // error Qux is private
// c is private
var c = Qux;
c = Foo;
c = Bar;
c = Baz;
//// [classConstructorAccessibility3.d.ts]
declare class Foo {
x: number;
constructor(x: number);
}
declare class Bar {
x: number;
constructor(x: number);
}
declare class Baz {
x: number;
protected constructor(x: number);
}
declare class Qux {
x: number;
private constructor(x);
}
declare let a: typeof Foo;
declare let b: typeof Baz;
declare let c: typeof Qux;
@@ -0,0 +1,93 @@
//// [classConstructorAccessibility4.ts]
class A {
private constructor() { }
method() {
class B {
method() {
new A(); // OK
}
}
class C extends A { // OK
}
}
}
class D {
protected constructor() { }
method() {
class E {
method() {
new D(); // OK
}
}
class F extends D { // OK
}
}
}
//// [classConstructorAccessibility4.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A() {
}
A.prototype.method = function () {
var B = (function () {
function B() {
}
B.prototype.method = function () {
new A(); // OK
};
return B;
}());
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
return C;
}(A));
};
return A;
}());
var D = (function () {
function D() {
}
D.prototype.method = function () {
var E = (function () {
function E() {
}
E.prototype.method = function () {
new D(); // OK
};
return E;
}());
var F = (function (_super) {
__extends(F, _super);
function F() {
_super.apply(this, arguments);
}
return F;
}(D));
};
return D;
}());
//// [classConstructorAccessibility4.d.ts]
declare class A {
private constructor();
method(): void;
}
declare class D {
protected constructor();
method(): void;
}
@@ -0,0 +1,53 @@
=== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts ===
class A {
>A : Symbol(A, Decl(classConstructorAccessibility4.ts, 0, 0))
private constructor() { }
method() {
>method : Symbol(method, Decl(classConstructorAccessibility4.ts, 2, 29))
class B {
>B : Symbol(B, Decl(classConstructorAccessibility4.ts, 4, 14))
method() {
>method : Symbol(method, Decl(classConstructorAccessibility4.ts, 5, 17))
new A(); // OK
>A : Symbol(A, Decl(classConstructorAccessibility4.ts, 0, 0))
}
}
class C extends A { // OK
>C : Symbol(C, Decl(classConstructorAccessibility4.ts, 9, 9))
>A : Symbol(A, Decl(classConstructorAccessibility4.ts, 0, 0))
}
}
}
class D {
>D : Symbol(D, Decl(classConstructorAccessibility4.ts, 14, 1))
protected constructor() { }
method() {
>method : Symbol(method, Decl(classConstructorAccessibility4.ts, 17, 31))
class E {
>E : Symbol(E, Decl(classConstructorAccessibility4.ts, 19, 14))
method() {
>method : Symbol(method, Decl(classConstructorAccessibility4.ts, 20, 17))
new D(); // OK
>D : Symbol(D, Decl(classConstructorAccessibility4.ts, 14, 1))
}
}
class F extends D { // OK
>F : Symbol(F, Decl(classConstructorAccessibility4.ts, 24, 9))
>D : Symbol(D, Decl(classConstructorAccessibility4.ts, 14, 1))
}
}
}
@@ -0,0 +1,55 @@
=== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts ===
class A {
>A : A
private constructor() { }
method() {
>method : () => void
class B {
>B : B
method() {
>method : () => void
new A(); // OK
>new A() : A
>A : typeof A
}
}
class C extends A { // OK
>C : C
>A : A
}
}
}
class D {
>D : D
protected constructor() { }
method() {
>method : () => void
class E {
>E : E
method() {
>method : () => void
new D(); // OK
>new D() : D
>D : typeof D
}
}
class F extends D { // OK
>F : F
>D : D
}
}
}
@@ -0,0 +1,45 @@
tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts(3,2): error TS2385: Overload signatures must all be public, private or protected.
tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts(4,2): error TS2385: Overload signatures must all be public, private or protected.
tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts(12,2): error TS2385: Overload signatures must all be public, private or protected.
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts (3 errors) ====
class A {
public constructor(a: boolean) // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2385: Overload signatures must all be public, private or protected.
protected constructor(a: number) // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2385: Overload signatures must all be public, private or protected.
private constructor(a: string)
private constructor() {
}
}
class B {
protected constructor(a: number) // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2385: Overload signatures must all be public, private or protected.
constructor(a: string)
constructor() {
}
}
class C {
protected constructor(a: number)
protected constructor(a: string)
protected constructor() {
}
}
class D {
constructor(a: number)
constructor(a: string)
public constructor() {
}
}
@@ -0,0 +1,76 @@
//// [classConstructorOverloadsAccessibility.ts]
class A {
public constructor(a: boolean) // error
protected constructor(a: number) // error
private constructor(a: string)
private constructor() {
}
}
class B {
protected constructor(a: number) // error
constructor(a: string)
constructor() {
}
}
class C {
protected constructor(a: number)
protected constructor(a: string)
protected constructor() {
}
}
class D {
constructor(a: number)
constructor(a: string)
public constructor() {
}
}
//// [classConstructorOverloadsAccessibility.js]
var A = (function () {
function A() {
}
return A;
}());
var B = (function () {
function B() {
}
return B;
}());
var C = (function () {
function C() {
}
return C;
}());
var D = (function () {
function D() {
}
return D;
}());
//// [classConstructorOverloadsAccessibility.d.ts]
declare class A {
constructor(a: boolean);
protected constructor(a: number);
private constructor(a);
}
declare class B {
protected constructor(a: number);
constructor(a: string);
}
declare class C {
protected constructor(a: number);
protected constructor(a: string);
}
declare class D {
constructor(a: number);
constructor(a: string);
}
@@ -1,17 +1,14 @@
tests/cases/compiler/classExtendsNull.ts(2,5): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'
tests/cases/compiler/classExtendsNull.ts(3,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'
==== tests/cases/compiler/classExtendsNull.ts (1 errors) ====
class C extends null {
constructor() {
~~~~~~~~~~~~~~~
super();
~~~~~~~~~~~~~~~~
return Object.create(null);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
~~~~~~~
!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'
return Object.create(null);
}
}
class D extends null {
@@ -1,70 +1,54 @@
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(26,12): error TS2365: Operator '<' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(27,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(28,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(29,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(31,12): error TS2365: Operator '<' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(33,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(34,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(37,12): error TS2365: Operator '>' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(38,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(39,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(40,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(42,12): error TS2365: Operator '>' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(43,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(44,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(45,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(48,12): error TS2365: Operator '<=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(49,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(50,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(51,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(53,12): error TS2365: Operator '<=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(54,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(55,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(56,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(59,12): error TS2365: Operator '>=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(60,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(61,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(62,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(64,12): error TS2365: Operator '>=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(65,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(66,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(67,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(70,12): error TS2365: Operator '==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(71,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(72,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(73,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(75,12): error TS2365: Operator '==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(76,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(77,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(78,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(81,12): error TS2365: Operator '!=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(82,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(83,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(84,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(86,12): error TS2365: Operator '!=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(87,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(88,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(89,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(92,12): error TS2365: Operator '===' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(93,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(94,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(95,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(97,12): error TS2365: Operator '===' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(98,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(99,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(100,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(103,12): error TS2365: Operator '!==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(104,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(105,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(106,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(108,12): error TS2365: Operator '!==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(109,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(110,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(111,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts (64 errors) ====
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts (48 errors) ====
class Base {
public a: string;
}
@@ -100,8 +84,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r1a4 = a4 < b4;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r1b1 = b1 < a1;
~~~~~~~
@@ -113,8 +95,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r1b4 = b4 < a4;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator >
var r2a1 = a1 > b1;
@@ -127,8 +107,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r2a4 = a4 > b4;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r2b1 = b1 > a1;
~~~~~~~
@@ -140,8 +118,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r2b4 = b4 > a4;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator <=
var r3a1 = a1 <= b1;
@@ -154,8 +130,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r3a4 = a4 <= b4;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r3b1 = b1 <= a1;
~~~~~~~~
@@ -167,8 +141,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r3b4 = b4 <= a4;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator >=
var r4a1 = a1 >= b1;
@@ -181,8 +153,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r4a4 = a4 >= b4;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r4b1 = b1 >= a1;
~~~~~~~~
@@ -194,8 +164,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r4b4 = b4 >= a4;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator ==
var r5a1 = a1 == b1;
@@ -208,8 +176,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r5a4 = a4 == b4;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r5b1 = b1 == a1;
~~~~~~~~
@@ -221,8 +187,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r5b4 = b4 == a4;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator !=
var r6a1 = a1 != b1;
@@ -235,8 +199,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r6a4 = a4 != b4;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r6b1 = b1 != a1;
~~~~~~~~
@@ -248,8 +210,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r6b4 = b4 != a4;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator ===
var r7a1 = a1 === b1;
@@ -262,8 +222,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r7a4 = a4 === b4;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r7b1 = b1 === a1;
~~~~~~~~~
@@ -275,8 +233,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r7b4 = b4 === a4;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator !==
var r8a1 = a1 !== b1;
@@ -289,8 +245,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r8a4 = a4 !== b4;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r8b1 = b1 !== a1;
~~~~~~~~~
@@ -301,6 +255,4 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
var r8b3 = b3 !== a3;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r8b4 = b4 !== a4;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
var r8b4 = b4 !== a4;
@@ -98,7 +98,7 @@ x2 += E.a;
x2 += {};
>x2 += {} : string
>x2 : string
>{} : { [x: number]: undefined; }
>{} : {}
x2 += null;
>x2 += null : string
@@ -9,8 +9,8 @@ var a: any;
>a : any
var v = {
>v : { [0](): void; [""](): void; }
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [0](): void; [""](): void; }
>v : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; }
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; }
[s]() { },
>s : string
@@ -9,8 +9,8 @@ var a: any;
>a : any
var v = {
>v : { [0](): void; [""](): void; }
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [0](): void; [""](): void; }
>v : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; }
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; }
[s]() { },
>s : string
@@ -9,8 +9,8 @@ var a: any;
>a : any
var v = {
>v : { readonly [0]: number; [""]: any; }
>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [<any>true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { readonly [0]: number; [""]: any; }
>v : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; }
>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [<any>true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; }
get [s]() { return 0; },
>s : string
@@ -9,8 +9,8 @@ var a: any;
>a : any
var v = {
>v : { readonly [0]: number; [""]: any; }
>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [<any>true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { readonly [0]: number; [""]: any; }
>v : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; }
>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [<any>true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; }
get [s]() { return 0; },
>s : string
@@ -3,8 +3,8 @@ function foo() {
>foo : () => void
var obj = {
>obj : {}
>{ [this.bar]: 0 } : {}
>obj : { [x: number]: number; }
>{ [this.bar]: 0 } : { [x: number]: number; }
[this.bar]: 0
>this.bar : any
@@ -3,8 +3,8 @@ function foo() {
>foo : () => void
var obj = {
>obj : {}
>{ [this.bar]: 0 } : {}
>obj : { [x: number]: number; }
>{ [this.bar]: 0 } : { [x: number]: number; }
[this.bar]: 0
>this.bar : any
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts ===
var v = {
>v : {}
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {}
>v : { [x: number]: number | string; }
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; }
get [0 + 1]() { return 0 },
>0 + 1 : number
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts ===
var v = {
>v : {}
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {}
>v : { [x: number]: number | string; }
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; }
get [0 + 1]() { return 0 },
>0 + 1 : number
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts ===
var obj = {
>obj : {}
>{ [this.bar]: 0} : {}
>obj : { [x: number]: number; }
>{ [this.bar]: 0} : { [x: number]: number; }
[this.bar]: 0
>this.bar : any
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts ===
var obj = {
>obj : {}
>{ [this.bar]: 0} : {}
>obj : { [x: number]: number; }
>{ [this.bar]: 0} : { [x: number]: number; }
[this.bar]: 0
>this.bar : any
@@ -6,8 +6,8 @@ class C {
>bar : () => number
var obj = {
>obj : {}
>{ [this.bar()]() { } } : {}
>obj : { [x: number]: () => void; }
>{ [this.bar()]() { } } : { [x: number]: () => void; }
[this.bar()]() { }
>this.bar() : number
@@ -6,8 +6,8 @@ class C {
>bar : () => number
var obj = {
>obj : {}
>{ [this.bar()]() { } } : {}
>obj : { [x: number]: () => void; }
>{ [this.bar()]() { } } : { [x: number]: () => void; }
[this.bar()]() { }
>this.bar() : number
@@ -17,8 +17,8 @@ class C extends Base {
>foo : () => number
var obj = {
>obj : {}
>{ [super.bar()]() { } } : {}
>obj : { [x: number]: () => void; }
>{ [super.bar()]() { } } : { [x: number]: () => void; }
[super.bar()]() { }
>super.bar() : number
@@ -17,8 +17,8 @@ class C extends Base {
>foo : () => number
var obj = {
>obj : {}
>{ [super.bar()]() { } } : {}
>obj : { [x: number]: () => void; }
>{ [super.bar()]() { } } : { [x: number]: () => void; }
[super.bar()]() { }
>super.bar() : number
@@ -12,8 +12,8 @@ class C extends Base {
>super : typeof Base
var obj = {
>obj : {}
>{ [(super(), "prop")]() { } } : {}
>obj : { [x: string]: () => void; }
>{ [(super(), "prop")]() { } } : { [x: string]: () => void; }
[(super(), "prop")]() { }
>(super(), "prop") : string
@@ -12,8 +12,8 @@ class C extends Base {
>super : typeof Base
var obj = {
>obj : {}
>{ [(super(), "prop")]() { } } : {}
>obj : { [x: string]: () => void; }
>{ [(super(), "prop")]() { } } : { [x: string]: () => void; }
[(super(), "prop")]() { }
>(super(), "prop") : string
@@ -9,8 +9,8 @@ class C {
>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void
var obj = {
>obj : {}
>{ [this.bar()]() { } // needs capture } : {}
>obj : { [x: number]: () => void; }
>{ [this.bar()]() { } // needs capture } : { [x: number]: () => void; }
[this.bar()]() { } // needs capture
>this.bar() : number
@@ -9,8 +9,8 @@ class C {
>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void
var obj = {
>obj : {}
>{ [this.bar()]() { } // needs capture } : {}
>obj : { [x: number]: () => void; }
>{ [this.bar()]() { } // needs capture } : { [x: number]: () => void; }
[this.bar()]() { } // needs capture
>this.bar() : number
@@ -20,8 +20,8 @@ class C extends Base {
>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void
var obj = {
>obj : {}
>{ [super.bar()]() { } // needs capture } : {}
>obj : { [x: number]: () => void; }
>{ [super.bar()]() { } // needs capture } : { [x: number]: () => void; }
[super.bar()]() { } // needs capture
>super.bar() : number
@@ -20,8 +20,8 @@ class C extends Base {
>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void
var obj = {
>obj : {}
>{ [super.bar()]() { } // needs capture } : {}
>obj : { [x: number]: () => void; }
>{ [super.bar()]() { } // needs capture } : { [x: number]: () => void; }
[super.bar()]() { } // needs capture
>super.bar() : number
@@ -12,8 +12,8 @@ class C<T> {
>bar : () => number
var obj = {
>obj : {}
>{ [foo<T>()]() { } } : {}
>obj : { [x: string]: () => void; }
>{ [foo<T>()]() { } } : { [x: string]: () => void; }
[foo<T>()]() { }
>foo<T>() : string
@@ -12,8 +12,8 @@ class C<T> {
>bar : () => number
var obj = {
>obj : {}
>{ [foo<T>()]() { } } : {}
>obj : { [x: string]: () => void; }
>{ [foo<T>()]() { } } : { [x: string]: () => void; }
[foo<T>()]() { }
>foo<T>() : string
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts ===
var o = {
>o : {}
>{ ["" || 0]: 0} : {}
>o : { [x: string]: number; }
>{ ["" || 0]: 0} : { [x: string]: number; }
["" || 0]: 0
>"" || 0 : string | number
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts ===
var o = {
>o : {}
>{ ["" || 0]: 0} : {}
>o : { [x: string]: number; }
>{ ["" || 0]: 0} : { [x: string]: number; }
["" || 0]: 0
>"" || 0 : string | number
@@ -8,8 +8,8 @@ enum E2 { x }
>x : E2
var o = {
>o : {}
>{ [E1.x || E2.x]: 0} : {}
>o : { [x: number]: number; }
>{ [E1.x || E2.x]: 0} : { [x: number]: number; }
[E1.x || E2.x]: 0
>E1.x || E2.x : E1 | E2
@@ -8,8 +8,8 @@ enum E2 { x }
>x : E2
var o = {
>o : {}
>{ [E1.x || E2.x]: 0} : {}
>o : { [x: number]: number; }
>{ [E1.x || E2.x]: 0} : { [x: number]: number; }
[E1.x || E2.x]: 0
>E1.x || E2.x : E1 | E2
@@ -39,9 +39,9 @@ extractIndexer({
}); // Should return string
extractIndexer({
>extractIndexer({ ["" || 0]: ""}) : any
>extractIndexer({ ["" || 0]: ""}) : string
>extractIndexer : <T>(p: { [n: number]: T; }) => T
>{ ["" || 0]: ""} : { [x: number]: undefined; }
>{ ["" || 0]: ""} : { [x: string]: string; }
["" || 0]: ""
>"" || 0 : string | number
@@ -39,9 +39,9 @@ extractIndexer({
}); // Should return string
extractIndexer({
>extractIndexer({ ["" || 0]: ""}) : any
>extractIndexer({ ["" || 0]: ""}) : string
>extractIndexer : <T>(p: { [n: number]: T; }) => T
>{ ["" || 0]: ""} : { [x: number]: undefined; }
>{ ["" || 0]: ""} : { [x: string]: string; }
["" || 0]: ""
>"" || 0 : string | number
@@ -9,8 +9,8 @@ var a: any;
>a : any
var v = {
>v : { [0]: number; [""]: number; }
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [0]: number; [""]: number; }
>v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
[s]: 0,
>s : string
@@ -9,8 +9,8 @@ var a: any;
>a : any
var v = {
>v : { [0]: number; [""]: number; }
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [0]: number; [""]: number; }
>v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
[s]: 0,
>s : string
@@ -6,8 +6,8 @@ enum E {
>member : E
}
var v = {
>v : {}
>{ [E.member]: 0} : {}
>v : { [x: number]: number; }
>{ [E.member]: 0} : { [x: number]: number; }
[E.member]: 0
>E.member : E
@@ -6,8 +6,8 @@ enum E {
>member : E
}
var v = {
>v : {}
>{ [E.member]: 0} : {}
>v : { [x: number]: number; }
>{ [E.member]: 0} : { [x: number]: number; }
[E.member]: 0
>E.member : E
@@ -14,7 +14,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; }
>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; }
["" + 0](y) { return y.length; },
>"" + 0 : string
@@ -14,7 +14,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; }
>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; }
["" + 0](y) { return y.length; },
>"" + 0 : string
@@ -14,7 +14,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; }
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; }
[+"foo"](y) { return y.length; },
>+"foo" : number
@@ -14,7 +14,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; }
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; }
[+"foo"](y) { return y.length; },
>+"foo" : number
@@ -10,7 +10,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; }
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; }
[+"foo"](y) { return y.length; },
>+"foo" : number
@@ -10,7 +10,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; }
>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; }
[+"foo"](y) { return y.length; },
>+"foo" : number
@@ -12,7 +12,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; }
>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; }
[""+"foo"]: "",
>""+"foo" : string
@@ -12,7 +12,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; }
>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; }
[""+"foo"]: "",
>""+"foo" : string
@@ -12,7 +12,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; }
>{ [+"foo"]: "", [+"bar"]: 0} : { [x: number]: string | number; }
[+"foo"]: "",
>+"foo" : number
@@ -12,7 +12,7 @@ interface I {
var o: I = {
>o : I
>I : I
>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; }
>{ [+"foo"]: "", [+"bar"]: 0} : { [x: number]: string | number; }
[+"foo"]: "",
>+"foo" : number
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
foo({
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[]
>foo : <T>(obj: I<T>) => T
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; 0: () => void; p: string; }
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
p: "",
>p : string
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
foo({
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[]
>foo : <T>(obj: I<T>) => T
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; 0: () => void; p: string; }
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
p: "",
>p : string
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
foo({
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[]
>foo : <T>(obj: I<T>) => T
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
p: "",
>p : string
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
foo({
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[]
>foo : <T>(obj: I<T>) => T
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
p: "",
>p : string
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
Index signatures are incompatible.
Type 'string | number' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy
var o: I = {
~
!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'.
!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
Index signatures are incompatible.
Type 'string | number' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy
var o: I = {
~
!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'.
!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
Index signatures are incompatible.
Type 'string | number' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy
var o: I = {
~
!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'.
!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
Index signatures are incompatible.
Type 'string | number' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy
var o: I = {
~
!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'.
!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
@@ -26,4 +26,6 @@ var _a;
//// [computedPropertyNamesDeclarationEmit5_ES5.d.ts]
declare var v: {};
declare var v: {
[x: string]: any;
};
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts ===
var v = {
>v : {}
>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {}
>v : { [x: string]: any; }
>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : { [x: string]: any; }
["" + ""]: 0,
>"" + "" : string
@@ -16,4 +16,6 @@ var v = {
//// [computedPropertyNamesDeclarationEmit5_ES6.d.ts]
declare var v: {};
declare var v: {
[x: string]: any;
};
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts ===
var v = {
>v : {}
>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {}
>v : { [x: string]: any; }
>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : { [x: string]: any; }
["" + ""]: 0,
>"" + "" : string
@@ -35,7 +35,7 @@ var o: {
>idx : number
} = {
>{ 1: true } : { [x: number]: boolean; 1: boolean; }
>{ 1: true } : { 1: boolean; }
1: true
>true : boolean
@@ -0,0 +1,15 @@
tests/cases/compiler/contextualTypeAny.ts(3,5): error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'.
Property 'p' is incompatible with index signature.
Type 'string' is not assignable to type 'number'.
==== tests/cases/compiler/contextualTypeAny.ts (1 errors) ====
var x: any;
var obj: { [s: string]: number } = { p: "", q: x };
~~~
!!! error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'.
!!! error TS2322: Property 'p' is incompatible with index signature.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
var arr: number[] = ["", x];
@@ -1,15 +0,0 @@
=== tests/cases/compiler/contextualTypeAny.ts ===
var x: any;
>x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3))
var obj: { [s: string]: number } = { p: "", q: x };
>obj : Symbol(obj, Decl(contextualTypeAny.ts, 2, 3))
>s : Symbol(s, Decl(contextualTypeAny.ts, 2, 12))
>p : Symbol(p, Decl(contextualTypeAny.ts, 2, 36))
>q : Symbol(q, Decl(contextualTypeAny.ts, 2, 43))
>x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3))
var arr: number[] = ["", x];
>arr : Symbol(arr, Decl(contextualTypeAny.ts, 4, 3))
>x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3))
@@ -1,19 +0,0 @@
=== tests/cases/compiler/contextualTypeAny.ts ===
var x: any;
>x : any
var obj: { [s: string]: number } = { p: "", q: x };
>obj : { [s: string]: number; }
>s : string
>{ p: "", q: x } : { [x: string]: any; p: string; q: any; }
>p : string
>"" : string
>q : any
>x : any
var arr: number[] = ["", x];
>arr : number[]
>["", x] : any[]
>"" : string
>x : any
@@ -26,18 +26,18 @@ interface Transform3D {
var style: IBookStyle = {
>style : IBookStyle
>IBookStyle : IBookStyle
>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { [x: string]: any; 'ry': any; }[]; }
>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { 'ry': any; }[]; }
initialLeftPageTransforms: (width: number) => {
>initialLeftPageTransforms : (width: number) => { [x: string]: any; 'ry': any; }[]
>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { [x: string]: any; 'ry': any; }[]
>initialLeftPageTransforms : (width: number) => { 'ry': any; }[]
>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { 'ry': any; }[]
>width : number
return [
>[ {'ry': null } ] : { [x: string]: null; 'ry': null; }[]
>[ {'ry': null } ] : { 'ry': null; }[]
{'ry': null }
>{'ry': null } : { [x: string]: null; 'ry': null; }
>{'ry': null } : { 'ry': null; }
>null : null
];
@@ -69,7 +69,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { z: a => a };
>x : IWithNoStringIndexSignature | IWithStringIndexSignature1
>IWithNoStringIndexSignature : IWithNoStringIndexSignature
>IWithStringIndexSignature1 : IWithStringIndexSignature1
>{ z: a => a } : { [x: string]: (a: number) => number; z: (a: number) => number; }
>{ z: a => a } : { z: (a: number) => number; }
>z : (a: number) => number
>a => a : (a: number) => number
>a : number
@@ -79,7 +79,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { foo: a => a
>x : IWithNoStringIndexSignature | IWithStringIndexSignature1
>IWithNoStringIndexSignature : IWithNoStringIndexSignature
>IWithStringIndexSignature1 : IWithStringIndexSignature1
>{ foo: a => a } : { [x: string]: (a: any) => any; foo: (a: any) => any; }
>{ foo: a => a } : { foo: (a: any) => any; }
>foo : (a: any) => any
>a => a : (a: any) => any
>a : any
@@ -89,7 +89,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { foo: "hello"
>x : IWithNoStringIndexSignature | IWithStringIndexSignature1
>IWithNoStringIndexSignature : IWithNoStringIndexSignature
>IWithStringIndexSignature1 : IWithStringIndexSignature1
>{ foo: "hello" } : { [x: string]: string; foo: string; }
>{ foo: "hello" } : { foo: string; }
>foo : string
>"hello" : string
@@ -97,7 +97,7 @@ var x2: IWithStringIndexSignature1 | IWithStringIndexSignature2 = { z: a => a.to
>x2 : IWithStringIndexSignature1 | IWithStringIndexSignature2
>IWithStringIndexSignature1 : IWithStringIndexSignature1
>IWithStringIndexSignature2 : IWithStringIndexSignature2
>{ z: a => a.toString() } : { [x: string]: (a: number) => string; z: (a: number) => string; }
>{ z: a => a.toString() } : { z: (a: number) => string; }
>z : (a: number) => string
>a => a.toString() : (a: number) => string
>a : number
@@ -110,7 +110,7 @@ var x2: IWithStringIndexSignature1 | IWithStringIndexSignature2 = { z: a => a };
>x2 : IWithStringIndexSignature1 | IWithStringIndexSignature2
>IWithStringIndexSignature1 : IWithStringIndexSignature1
>IWithStringIndexSignature2 : IWithStringIndexSignature2
>{ z: a => a } : { [x: string]: (a: number) => number; z: (a: number) => number; }
>{ z: a => a } : { z: (a: number) => number; }
>z : (a: number) => number
>a => a : (a: number) => number
>a : number
@@ -124,7 +124,7 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 1: a => a }
>x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1
>IWithNoNumberIndexSignature : IWithNoNumberIndexSignature
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
>{ 1: a => a } : { [x: number]: (a: number) => number; 1: (a: number) => number; }
>{ 1: a => a } : { 1: (a: number) => number; }
>a => a : (a: number) => number
>a : number
>a : number
@@ -133,7 +133,7 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 0: a => a }
>x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1
>IWithNoNumberIndexSignature : IWithNoNumberIndexSignature
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
>{ 0: a => a } : { [x: number]: (a: any) => any; 0: (a: any) => any; }
>{ 0: a => a } : { 0: (a: any) => any; }
>a => a : (a: any) => any
>a : any
>a : any
@@ -142,14 +142,14 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 0: "hello"
>x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1
>IWithNoNumberIndexSignature : IWithNoNumberIndexSignature
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
>{ 0: "hello" } : { [x: number]: string; 0: string; }
>{ 0: "hello" } : { 0: string; }
>"hello" : string
var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a.toString() }; // a should be number
>x4 : IWithNumberIndexSignature1 | IWithNumberIndexSignature2
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
>IWithNumberIndexSignature2 : IWithNumberIndexSignature2
>{ 1: a => a.toString() } : { [x: number]: (a: number) => string; 1: (a: number) => string; }
>{ 1: a => a.toString() } : { 1: (a: number) => string; }
>a => a.toString() : (a: number) => string
>a : number
>a.toString() : string
@@ -161,7 +161,7 @@ var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a };
>x4 : IWithNumberIndexSignature1 | IWithNumberIndexSignature2
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
>IWithNumberIndexSignature2 : IWithNumberIndexSignature2
>{ 1: a => a } : { [x: number]: (a: number) => number; 1: (a: number) => number; }
>{ 1: a => a } : { 1: (a: number) => number; }
>a => a : (a: number) => number
>a : number
>a : number
@@ -1,23 +0,0 @@
tests/cases/compiler/contextualTypingOfObjectLiterals.ts(4,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }'.
Index signature is missing in type '{ x: string; }'.
tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.
Index signature is missing in type '{ x: string; }'.
==== tests/cases/compiler/contextualTypingOfObjectLiterals.ts (2 errors) ====
var obj1: { [x: string]: string; };
var obj2 = {x: ""};
obj1 = {}; // Ok
obj1 = obj2; // Error - indexer doesn't match
~~~~
!!! error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }'.
!!! error TS2322: Index signature is missing in type '{ x: string; }'.
function f(x: { [s: string]: string }) { }
f({}); // Ok
f(obj1); // Ok
f(obj2); // Error - indexer doesn't match
~~~~
!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.
!!! error TS2345: Index signature is missing in type '{ x: string; }'.
@@ -0,0 +1,32 @@
=== tests/cases/compiler/contextualTypingOfObjectLiterals.ts ===
var obj1: { [x: string]: string; };
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))
>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 0, 13))
var obj2 = {x: ""};
>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3))
>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 1, 12))
obj1 = {}; // Ok
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))
obj1 = obj2; // Error - indexer doesn't match
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))
>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3))
function f(x: { [s: string]: string }) { }
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))
>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 5, 11))
>s : Symbol(s, Decl(contextualTypingOfObjectLiterals.ts, 5, 17))
f({}); // Ok
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))
f(obj1); // Ok
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))
f(obj2); // Error - indexer doesn't match
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))
>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3))
@@ -0,0 +1,41 @@
=== tests/cases/compiler/contextualTypingOfObjectLiterals.ts ===
var obj1: { [x: string]: string; };
>obj1 : { [x: string]: string; }
>x : string
var obj2 = {x: ""};
>obj2 : { x: string; }
>{x: ""} : { x: string; }
>x : string
>"" : string
obj1 = {}; // Ok
>obj1 = {} : {}
>obj1 : { [x: string]: string; }
>{} : {}
obj1 = obj2; // Error - indexer doesn't match
>obj1 = obj2 : { x: string; }
>obj1 : { [x: string]: string; }
>obj2 : { x: string; }
function f(x: { [s: string]: string }) { }
>f : (x: { [s: string]: string; }) => void
>x : { [s: string]: string; }
>s : string
f({}); // Ok
>f({}) : void
>f : (x: { [s: string]: string; }) => void
>{} : {}
f(obj1); // Ok
>f(obj1) : void
>f : (x: { [s: string]: string; }) => void
>obj1 : { [x: string]: string; }
f(obj2); // Error - indexer doesn't match
>f(obj2) : void
>f : (x: { [s: string]: string; }) => void
>obj2 : { x: string; }
@@ -0,0 +1,16 @@
//// [declarationEmitIdentifierPredicates01.ts]
export function f(x: any): x is number {
return typeof x === "number";
}
//// [declarationEmitIdentifierPredicates01.js]
"use strict";
function f(x) {
return typeof x === "number";
}
exports.f = f;
//// [declarationEmitIdentifierPredicates01.d.ts]
export declare function f(x: any): x is number;
@@ -0,0 +1,10 @@
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts ===
export function f(x: any): x is number {
>f : Symbol(f, Decl(declarationEmitIdentifierPredicates01.ts, 0, 0))
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
return typeof x === "number";
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
}

Some files were not shown because too many files have changed in this diff Show More