merge with master

This commit is contained in:
Vladimir Matveev 2015-06-24 15:17:12 -07:00
commit 9e81ac9bff
172 changed files with 4104 additions and 1465 deletions

View file

@ -103,7 +103,7 @@ var serverSources = [
"server.ts"
].map(function (f) {
return path.join(serverDirectory, f);
});
}).concat(servicesSources);
var languageServiceLibrarySources = [
"editorServices.ts",

View file

@ -1880,6 +1880,7 @@ interface Map<K, V> {
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(): Map<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
@ -1896,6 +1897,7 @@ interface WeakMap<K, V> {
}
interface WeakMapConstructor {
new (): WeakMap<any, any>;
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
@ -1917,6 +1919,7 @@ interface Set<T> {
}
interface SetConstructor {
new (): Set<any>;
new <T>(): Set<T>;
new <T>(iterable: Iterable<T>): Set<T>;
prototype: Set<any>;
@ -1932,6 +1935,7 @@ interface WeakSet<T> {
}
interface WeakSetConstructor {
new (): WeakSet<any>;
new <T>(): WeakSet<T>;
new <T>(iterable: Iterable<T>): WeakSet<T>;
prototype: WeakSet<any>;

4
bin/lib.es6.d.ts vendored
View file

@ -1880,6 +1880,7 @@ interface Map<K, V> {
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(): Map<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
@ -1896,6 +1897,7 @@ interface WeakMap<K, V> {
}
interface WeakMapConstructor {
new (): WeakMap<any, any>;
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
@ -1917,6 +1919,7 @@ interface Set<T> {
}
interface SetConstructor {
new (): Set<any>;
new <T>(): Set<T>;
new <T>(iterable: Iterable<T>): Set<T>;
prototype: Set<any>;
@ -1932,6 +1935,7 @@ interface WeakSet<T> {
}
interface WeakSetConstructor {
new (): WeakSet<any>;
new <T>(): WeakSet<T>;
new <T>(iterable: Iterable<T>): WeakSet<T>;
prototype: WeakSet<any>;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

2
bin/typescript.d.ts vendored
View file

@ -600,7 +600,7 @@ declare module "typescript" {
tag: LeftHandSideExpression;
template: LiteralExpression | TemplateExpression;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
interface TypeAssertion extends UnaryExpression {
type: TypeNode;
expression: UnaryExpression;

File diff suppressed because it is too large Load diff

View file

@ -600,7 +600,7 @@ declare namespace ts {
tag: LeftHandSideExpression;
template: LiteralExpression | TemplateExpression;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
interface TypeAssertion extends UnaryExpression {
type: TypeNode;
expression: UnaryExpression;

File diff suppressed because it is too large Load diff

View file

@ -630,7 +630,7 @@ namespace ts {
function getStrictModeIdentifierMessage(node: Node) {
// Provide specialized messages to help the user understand why we think they're in
// strict mode.
if (getAncestor(node, SyntaxKind.ClassDeclaration) || getAncestor(node, SyntaxKind.ClassExpression)) {
if (getContainingClass(node)) {
return Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;
}
@ -688,7 +688,7 @@ namespace ts {
function getStrictModeEvalOrArgumentsMessage(node: Node) {
// Provide specialized messages to help the user understand why we think they're in
// strict mode.
if (getAncestor(node, SyntaxKind.ClassDeclaration) || getAncestor(node, SyntaxKind.ClassExpression)) {
if (getContainingClass(node)) {
return Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;
}
@ -1031,7 +1031,7 @@ namespace ts {
// containing class.
if (node.flags & NodeFlags.AccessibilityModifier &&
node.parent.kind === SyntaxKind.Constructor &&
(node.parent.parent.kind === SyntaxKind.ClassDeclaration || node.parent.parent.kind === SyntaxKind.ClassExpression)) {
isClassLike(node.parent.parent)) {
let classDeclaration = <ClassLikeDeclaration>node.parent.parent;
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);

File diff suppressed because it is too large Load diff

View file

@ -191,6 +191,12 @@ namespace ts {
An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: DiagnosticCategory.Error, key: "An export declaration can only be used in a module." },
An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." },
A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." },
The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." },
The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." },
Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." },
Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: DiagnosticCategory.Error, key: "Unable to resolve signature of parameter decorator when called as an expression." },
Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: DiagnosticCategory.Error, key: "Unable to resolve signature of property decorator when called as an expression." },
Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: DiagnosticCategory.Error, key: "Unable to resolve signature of method decorator when called as an expression." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@ -567,7 +573,5 @@ namespace ts {
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
};
}

View file

@ -753,6 +753,31 @@
},
"The return type of a property decorator function must be either 'void' or 'any'.": {
"category": "Error",
"code": 1236
},
"The return type of a parameter decorator function must be either 'void' or 'any'.": {
"category": "Error",
"code": 1237
},
"Unable to resolve signature of class decorator when called as an expression.": {
"category": "Error",
"code": 1238
},
"Unable to resolve signature of parameter decorator when called as an expression.": {
"category": "Error",
"code": 1239
},
"Unable to resolve signature of property decorator when called as an expression.": {
"category": "Error",
"code": 1240
},
"Unable to resolve signature of method decorator when called as an expression.": {
"category": "Error",
"code": 1241
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@ -2259,14 +2284,5 @@
"'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
},
"'class' expressions are not currently supported.": {
"category": "Error",
"code": 9003
}
}

View file

@ -264,6 +264,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
return makeUniqueName("default");
}
function generateNameForClassExpression() {
return makeUniqueName("class");
}
function generateNameForNode(node: Node) {
switch (node.kind) {
case SyntaxKind.Identifier:
@ -276,9 +280,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
return generateNameForImportOrExportDeclaration(<ImportDeclaration | ExportDeclaration>node);
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.ExportAssignment:
return generateNameForExportDefault();
case SyntaxKind.ClassExpression:
return generateNameForClassExpression();
}
}
@ -1778,7 +1783,21 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
emit(node.expression);
let indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken);
write(".");
// 1 .toString is a valid property access, emit a space after the literal
let shouldEmitSpace: boolean;
if (!indentedBeforeDot && node.expression.kind === SyntaxKind.NumericLiteral) {
let text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression);
shouldEmitSpace = text.indexOf(tokenToString(SyntaxKind.DotToken)) < 0;
}
if (shouldEmitSpace) {
write(" .");
}
else {
write(".");
}
let indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name);
emit(node.name);
decreaseIndentIf(indentedBeforeDot, indentedAfterDot);
@ -3135,33 +3154,49 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
function emitDefaultValueAssignments(node: FunctionLikeDeclaration) {
if (languageVersion < ScriptTarget.ES6) {
let tempIndex = 0;
forEach(node.parameters, p => {
forEach(node.parameters, parameter => {
// A rest parameter cannot have a binding pattern or an initializer,
// so let's just ignore it.
if (p.dotDotDotToken) {
if (parameter.dotDotDotToken) {
return;
}
if (isBindingPattern(p.name)) {
writeLine();
write("var ");
emitDestructuring(p, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]);
write(";");
tempIndex++;
let { name: paramName, initializer } = parameter;
if (isBindingPattern(paramName)) {
// In cases where a binding pattern is simply '[]' or '{}',
// we usually don't want to emit a var declaration; however, in the presence
// of an initializer, we must emit that expression to preserve side effects.
let hasBindingElements = paramName.elements.length > 0;
if (hasBindingElements || initializer) {
writeLine();
write("var ");
if (hasBindingElements) {
emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]);
}
else {
emit(tempParameters[tempIndex]);
write(" = ");
emit(initializer);
}
write(";");
tempIndex++;
}
}
else if (p.initializer) {
else if (initializer) {
writeLine();
emitStart(p);
emitStart(parameter);
write("if (");
emitNodeWithoutSourceMap(p.name);
emitNodeWithoutSourceMap(paramName);
write(" === void 0)");
emitEnd(p);
emitEnd(parameter);
write(" { ");
emitStart(p);
emitNodeWithoutSourceMap(p.name);
emitStart(parameter);
emitNodeWithoutSourceMap(paramName);
write(" = ");
emitNodeWithoutSourceMap(p.initializer);
emitEnd(p);
emitNodeWithoutSourceMap(initializer);
emitEnd(parameter);
write("; }");
}
});

View file

@ -797,7 +797,7 @@ namespace ts {
template: LiteralExpression | TemplateExpression;
}
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
export interface TypeAssertion extends UnaryExpression {
type: TypeNode;
@ -1891,7 +1891,7 @@ namespace ts {
CarriageReturnLineFeed = 0,
LineFeed = 1,
}
export interface LineAndCharacter {
line: number;
/*

View file

@ -576,6 +576,7 @@ namespace ts {
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
@ -613,26 +614,15 @@ namespace ts {
return true;
}
}
return false;
}
export function isAccessor(node: Node): boolean {
if (node) {
switch (node.kind) {
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return true;
}
}
return false;
return node && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor);
}
export function isClassLike(node: Node): boolean {
if (node) {
return node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression;
}
return node && (node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression);
}
export function isFunctionLike(node: Node): boolean {
@ -654,7 +644,6 @@ namespace ts {
return true;
}
}
return false;
}
@ -675,6 +664,15 @@ namespace ts {
}
}
export function getContainingClass(node: Node): ClassLikeDeclaration {
while (true) {
node = node.parent;
if (!node || isClassLike(node)) {
return <ClassLikeDeclaration>node;
}
}
}
export function getThisContainer(node: Node, includeArrowFunctions: boolean): Node {
while (true) {
node = node.parent;
@ -687,7 +685,7 @@ namespace ts {
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
// so that we can error on it.
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
if (isClassLike(node.parent.parent)) {
return node;
}
// If this is a computed property, then the parent should not
@ -742,7 +740,7 @@ namespace ts {
// then the computed property is not a 'super' container.
// A computed property name in a class needs to be a super container
// so that we can error on it.
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
if (isClassLike(node.parent.parent)) {
return node;
}
// If this is a computed property, then the parent should not
@ -788,8 +786,8 @@ namespace ts {
return (<TaggedTemplateExpression>node).tag;
}
// Will either be a CallExpression or NewExpression.
return (<CallExpression>node).expression;
// Will either be a CallExpression, NewExpression, or Decorator.
return (<CallExpression | Decorator>node).expression;
}
export function nodeCanBeDecorated(node: Node): boolean {
@ -1101,7 +1099,7 @@ namespace ts {
return SyntaxKind.FirstTemplateToken <= kind && kind <= SyntaxKind.LastTemplateToken;
}
export function isBindingPattern(node: Node) {
export function isBindingPattern(node: Node): node is BindingPattern {
return !!node && (node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern);
}
@ -1121,6 +1119,7 @@ namespace ts {
case SyntaxKind.ArrowFunction:
case SyntaxKind.BindingElement:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.Constructor:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.EnumMember:
@ -1269,7 +1268,7 @@ namespace ts {
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
export function getClassImplementsHeritageClauseElements(node: ClassDeclaration) {
export function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration) {
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
return heritageClause ? heritageClause.types : undefined;
}
@ -1951,7 +1950,7 @@ namespace ts {
export function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean {
return node.kind === SyntaxKind.ExpressionWithTypeArguments &&
(<HeritageClause>node.parent).token === SyntaxKind.ExtendsKeyword &&
node.parent.parent.kind === SyntaxKind.ClassDeclaration;
isClassLike(node.parent.parent);
}
// Returns false if this heritage clause element's expression contains something unsupported

4
src/lib/es6.d.ts vendored
View file

@ -694,6 +694,7 @@ interface Map<K, V> {
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(): Map<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
@ -710,6 +711,7 @@ interface WeakMap<K, V> {
}
interface WeakMapConstructor {
new (): WeakMap<any, any>;
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
@ -731,6 +733,7 @@ interface Set<T> {
}
interface SetConstructor {
new (): Set<any>;
new <T>(): Set<T>;
new <T>(iterable: Iterable<T>): Set<T>;
prototype: Set<any>;
@ -746,6 +749,7 @@ interface WeakSet<T> {
}
interface WeakSetConstructor {
new (): WeakSet<any>;
new <T>(): WeakSet<T>;
new <T>(iterable: Iterable<T>): WeakSet<T>;
prototype: WeakSet<any>;

View file

@ -318,7 +318,7 @@ namespace ts.formatting {
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
// Add a space around certain TypeScript keywords
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {

View file

@ -26,7 +26,7 @@ namespace ts.formatting {
precedingToken.kind === SyntaxKind.TemplateHead ||
precedingToken.kind === SyntaxKind.TemplateMiddle ||
precedingToken.kind === SyntaxKind.TemplateTail;
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
return 0;
}
@ -66,6 +66,10 @@ namespace ts.formatting {
if (actualIndentation !== Value.Unknown) {
return actualIndentation;
}
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
if (actualIndentation !== Value.Unknown) {
return actualIndentation + options.IndentSize;
}
previous = current;
current = current.parent;
@ -122,6 +126,10 @@ namespace ts.formatting {
if (actualIndentation !== Value.Unknown) {
return actualIndentation + indentationDelta;
}
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
if (actualIndentation !== Value.Unknown) {
return actualIndentation + indentationDelta;
}
}
// increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line
@ -287,6 +295,55 @@ namespace ts.formatting {
}
}
function getLineIndentationWhenExpressionIsInMultiLine(node: Node, sourceFile: SourceFile, options: EditorOptions): number {
// actual indentation should not be used when:
// - node is close parenthesis - this is the end of the expression
if (node.kind === SyntaxKind.CloseParenToken) {
return Value.Unknown;
}
if (node.parent && (
node.parent.kind === SyntaxKind.CallExpression ||
node.parent.kind === SyntaxKind.NewExpression) &&
(<CallExpression>node.parent).expression !== node) {
let fullCallOrNewExpression = (<CallExpression | NewExpression>node.parent).expression;
let startingExpression = getStartingExpression(<PropertyAccessExpression | CallExpression | ElementAccessExpression>fullCallOrNewExpression);
if (fullCallOrNewExpression === startingExpression) {
return Value.Unknown;
}
let fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);
let startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);
if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {
return Value.Unknown;
}
return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);
}
return Value.Unknown;
function getStartingExpression(node: PropertyAccessExpression | CallExpression | ElementAccessExpression) {
while (true) {
switch (node.kind) {
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
node = <PropertyAccessExpression | CallExpression | ElementAccessExpression | PropertyAccessExpression>node.expression;
break;
default:
return node;
}
}
return node;
}
}
function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number {
Debug.assert(index >= 0 && index < list.length);
let node = list[index];

View file

@ -1,9 +0,0 @@
tests/cases/compiler/anonymousClassExpression1.ts(2,19): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/anonymousClassExpression1.ts (1 errors) ====
function f() {
return typeof class {} === "function";
~~~~~
!!! error TS9003: 'class' expressions are not currently supported.
}

View file

@ -6,8 +6,8 @@ function f() {
//// [anonymousClassExpression1.js]
function f() {
return typeof (function () {
function default_1() {
function class_1() {
}
return default_1;
return class_1;
})() === "function";
}

View file

@ -0,0 +1,6 @@
=== tests/cases/compiler/anonymousClassExpression1.ts ===
function f() {
>f : Symbol(f, Decl(anonymousClassExpression1.ts, 0, 0))
return typeof class {} === "function";
}

View file

@ -0,0 +1,10 @@
=== tests/cases/compiler/anonymousClassExpression1.ts ===
function f() {
>f : () => boolean
return typeof class {} === "function";
>typeof class {} === "function" : boolean
>typeof class {} : string
>class {} : typeof (Anonymous class)
>"function" : string
}

View file

@ -1,24 +0,0 @@
tests/cases/conformance/classes/classExpression.ts(1,15): error TS9003: 'class' expressions are not currently supported.
tests/cases/conformance/classes/classExpression.ts(5,16): error TS9003: 'class' expressions are not currently supported.
tests/cases/conformance/classes/classExpression.ts(10,19): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/classes/classExpression.ts (3 errors) ====
var x = class C {
~
!!! error TS9003: 'class' expressions are not currently supported.
}
var y = {
foo: class C2 {
~~
!!! error TS9003: 'class' expressions are not currently supported.
}
}
module M {
var z = class C4 {
~~
!!! error TS9003: 'class' expressions are not currently supported.
}
}

View file

@ -0,0 +1,23 @@
=== tests/cases/conformance/classes/classExpression.ts ===
var x = class C {
>x : Symbol(x, Decl(classExpression.ts, 0, 3))
>C : Symbol(C, Decl(classExpression.ts, 0, 7))
}
var y = {
>y : Symbol(y, Decl(classExpression.ts, 3, 3))
foo: class C2 {
>foo : Symbol(foo, Decl(classExpression.ts, 3, 9))
>C2 : Symbol(C2, Decl(classExpression.ts, 4, 8))
}
}
module M {
>M : Symbol(M, Decl(classExpression.ts, 6, 1))
var z = class C4 {
>z : Symbol(z, Decl(classExpression.ts, 9, 7))
>C4 : Symbol(C4, Decl(classExpression.ts, 9, 11))
}
}

View file

@ -0,0 +1,27 @@
=== tests/cases/conformance/classes/classExpression.ts ===
var x = class C {
>x : typeof C
>class C {} : typeof C
>C : typeof C
}
var y = {
>y : { foo: typeof C2; }
>{ foo: class C2 { }} : { foo: typeof C2; }
foo: class C2 {
>foo : typeof C2
>class C2 { } : typeof C2
>C2 : typeof C2
}
}
module M {
>M : typeof M
var z = class C4 {
>z : typeof C4
>class C4 { } : typeof C4
>C4 : typeof C4
}
}

View file

@ -1,7 +0,0 @@
tests/cases/conformance/classes/classExpressions/classExpression1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/classes/classExpressions/classExpression1.ts (1 errors) ====
var v = class C {};
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,5 @@
=== tests/cases/conformance/classes/classExpressions/classExpression1.ts ===
var v = class C {};
>v : Symbol(v, Decl(classExpression1.ts, 0, 3))
>C : Symbol(C, Decl(classExpression1.ts, 0, 7))

View file

@ -0,0 +1,6 @@
=== tests/cases/conformance/classes/classExpressions/classExpression1.ts ===
var v = class C {};
>v : typeof C
>class C {} : typeof C
>C : typeof C

View file

@ -1,8 +0,0 @@
tests/cases/conformance/classes/classExpressions/classExpression2.ts(2,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/classes/classExpressions/classExpression2.ts (1 errors) ====
class D { }
var v = class C extends D {};
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -3,6 +3,11 @@ class D { }
var v = class C extends D {};
//// [classExpression2.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 D = (function () {
function D() {
}

View file

@ -0,0 +1,9 @@
=== tests/cases/conformance/classes/classExpressions/classExpression2.ts ===
class D { }
>D : Symbol(D, Decl(classExpression2.ts, 0, 0))
var v = class C extends D {};
>v : Symbol(v, Decl(classExpression2.ts, 1, 3))
>C : Symbol(C, Decl(classExpression2.ts, 1, 7))
>D : Symbol(D, Decl(classExpression2.ts, 0, 0))

View file

@ -0,0 +1,10 @@
=== tests/cases/conformance/classes/classExpressions/classExpression2.ts ===
class D { }
>D : D
var v = class C extends D {};
>v : typeof C
>class C extends D {} : typeof C
>C : typeof C
>D : D

View file

@ -0,0 +1,38 @@
//// [classExpression3.ts]
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
let c = new C();
c.a;
c.b;
c.c;
//// [classExpression3.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 C = (function (_super) {
__extends(class_1, _super);
function class_1() {
_super.apply(this, arguments);
this.c = 3;
}
return class_1;
})((function (_super) {
__extends(class_2, _super);
function class_2() {
_super.apply(this, arguments);
this.b = 2;
}
return class_2;
})((function () {
function class_3() {
this.a = 1;
}
return class_3;
})()));
var c = new C();
c.a;
c.b;
c.c;

View file

@ -0,0 +1,26 @@
=== tests/cases/conformance/classes/classExpressions/classExpression3.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : Symbol(C, Decl(classExpression3.ts, 0, 3))
>a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
>b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
>c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
let c = new C();
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>C : Symbol(C, Decl(classExpression3.ts, 0, 3))
c.a;
>c.a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
c.b;
>c.b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
c.c;
>c.c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))

View file

@ -0,0 +1,33 @@
=== tests/cases/conformance/classes/classExpressions/classExpression3.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : typeof (Anonymous class)
>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class)
>class extends class { a = 1 } { b = 2 } : (Anonymous class)
>class { a = 1 } : (Anonymous class)
>a : number
>1 : number
>b : number
>2 : number
>c : number
>3 : number
let c = new C();
>c : (Anonymous class)
>new C() : (Anonymous class)
>C : typeof (Anonymous class)
c.a;
>c.a : number
>c : (Anonymous class)
>a : number
c.b;
>c.b : number
>c : (Anonymous class)
>b : number
c.c;
>c.c : number
>c : (Anonymous class)
>c : number

View file

@ -0,0 +1,19 @@
//// [classExpression4.ts]
let C = class {
foo() {
return new C();
}
};
let x = (new C).foo();
//// [classExpression4.js]
var C = (function () {
function class_1() {
}
class_1.prototype.foo = function () {
return new C();
};
return class_1;
})();
var x = (new C).foo();

View file

@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/classExpressions/classExpression4.ts ===
let C = class {
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
foo() {
>foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
return new C();
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
}
};
let x = (new C).foo();
>x : Symbol(x, Decl(classExpression4.ts, 5, 3))
>(new C).foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
>foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))

View file

@ -0,0 +1,22 @@
=== tests/cases/conformance/classes/classExpressions/classExpression4.ts ===
let C = class {
>C : typeof (Anonymous class)
>class { foo() { return new C(); }} : typeof (Anonymous class)
foo() {
>foo : () => (Anonymous class)
return new C();
>new C() : (Anonymous class)
>C : typeof (Anonymous class)
}
};
let x = (new C).foo();
>x : (Anonymous class)
>(new C).foo() : (Anonymous class)
>(new C).foo : () => (Anonymous class)
>(new C) : (Anonymous class)
>new C : (Anonymous class)
>C : typeof (Anonymous class)
>foo : () => (Anonymous class)

View file

@ -1,7 +0,0 @@
tests/cases/conformance/es6/classExpressions/classExpressionES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts (1 errors) ====
var v = class C {};
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,5 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts ===
var v = class C {};
>v : Symbol(v, Decl(classExpressionES61.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionES61.ts, 0, 7))

View file

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts ===
var v = class C {};
>v : typeof C
>class C {} : typeof C
>C : typeof C

View file

@ -1,8 +0,0 @@
tests/cases/conformance/es6/classExpressions/classExpressionES62.ts(2,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts (1 errors) ====
class D { }
var v = class C extends D {};
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,9 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts ===
class D { }
>D : Symbol(D, Decl(classExpressionES62.ts, 0, 0))
var v = class C extends D {};
>v : Symbol(v, Decl(classExpressionES62.ts, 1, 3))
>C : Symbol(C, Decl(classExpressionES62.ts, 1, 7))
>D : Symbol(D, Decl(classExpressionES62.ts, 0, 0))

View file

@ -0,0 +1,10 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts ===
class D { }
>D : D
var v = class C extends D {};
>v : typeof C
>class C extends D {} : typeof C
>C : typeof C
>D : D

View file

@ -0,0 +1,31 @@
//// [classExpressionES63.ts]
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
let c = new C();
c.a;
c.b;
c.c;
//// [classExpressionES63.js]
let C = class class_1 extends class class_2 extends class class_3 {
constructor() {
this.a = 1;
}
}
{
constructor(...args) {
super(...args);
this.b = 2;
}
}
{
constructor(...args) {
super(...args);
this.c = 3;
}
}
;
let c = new C();
c.a;
c.b;
c.c;

View file

@ -0,0 +1,26 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES63.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : Symbol(C, Decl(classExpressionES63.ts, 0, 3))
>a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
>b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
>c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
let c = new C();
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>C : Symbol(C, Decl(classExpressionES63.ts, 0, 3))
c.a;
>c.a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
c.b;
>c.b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
c.c;
>c.c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))

View file

@ -0,0 +1,33 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES63.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : typeof (Anonymous class)
>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class)
>class extends class { a = 1 } { b = 2 } : (Anonymous class)
>class { a = 1 } : (Anonymous class)
>a : number
>1 : number
>b : number
>2 : number
>c : number
>3 : number
let c = new C();
>c : (Anonymous class)
>new C() : (Anonymous class)
>C : typeof (Anonymous class)
c.a;
>c.a : number
>c : (Anonymous class)
>a : number
c.b;
>c.b : number
>c : (Anonymous class)
>b : number
c.c;
>c.c : number
>c : (Anonymous class)
>c : number

View file

@ -1,21 +0,0 @@
tests/cases/compiler/classExpressionTest2.ts(2,19): error TS9003: 'class' expressions are not currently supported.
tests/cases/compiler/classExpressionTest2.ts(5,20): error TS2304: Cannot find name 'X'.
==== tests/cases/compiler/classExpressionTest2.ts (2 errors) ====
function M() {
var m = class C<X> {
~
!!! error TS9003: 'class' expressions are not currently supported.
f<T>() {
var t: T;
var x: X;
~
!!! error TS2304: Cannot find name 'X'.
return { t, x };
}
}
var v = new m<number>();
return v.f<string>();
}

View file

@ -0,0 +1,36 @@
=== tests/cases/compiler/classExpressionTest2.ts ===
function M() {
>M : Symbol(M, Decl(classExpressionTest2.ts, 0, 0))
var m = class C<X> {
>m : Symbol(m, Decl(classExpressionTest2.ts, 1, 7))
>C : Symbol(C, Decl(classExpressionTest2.ts, 1, 11))
>X : Symbol(X, Decl(classExpressionTest2.ts, 1, 20))
f<T>() {
>f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
>T : Symbol(T, Decl(classExpressionTest2.ts, 2, 10))
var t: T;
>t : Symbol(t, Decl(classExpressionTest2.ts, 3, 15))
>T : Symbol(T, Decl(classExpressionTest2.ts, 2, 10))
var x: X;
>x : Symbol(x, Decl(classExpressionTest2.ts, 4, 15))
>X : Symbol(X, Decl(classExpressionTest2.ts, 1, 20))
return { t, x };
>t : Symbol(t, Decl(classExpressionTest2.ts, 5, 20))
>x : Symbol(x, Decl(classExpressionTest2.ts, 5, 23))
}
}
var v = new m<number>();
>v : Symbol(v, Decl(classExpressionTest2.ts, 9, 7))
>m : Symbol(m, Decl(classExpressionTest2.ts, 1, 7))
return v.f<string>();
>v.f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
>v : Symbol(v, Decl(classExpressionTest2.ts, 9, 7))
>f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
}

View file

@ -0,0 +1,40 @@
=== tests/cases/compiler/classExpressionTest2.ts ===
function M() {
>M : () => { t: string; x: number; }
var m = class C<X> {
>m : typeof C
>class C<X> { f<T>() { var t: T; var x: X; return { t, x }; } } : typeof C
>C : typeof C
>X : X
f<T>() {
>f : <T>() => { t: T; x: X; }
>T : T
var t: T;
>t : T
>T : T
var x: X;
>x : X
>X : X
return { t, x };
>{ t, x } : { t: T; x: X; }
>t : T
>x : X
}
}
var v = new m<number>();
>v : <number>
>new m<number>() : <number>
>m : typeof C
return v.f<string>();
>v.f<string>() : { t: string; x: number; }
>v.f : <T>() => { t: T; x: number; }
>v : <number>
>f : <T>() => { t: T; x: number; }
}

View file

@ -1,14 +0,0 @@
tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts(6,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts (1 errors) ====
namespace C {
export interface type {
}
}
var x = class C {
~
!!! error TS9003: 'class' expressions are not currently supported.
prop: C.type;
}

View file

@ -0,0 +1,18 @@
=== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts ===
namespace C {
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 0))
export interface type {
>type : Symbol(type, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 13))
}
}
var x = class C {
>x : Symbol(x, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 3))
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 7))
prop: C.type;
>prop : Symbol(C.prop, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 17))
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 0))
>type : Symbol(C.type, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 13))
}

View file

@ -0,0 +1,19 @@
=== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts ===
namespace C {
>C : any
export interface type {
>type : type
}
}
var x = class C {
>x : typeof C
>class C { prop: C.type;} : typeof C
>C : typeof C
prop: C.type;
>prop : C.type
>C : any
>type : C.type
}

View file

@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticProperties1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticProperties1.ts (1 errors) ====
var v = class C { static a = 1; static b = 2 };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
var v = class C { static a = 1; static b = 2 };
>v : Symbol(v, Decl(classExpressionWithStaticProperties1.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticProperties1.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties1.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties1.ts, 0, 31))

View file

@ -0,0 +1,10 @@
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
var v = class C { static a = 1; static b = 2 };
>v : typeof C
>class C { static a = 1; static b = 2 } : typeof C
>C : typeof C
>a : number
>1 : number
>b : number
>2 : number

View file

@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticProperties2.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticProperties2.ts (1 errors) ====
var v = class C { static a = 1; static b };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
var v = class C { static a = 1; static b };
>v : Symbol(v, Decl(classExpressionWithStaticProperties2.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticProperties2.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties2.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties2.ts, 0, 31))

View file

@ -0,0 +1,9 @@
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
var v = class C { static a = 1; static b };
>v : typeof C
>class C { static a = 1; static b } : typeof C
>C : typeof C
>a : number
>1 : number
>b : any

View file

@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts (1 errors) ====
var v = class C { static a = 1; static b = 2 };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts ===
var v = class C { static a = 1; static b = 2 };
>v : Symbol(v, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 31))

View file

@ -0,0 +1,10 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts ===
var v = class C { static a = 1; static b = 2 };
>v : typeof C
>class C { static a = 1; static b = 2 } : typeof C
>C : typeof C
>a : number
>1 : number
>b : number
>2 : number

View file

@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts (1 errors) ====
var v = class C { static a = 1; static b };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts ===
var v = class C { static a = 1; static b };
>v : Symbol(v, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 31))

View file

@ -0,0 +1,9 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts ===
var v = class C { static a = 1; static b };
>v : typeof C
>class C { static a = 1; static b } : typeof C
>C : typeof C
>a : number
>1 : number
>b : any

View file

@ -15,20 +15,16 @@ function baz4({} = { x: 10 }) { }
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz(_a) {
var ;
}
function baz(_a) { }
function baz1(_a) {
var _b = _a === void 0 ? [1, 2, 3] : _a;
var _a = [1, 2, 3];
}
function baz2(_a) {
var _b = (_a === void 0 ? [[1, 2, 3]] : _a)[0];
}
function baz3(_a) {
var ;
}
function baz3(_a) { }
function baz4(_a) {
var _b = _a === void 0 ? { x: 10 } : _a;
var _a = { x: 10 };
}

View file

@ -1,7 +1,7 @@
//// [tests/cases/conformance/decorators/class/decoratedClassFromExternalModule.ts] ////
//// [decorated.ts]
function decorate() { }
function decorate(target: any) { }
@decorate
export default class Decorated { }
@ -18,7 +18,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
function decorate() { }
function decorate(target) { }
let Decorated = class {
};
Decorated = __decorate([

View file

@ -1,12 +1,13 @@
=== tests/cases/conformance/decorators/class/decorated.ts ===
function decorate() { }
function decorate(target: any) { }
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
>target : Symbol(target, Decl(decorated.ts, 0, 18))
@decorate
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
export default class Decorated { }
>Decorated : Symbol(Decorated, Decl(decorated.ts, 0, 23))
>Decorated : Symbol(Decorated, Decl(decorated.ts, 0, 34))
=== tests/cases/conformance/decorators/class/undecorated.ts ===
import Decorated from 'decorated';

View file

@ -1,9 +1,10 @@
=== tests/cases/conformance/decorators/class/decorated.ts ===
function decorate() { }
>decorate : () => void
function decorate(target: any) { }
>decorate : (target: any) => void
>target : any
@decorate
>decorate : () => void
>decorate : (target: any) => void
export default class Decorated { }
>Decorated : Decorated

View file

@ -8,7 +8,7 @@ tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts(9,14):
}
class A {
@(x => {
@((x, p) => {
var a = 3;
func(a);
~

View file

@ -5,7 +5,7 @@ function func(s: string): void {
}
class A {
@(x => {
@((x, p) => {
var a = 3;
func(a);
return x;
@ -34,7 +34,7 @@ var A = (function () {
};
Object.defineProperty(A.prototype, "m",
__decorate([
(function (x) {
(function (x, p) {
var a = 3;
func(a);
return x;

View file

@ -9,7 +9,7 @@ export var test = 'abc';
import { test } from './a';
function filter(handler: any) {
return function (target: any) {
return function (target: any, propertyKey: string) {
// ...
};
}
@ -35,7 +35,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
var a_1 = require('./a');
function filter(handler) {
return function (target) {
return function (target, propertyKey) {
// ...
};
}

View file

@ -12,8 +12,9 @@ function filter(handler: any) {
>filter : Symbol(filter, Decl(b.ts, 0, 27))
>handler : Symbol(handler, Decl(b.ts, 2, 16))
return function (target: any) {
return function (target: any, propertyKey: string) {
>target : Symbol(target, Decl(b.ts, 3, 21))
>propertyKey : Symbol(propertyKey, Decl(b.ts, 3, 33))
// ...
};

View file

@ -10,12 +10,13 @@ import { test } from './a';
>test : string
function filter(handler: any) {
>filter : (handler: any) => (target: any) => void
>filter : (handler: any) => (target: any, propertyKey: string) => void
>handler : any
return function (target: any) {
>function (target: any) { // ... } : (target: any) => void
return function (target: any, propertyKey: string) {
>function (target: any, propertyKey: string) { // ... } : (target: any, propertyKey: string) => void
>target : any
>propertyKey : string
// ...
};
@ -25,8 +26,8 @@ class Wat {
>Wat : Wat
@filter(() => test == 'abc')
>filter(() => test == 'abc') : (target: any) => void
>filter : (handler: any) => (target: any) => void
>filter(() => test == 'abc') : (target: any, propertyKey: string) => void
>filter : (handler: any) => (target: any, propertyKey: string) => void
>() => test == 'abc' : () => boolean
>test == 'abc' : boolean
>test : string

View file

@ -1,4 +1,5 @@
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
@ -6,6 +7,7 @@ tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322
@dec()
~~~~~~
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
!!! error TS1238: Supplied parameters do not match any signature of call target.
class C {
}

View file

@ -1,7 +1,5 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
Type 'number' is not assignable to type 'string | symbol'.
Type 'number' is not assignable to type 'symbol'.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,6): error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'.
Property 'apply' is missing in type 'C'.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
@ -9,9 +7,7 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5)
class C {
@dec method() {}
~~~~
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
~~~
!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'.
!!! error TS2345: Property 'apply' is missing in type 'C'.
}

View file

@ -1,5 +1,5 @@
//// [decoratorOnClassMethod13.ts]
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec ["1"]() { }

View file

@ -1,17 +1,17 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
>target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 28))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 40))
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 61))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
>target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 24))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 36))
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 57))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethod13.ts, 0, 132))
>C : Symbol(C, Decl(decoratorOnClassMethod13.ts, 0, 126))
@dec ["1"]() { }
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))

View file

@ -1,6 +1,6 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
@ -14,10 +14,10 @@ class C {
>C : C
@dec ["1"]() { }
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>"1" : string
@dec ["b"]() { }
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>"b" : string
}

View file

@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts (1 errors) ====
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {
@dec ["method"]() {}
~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
!!! error TS1241: Supplied parameters do not match any signature of call target.
}

View file

@ -1,18 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : Symbol(dec, Decl(decoratorOnClassMethod6.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
>target : Symbol(target, Decl(decoratorOnClassMethod6.ts, 0, 28))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod6.ts, 0, 40))
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod6.ts, 0, 61))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethod6.ts, 0, 132))
@dec ["method"]() {}
>dec : Symbol(dec, Decl(decoratorOnClassMethod6.ts, 0, 0))
}

View file

@ -1,19 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>"method" : string
}

View file

@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (1 errors) ====
declare function dec<T>(target: T): T;
class C {
@dec method() {}
~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
!!! error TS1241: Supplied parameters do not match any signature of call target.
}

View file

@ -1,15 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
declare function dec<T>(target: T): T;
>dec : Symbol(dec, Decl(decoratorOnClassMethod8.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
>target : Symbol(target, Decl(decoratorOnClassMethod8.ts, 0, 24))
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethod8.ts, 0, 38))
@dec method() {}
>dec : Symbol(dec, Decl(decoratorOnClassMethod8.ts, 0, 0))
>method : Symbol(method, Decl(decoratorOnClassMethod8.ts, 2, 9))
}

View file

@ -1,15 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
class C {
>C : C
@dec method() {}
>dec : <T>(target: T) => T
>method : () => void
}

View file

@ -1,5 +1,5 @@
//// [decoratorOnClassMethodParameter1.ts]
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
class C {
method(@dec p: number) {}

View file

@ -1,13 +1,13 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : Symbol(dec, Decl(decoratorOnClassMethodParameter1.ts, 0, 0))
>target : Symbol(target, Decl(decoratorOnClassMethodParameter1.ts, 0, 21))
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter1.ts, 0, 38))
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter1.ts, 0, 68))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter1.ts, 0, 36))
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter1.ts, 0, 66))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethodParameter1.ts, 0, 99))
>C : Symbol(C, Decl(decoratorOnClassMethodParameter1.ts, 0, 97))
method(@dec p: number) {}
>method : Symbol(method, Decl(decoratorOnClassMethodParameter1.ts, 2, 9))

View file

@ -1,8 +1,8 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>target : Function
>Function : Function
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>target : Object
>Object : Object
>propertyKey : string | symbol
>parameterIndex : number
@ -11,6 +11,6 @@ class C {
method(@dec p: number) {}
>method : (p: number) => void
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>p : number
}

View file

@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts (1 errors) ====
declare function dec(): <T>(target: any, propertyKey: string) => void;
class C {
@dec prop;
~~~~
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Supplied parameters do not match any signature of call target.
}

View file

@ -1,14 +0,0 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
declare function dec(): <T>(target: any, propertyKey: string) => void;
>dec : Symbol(dec, Decl(decoratorOnClassProperty11.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassProperty11.ts, 0, 25))
>target : Symbol(target, Decl(decoratorOnClassProperty11.ts, 0, 28))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassProperty11.ts, 0, 40))
class C {
>C : Symbol(C, Decl(decoratorOnClassProperty11.ts, 0, 70))
@dec prop;
>dec : Symbol(dec, Decl(decoratorOnClassProperty11.ts, 0, 0))
>prop : Symbol(prop, Decl(decoratorOnClassProperty11.ts, 2, 9))
}

View file

@ -1,14 +0,0 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
declare function dec(): <T>(target: any, propertyKey: string) => void;
>dec : () => <T>(target: any, propertyKey: string) => void
>T : T
>target : any
>propertyKey : string
class C {
>C : C
@dec prop;
>dec : () => <T>(target: any, propertyKey: string) => void
>prop : any
}

View file

@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts (1 errors) ====
declare function dec(target: Function): void;
class C {
@dec prop;
~~~~
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Supplied parameters do not match any signature of call target.
}

View file

@ -1,13 +0,0 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
declare function dec(target: Function): void;
>dec : Symbol(dec, Decl(decoratorOnClassProperty6.ts, 0, 0))
>target : Symbol(target, Decl(decoratorOnClassProperty6.ts, 0, 21))
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
class C {
>C : Symbol(C, Decl(decoratorOnClassProperty6.ts, 0, 45))
@dec prop;
>dec : Symbol(dec, Decl(decoratorOnClassProperty6.ts, 0, 0))
>prop : Symbol(prop, Decl(decoratorOnClassProperty6.ts, 2, 9))
}

View file

@ -1,13 +0,0 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
declare function dec(target: Function): void;
>dec : (target: Function) => void
>target : Function
>Function : Function
class C {
>C : C
@dec prop;
>dec : (target: Function) => void
>prop : any
}

View file

@ -1,4 +1,5 @@
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4,5): error TS2322: Type '(target: Function, propertyKey: string | symbol, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol) => void'.
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts (1 errors) ====
@ -7,5 +8,6 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4
class C {
@dec prop;
~~~~
!!! error TS2322: Type '(target: Function, propertyKey: string | symbol, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol) => void'.
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Supplied parameters do not match any signature of call target.
}

View file

@ -0,0 +1,11 @@
//// [emptyArrayBindingPatternParameter01.ts]
function f([]) {
var x, y, z;
}
//// [emptyArrayBindingPatternParameter01.js]
function f(_a) {
var x, y, z;
}

View file

@ -0,0 +1,11 @@
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts ===
function f([]) {
>f : Symbol(f, Decl(emptyArrayBindingPatternParameter01.ts, 0, 0))
var x, y, z;
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter01.ts, 3, 4))
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter01.ts, 3, 7))
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter01.ts, 3, 10))
}

View file

@ -0,0 +1,11 @@
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts ===
function f([]) {
>f : ([]: any[]) => void
var x, y, z;
>x : any
>y : any
>z : any
}

View file

@ -0,0 +1,11 @@
//// [emptyArrayBindingPatternParameter02.ts]
function f(a, []) {
var x, y, z;
}
//// [emptyArrayBindingPatternParameter02.js]
function f(a, _a) {
var x, y, z;
}

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