mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merge conflicts
This commit is contained in:
Vendored
+239
-156
File diff suppressed because it is too large
Load Diff
Vendored
+287
-204
File diff suppressed because it is too large
Load Diff
Vendored
+5344
File diff suppressed because it is too large
Load Diff
Vendored
+251
-162
File diff suppressed because it is too large
Load Diff
Vendored
+12
-6
@@ -595,6 +595,8 @@ interface AudioNode extends EventTarget {
|
||||
numberOfOutputs: number;
|
||||
connect(destination: AudioNode, output?: number, input?: number): void;
|
||||
disconnect(output?: number): void;
|
||||
disconnect(destination: AudioNode, output?: number, input?: number): void;
|
||||
disconnect(destination: AudioParam, output?: number): void;
|
||||
}
|
||||
|
||||
declare var AudioNode: {
|
||||
@@ -7111,7 +7113,7 @@ interface IDBCursor {
|
||||
direction: string;
|
||||
key: any;
|
||||
primaryKey: any;
|
||||
source: any;
|
||||
source: IDBObjectStore | IDBIndex;
|
||||
advance(count: number): void;
|
||||
continue(key?: any): void;
|
||||
delete(): IDBRequest;
|
||||
@@ -7149,7 +7151,7 @@ interface IDBDatabase extends EventTarget {
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: any, mode?: string): IDBTransaction;
|
||||
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
@@ -7207,9 +7209,10 @@ declare var IDBKeyRange: {
|
||||
|
||||
interface IDBObjectStore {
|
||||
indexNames: DOMStringList;
|
||||
keyPath: string;
|
||||
keyPath: string | string[];
|
||||
name: string;
|
||||
transaction: IDBTransaction;
|
||||
autoIncrement: boolean;
|
||||
add(value: any, key?: any): IDBRequest;
|
||||
clear(): IDBRequest;
|
||||
count(key?: any): IDBRequest;
|
||||
@@ -7248,7 +7251,7 @@ interface IDBRequest extends EventTarget {
|
||||
onsuccess: (ev: Event) => any;
|
||||
readyState: string;
|
||||
result: any;
|
||||
source: any;
|
||||
source: IDBObjectStore | IDBIndex | IDBCursor;
|
||||
transaction: IDBTransaction;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
@@ -10435,11 +10438,14 @@ declare var SVGViewElement: {
|
||||
}
|
||||
|
||||
interface SVGZoomAndPan {
|
||||
zoomAndPan: number;
|
||||
}
|
||||
|
||||
declare var SVGZoomAndPan: {
|
||||
SVG_ZOOMANDPAN_DISABLE: number;
|
||||
SVG_ZOOMANDPAN_MAGNIFY: number;
|
||||
SVG_ZOOMANDPAN_UNKNOWN: number;
|
||||
}
|
||||
declare var SVGZoomAndPan: SVGZoomAndPan;
|
||||
|
||||
interface SVGZoomEvent extends UIEvent {
|
||||
newScale: number;
|
||||
@@ -12902,7 +12908,7 @@ interface DecodeSuccessCallback {
|
||||
(decodedData: AudioBuffer): void;
|
||||
}
|
||||
interface DecodeErrorCallback {
|
||||
(): void;
|
||||
(error: DOMException): void;
|
||||
}
|
||||
interface FunctionStringCallback {
|
||||
(data: string): void;
|
||||
|
||||
Vendored
+299
-210
File diff suppressed because it is too large
Load Diff
Vendored
+18829
File diff suppressed because it is too large
Load Diff
Vendored
+6
-5
@@ -492,7 +492,7 @@ interface IDBCursor {
|
||||
direction: string;
|
||||
key: any;
|
||||
primaryKey: any;
|
||||
source: any;
|
||||
source: IDBObjectStore | IDBIndex;
|
||||
advance(count: number): void;
|
||||
continue(key?: any): void;
|
||||
delete(): IDBRequest;
|
||||
@@ -530,7 +530,7 @@ interface IDBDatabase extends EventTarget {
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: any, mode?: string): IDBTransaction;
|
||||
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
@@ -588,9 +588,10 @@ declare var IDBKeyRange: {
|
||||
|
||||
interface IDBObjectStore {
|
||||
indexNames: DOMStringList;
|
||||
keyPath: string;
|
||||
keyPath: string | string[];
|
||||
name: string;
|
||||
transaction: IDBTransaction;
|
||||
autoIncrement: boolean;
|
||||
add(value: any, key?: any): IDBRequest;
|
||||
clear(): IDBRequest;
|
||||
count(key?: any): IDBRequest;
|
||||
@@ -629,7 +630,7 @@ interface IDBRequest extends EventTarget {
|
||||
onsuccess: (ev: Event) => any;
|
||||
readyState: string;
|
||||
result: any;
|
||||
source: any;
|
||||
source: IDBObjectStore | IDBIndex | IDBCursor;
|
||||
transaction: IDBTransaction;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
@@ -1176,7 +1177,7 @@ interface DecodeSuccessCallback {
|
||||
(decodedData: AudioBuffer): void;
|
||||
}
|
||||
interface DecodeErrorCallback {
|
||||
(): void;
|
||||
(error: DOMException): void;
|
||||
}
|
||||
interface FunctionStringCallback {
|
||||
(data: string): void;
|
||||
|
||||
+4924
-3754
File diff suppressed because it is too large
Load Diff
+6098
-4896
File diff suppressed because it is too large
Load Diff
Vendored
+232
-203
@@ -160,169 +160,170 @@ declare namespace ts {
|
||||
IsKeyword = 124,
|
||||
ModuleKeyword = 125,
|
||||
NamespaceKeyword = 126,
|
||||
RequireKeyword = 127,
|
||||
NumberKeyword = 128,
|
||||
SetKeyword = 129,
|
||||
StringKeyword = 130,
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
GlobalKeyword = 134,
|
||||
OfKeyword = 135,
|
||||
QualifiedName = 136,
|
||||
ComputedPropertyName = 137,
|
||||
TypeParameter = 138,
|
||||
Parameter = 139,
|
||||
Decorator = 140,
|
||||
PropertySignature = 141,
|
||||
PropertyDeclaration = 142,
|
||||
MethodSignature = 143,
|
||||
MethodDeclaration = 144,
|
||||
Constructor = 145,
|
||||
GetAccessor = 146,
|
||||
SetAccessor = 147,
|
||||
CallSignature = 148,
|
||||
ConstructSignature = 149,
|
||||
IndexSignature = 150,
|
||||
TypePredicate = 151,
|
||||
TypeReference = 152,
|
||||
FunctionType = 153,
|
||||
ConstructorType = 154,
|
||||
TypeQuery = 155,
|
||||
TypeLiteral = 156,
|
||||
ArrayType = 157,
|
||||
TupleType = 158,
|
||||
UnionType = 159,
|
||||
IntersectionType = 160,
|
||||
ParenthesizedType = 161,
|
||||
ThisType = 162,
|
||||
StringLiteralType = 163,
|
||||
ObjectBindingPattern = 164,
|
||||
ArrayBindingPattern = 165,
|
||||
BindingElement = 166,
|
||||
ArrayLiteralExpression = 167,
|
||||
ObjectLiteralExpression = 168,
|
||||
PropertyAccessExpression = 169,
|
||||
ElementAccessExpression = 170,
|
||||
CallExpression = 171,
|
||||
NewExpression = 172,
|
||||
TaggedTemplateExpression = 173,
|
||||
TypeAssertionExpression = 174,
|
||||
ParenthesizedExpression = 175,
|
||||
FunctionExpression = 176,
|
||||
ArrowFunction = 177,
|
||||
DeleteExpression = 178,
|
||||
TypeOfExpression = 179,
|
||||
VoidExpression = 180,
|
||||
AwaitExpression = 181,
|
||||
PrefixUnaryExpression = 182,
|
||||
PostfixUnaryExpression = 183,
|
||||
BinaryExpression = 184,
|
||||
ConditionalExpression = 185,
|
||||
TemplateExpression = 186,
|
||||
YieldExpression = 187,
|
||||
SpreadElementExpression = 188,
|
||||
ClassExpression = 189,
|
||||
OmittedExpression = 190,
|
||||
ExpressionWithTypeArguments = 191,
|
||||
AsExpression = 192,
|
||||
TemplateSpan = 193,
|
||||
SemicolonClassElement = 194,
|
||||
Block = 195,
|
||||
VariableStatement = 196,
|
||||
EmptyStatement = 197,
|
||||
ExpressionStatement = 198,
|
||||
IfStatement = 199,
|
||||
DoStatement = 200,
|
||||
WhileStatement = 201,
|
||||
ForStatement = 202,
|
||||
ForInStatement = 203,
|
||||
ForOfStatement = 204,
|
||||
ContinueStatement = 205,
|
||||
BreakStatement = 206,
|
||||
ReturnStatement = 207,
|
||||
WithStatement = 208,
|
||||
SwitchStatement = 209,
|
||||
LabeledStatement = 210,
|
||||
ThrowStatement = 211,
|
||||
TryStatement = 212,
|
||||
DebuggerStatement = 213,
|
||||
VariableDeclaration = 214,
|
||||
VariableDeclarationList = 215,
|
||||
FunctionDeclaration = 216,
|
||||
ClassDeclaration = 217,
|
||||
InterfaceDeclaration = 218,
|
||||
TypeAliasDeclaration = 219,
|
||||
EnumDeclaration = 220,
|
||||
ModuleDeclaration = 221,
|
||||
ModuleBlock = 222,
|
||||
CaseBlock = 223,
|
||||
ImportEqualsDeclaration = 224,
|
||||
ImportDeclaration = 225,
|
||||
ImportClause = 226,
|
||||
NamespaceImport = 227,
|
||||
NamedImports = 228,
|
||||
ImportSpecifier = 229,
|
||||
ExportAssignment = 230,
|
||||
ExportDeclaration = 231,
|
||||
NamedExports = 232,
|
||||
ExportSpecifier = 233,
|
||||
MissingDeclaration = 234,
|
||||
ExternalModuleReference = 235,
|
||||
JsxElement = 236,
|
||||
JsxSelfClosingElement = 237,
|
||||
JsxOpeningElement = 238,
|
||||
JsxText = 239,
|
||||
JsxClosingElement = 240,
|
||||
JsxAttribute = 241,
|
||||
JsxSpreadAttribute = 242,
|
||||
JsxExpression = 243,
|
||||
CaseClause = 244,
|
||||
DefaultClause = 245,
|
||||
HeritageClause = 246,
|
||||
CatchClause = 247,
|
||||
PropertyAssignment = 248,
|
||||
ShorthandPropertyAssignment = 249,
|
||||
EnumMember = 250,
|
||||
SourceFile = 251,
|
||||
JSDocTypeExpression = 252,
|
||||
JSDocAllType = 253,
|
||||
JSDocUnknownType = 254,
|
||||
JSDocArrayType = 255,
|
||||
JSDocUnionType = 256,
|
||||
JSDocTupleType = 257,
|
||||
JSDocNullableType = 258,
|
||||
JSDocNonNullableType = 259,
|
||||
JSDocRecordType = 260,
|
||||
JSDocRecordMember = 261,
|
||||
JSDocTypeReference = 262,
|
||||
JSDocOptionalType = 263,
|
||||
JSDocFunctionType = 264,
|
||||
JSDocVariadicType = 265,
|
||||
JSDocConstructorType = 266,
|
||||
JSDocThisType = 267,
|
||||
JSDocComment = 268,
|
||||
JSDocTag = 269,
|
||||
JSDocParameterTag = 270,
|
||||
JSDocReturnTag = 271,
|
||||
JSDocTypeTag = 272,
|
||||
JSDocTemplateTag = 273,
|
||||
SyntaxList = 274,
|
||||
Count = 275,
|
||||
ReadonlyKeyword = 127,
|
||||
RequireKeyword = 128,
|
||||
NumberKeyword = 129,
|
||||
SetKeyword = 130,
|
||||
StringKeyword = 131,
|
||||
SymbolKeyword = 132,
|
||||
TypeKeyword = 133,
|
||||
FromKeyword = 134,
|
||||
GlobalKeyword = 135,
|
||||
OfKeyword = 136,
|
||||
QualifiedName = 137,
|
||||
ComputedPropertyName = 138,
|
||||
TypeParameter = 139,
|
||||
Parameter = 140,
|
||||
Decorator = 141,
|
||||
PropertySignature = 142,
|
||||
PropertyDeclaration = 143,
|
||||
MethodSignature = 144,
|
||||
MethodDeclaration = 145,
|
||||
Constructor = 146,
|
||||
GetAccessor = 147,
|
||||
SetAccessor = 148,
|
||||
CallSignature = 149,
|
||||
ConstructSignature = 150,
|
||||
IndexSignature = 151,
|
||||
TypePredicate = 152,
|
||||
TypeReference = 153,
|
||||
FunctionType = 154,
|
||||
ConstructorType = 155,
|
||||
TypeQuery = 156,
|
||||
TypeLiteral = 157,
|
||||
ArrayType = 158,
|
||||
TupleType = 159,
|
||||
UnionType = 160,
|
||||
IntersectionType = 161,
|
||||
ParenthesizedType = 162,
|
||||
ThisType = 163,
|
||||
StringLiteralType = 164,
|
||||
ObjectBindingPattern = 165,
|
||||
ArrayBindingPattern = 166,
|
||||
BindingElement = 167,
|
||||
ArrayLiteralExpression = 168,
|
||||
ObjectLiteralExpression = 169,
|
||||
PropertyAccessExpression = 170,
|
||||
ElementAccessExpression = 171,
|
||||
CallExpression = 172,
|
||||
NewExpression = 173,
|
||||
TaggedTemplateExpression = 174,
|
||||
TypeAssertionExpression = 175,
|
||||
ParenthesizedExpression = 176,
|
||||
FunctionExpression = 177,
|
||||
ArrowFunction = 178,
|
||||
DeleteExpression = 179,
|
||||
TypeOfExpression = 180,
|
||||
VoidExpression = 181,
|
||||
AwaitExpression = 182,
|
||||
PrefixUnaryExpression = 183,
|
||||
PostfixUnaryExpression = 184,
|
||||
BinaryExpression = 185,
|
||||
ConditionalExpression = 186,
|
||||
TemplateExpression = 187,
|
||||
YieldExpression = 188,
|
||||
SpreadElementExpression = 189,
|
||||
ClassExpression = 190,
|
||||
OmittedExpression = 191,
|
||||
ExpressionWithTypeArguments = 192,
|
||||
AsExpression = 193,
|
||||
TemplateSpan = 194,
|
||||
SemicolonClassElement = 195,
|
||||
Block = 196,
|
||||
VariableStatement = 197,
|
||||
EmptyStatement = 198,
|
||||
ExpressionStatement = 199,
|
||||
IfStatement = 200,
|
||||
DoStatement = 201,
|
||||
WhileStatement = 202,
|
||||
ForStatement = 203,
|
||||
ForInStatement = 204,
|
||||
ForOfStatement = 205,
|
||||
ContinueStatement = 206,
|
||||
BreakStatement = 207,
|
||||
ReturnStatement = 208,
|
||||
WithStatement = 209,
|
||||
SwitchStatement = 210,
|
||||
LabeledStatement = 211,
|
||||
ThrowStatement = 212,
|
||||
TryStatement = 213,
|
||||
DebuggerStatement = 214,
|
||||
VariableDeclaration = 215,
|
||||
VariableDeclarationList = 216,
|
||||
FunctionDeclaration = 217,
|
||||
ClassDeclaration = 218,
|
||||
InterfaceDeclaration = 219,
|
||||
TypeAliasDeclaration = 220,
|
||||
EnumDeclaration = 221,
|
||||
ModuleDeclaration = 222,
|
||||
ModuleBlock = 223,
|
||||
CaseBlock = 224,
|
||||
ImportEqualsDeclaration = 225,
|
||||
ImportDeclaration = 226,
|
||||
ImportClause = 227,
|
||||
NamespaceImport = 228,
|
||||
NamedImports = 229,
|
||||
ImportSpecifier = 230,
|
||||
ExportAssignment = 231,
|
||||
ExportDeclaration = 232,
|
||||
NamedExports = 233,
|
||||
ExportSpecifier = 234,
|
||||
MissingDeclaration = 235,
|
||||
ExternalModuleReference = 236,
|
||||
JsxElement = 237,
|
||||
JsxSelfClosingElement = 238,
|
||||
JsxOpeningElement = 239,
|
||||
JsxText = 240,
|
||||
JsxClosingElement = 241,
|
||||
JsxAttribute = 242,
|
||||
JsxSpreadAttribute = 243,
|
||||
JsxExpression = 244,
|
||||
CaseClause = 245,
|
||||
DefaultClause = 246,
|
||||
HeritageClause = 247,
|
||||
CatchClause = 248,
|
||||
PropertyAssignment = 249,
|
||||
ShorthandPropertyAssignment = 250,
|
||||
EnumMember = 251,
|
||||
SourceFile = 252,
|
||||
JSDocTypeExpression = 253,
|
||||
JSDocAllType = 254,
|
||||
JSDocUnknownType = 255,
|
||||
JSDocArrayType = 256,
|
||||
JSDocUnionType = 257,
|
||||
JSDocTupleType = 258,
|
||||
JSDocNullableType = 259,
|
||||
JSDocNonNullableType = 260,
|
||||
JSDocRecordType = 261,
|
||||
JSDocRecordMember = 262,
|
||||
JSDocTypeReference = 263,
|
||||
JSDocOptionalType = 264,
|
||||
JSDocFunctionType = 265,
|
||||
JSDocVariadicType = 266,
|
||||
JSDocConstructorType = 267,
|
||||
JSDocThisType = 268,
|
||||
JSDocComment = 269,
|
||||
JSDocTag = 270,
|
||||
JSDocParameterTag = 271,
|
||||
JSDocReturnTag = 272,
|
||||
JSDocTypeTag = 273,
|
||||
JSDocTemplateTag = 274,
|
||||
SyntaxList = 275,
|
||||
Count = 276,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 135,
|
||||
LastKeyword = 136,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 163,
|
||||
FirstTypeNode = 152,
|
||||
LastTypeNode = 164,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 135,
|
||||
LastToken = 136,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -331,40 +332,47 @@ declare namespace ts {
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 136,
|
||||
FirstNode = 137,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
Export = 2,
|
||||
Ambient = 4,
|
||||
Public = 8,
|
||||
Private = 16,
|
||||
Protected = 32,
|
||||
Static = 64,
|
||||
Export = 1,
|
||||
Ambient = 2,
|
||||
Public = 4,
|
||||
Private = 8,
|
||||
Protected = 16,
|
||||
Static = 32,
|
||||
Readonly = 64,
|
||||
Abstract = 128,
|
||||
Async = 256,
|
||||
Default = 512,
|
||||
MultiLine = 1024,
|
||||
Synthetic = 2048,
|
||||
DeclarationFile = 4096,
|
||||
Let = 8192,
|
||||
Const = 16384,
|
||||
OctalLiteral = 32768,
|
||||
Namespace = 65536,
|
||||
ExportContext = 131072,
|
||||
ContainsThis = 262144,
|
||||
HasImplicitReturn = 524288,
|
||||
HasExplicitReturn = 1048576,
|
||||
GlobalAugmentation = 2097152,
|
||||
HasClassExtends = 4194304,
|
||||
HasDecorators = 8388608,
|
||||
HasParamDecorators = 16777216,
|
||||
HasAsyncFunctions = 33554432,
|
||||
Modifier = 1022,
|
||||
AccessibilityModifier = 56,
|
||||
BlockScoped = 24576,
|
||||
ReachabilityCheckFlags = 1572864,
|
||||
EmitHelperFlags = 62914560,
|
||||
Let = 1024,
|
||||
Const = 2048,
|
||||
Namespace = 4096,
|
||||
ExportContext = 8192,
|
||||
ContainsThis = 16384,
|
||||
HasImplicitReturn = 32768,
|
||||
HasExplicitReturn = 65536,
|
||||
GlobalAugmentation = 131072,
|
||||
HasClassExtends = 262144,
|
||||
HasDecorators = 524288,
|
||||
HasParamDecorators = 1048576,
|
||||
HasAsyncFunctions = 2097152,
|
||||
DisallowInContext = 4194304,
|
||||
YieldContext = 8388608,
|
||||
DecoratorContext = 16777216,
|
||||
AwaitContext = 33554432,
|
||||
ThisNodeHasError = 67108864,
|
||||
JavaScriptFile = 134217728,
|
||||
ThisNodeOrAnySubNodesHasError = 268435456,
|
||||
HasAggregatedChildData = 536870912,
|
||||
Modifier = 959,
|
||||
AccessibilityModifier = 28,
|
||||
BlockScoped = 3072,
|
||||
ReachabilityCheckFlags = 98304,
|
||||
EmitHelperFlags = 3932160,
|
||||
ContextFlags = 62914560,
|
||||
TypeExcludesFlags = 41943040,
|
||||
}
|
||||
enum JsxFlags {
|
||||
None = 0,
|
||||
@@ -372,10 +380,6 @@ declare namespace ts {
|
||||
IntrinsicNamedElement = 1,
|
||||
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
|
||||
IntrinsicIndexedElement = 2,
|
||||
/** An element backed by a class, class-like, or function value */
|
||||
ValueElement = 4,
|
||||
/** Element resolution failed */
|
||||
UnknownElement = 16,
|
||||
IntrinsicElement = 3,
|
||||
}
|
||||
interface Node extends TextRange {
|
||||
@@ -702,7 +706,7 @@ declare namespace ts {
|
||||
expression: LeftHandSideExpression;
|
||||
argumentExpression?: Expression;
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
interface CallExpression extends LeftHandSideExpression, Declaration {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
@@ -1000,6 +1004,7 @@ declare namespace ts {
|
||||
interface JSDocThisType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
|
||||
interface JSDocRecordMember extends PropertySignature {
|
||||
name: Identifier | LiteralExpression;
|
||||
type?: JSDocType;
|
||||
@@ -1040,6 +1045,7 @@ declare namespace ts {
|
||||
moduleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
languageVariant: LanguageVariant;
|
||||
isDeclarationFile: boolean;
|
||||
/**
|
||||
* lib.d.ts should have a reference comment like
|
||||
*
|
||||
@@ -1133,6 +1139,7 @@ declare namespace ts {
|
||||
}
|
||||
interface EmitResult {
|
||||
emitSkipped: boolean;
|
||||
/** Contains declaration emit diagnostics */
|
||||
diagnostics: Diagnostic[];
|
||||
}
|
||||
interface TypeChecker {
|
||||
@@ -1177,7 +1184,8 @@ declare 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;
|
||||
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: 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;
|
||||
buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -1217,17 +1225,18 @@ declare namespace ts {
|
||||
This = 0,
|
||||
Identifier = 1,
|
||||
}
|
||||
interface TypePredicate {
|
||||
interface TypePredicateBase {
|
||||
kind: TypePredicateKind;
|
||||
type: Type;
|
||||
}
|
||||
interface ThisTypePredicate extends TypePredicate {
|
||||
interface ThisTypePredicate extends TypePredicateBase {
|
||||
_thisTypePredicateBrand: any;
|
||||
}
|
||||
interface IdentifierTypePredicate extends TypePredicate {
|
||||
interface IdentifierTypePredicate extends TypePredicateBase {
|
||||
parameterName: string;
|
||||
parameterIndex: number;
|
||||
}
|
||||
type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
|
||||
enum SymbolFlags {
|
||||
None = 0,
|
||||
FunctionScopedVariable = 1,
|
||||
@@ -1328,7 +1337,6 @@ declare namespace ts {
|
||||
ESSymbol = 16777216,
|
||||
ThisType = 33554432,
|
||||
ObjectLiteralPatternWithComputedProperties = 67108864,
|
||||
PredicateType = 134217728,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 80896,
|
||||
@@ -1341,9 +1349,6 @@ declare namespace ts {
|
||||
symbol?: Symbol;
|
||||
pattern?: DestructuringPattern;
|
||||
}
|
||||
interface PredicateType extends Type {
|
||||
predicate: ThisTypePredicate | IdentifierTypePredicate;
|
||||
}
|
||||
interface StringLiteralType extends Type {
|
||||
text: string;
|
||||
}
|
||||
@@ -1359,8 +1364,8 @@ declare namespace ts {
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
declaredStringIndexInfo: IndexInfo;
|
||||
declaredNumberIndexInfo: IndexInfo;
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
@@ -1394,6 +1399,11 @@ declare namespace ts {
|
||||
String = 0,
|
||||
Number = 1,
|
||||
}
|
||||
interface IndexInfo {
|
||||
type: Type;
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1429,6 +1439,9 @@ declare namespace ts {
|
||||
Classic = 1,
|
||||
NodeJs = 2,
|
||||
}
|
||||
type RootPaths = string[];
|
||||
type PathSubstitutions = Map<string[]>;
|
||||
type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
|
||||
interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
@@ -1476,9 +1489,14 @@ declare namespace ts {
|
||||
noImplicitReturns?: boolean;
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
baseUrl?: string;
|
||||
paths?: PathSubstitutions;
|
||||
rootDirs?: RootPaths;
|
||||
traceModuleResolution?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowJs?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
noImplicitUseStrict?: boolean;
|
||||
[option: string]: string | number | boolean | TsConfigOnlyOptions;
|
||||
}
|
||||
enum ModuleKind {
|
||||
None = 0,
|
||||
@@ -1502,6 +1520,13 @@ declare namespace ts {
|
||||
line: number;
|
||||
character: number;
|
||||
}
|
||||
enum ScriptKind {
|
||||
Unknown = 0,
|
||||
JS = 1,
|
||||
JSX = 2,
|
||||
TS = 3,
|
||||
TSX = 4,
|
||||
}
|
||||
enum ScriptTarget {
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
@@ -1521,6 +1546,7 @@ declare namespace ts {
|
||||
interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string;
|
||||
trace?(s: string): void;
|
||||
directoryExists?(directoryName: string): boolean;
|
||||
}
|
||||
interface ResolvedModule {
|
||||
@@ -1604,6 +1630,7 @@ declare namespace ts {
|
||||
scanJsxIdentifier(): SyntaxKind;
|
||||
reScanJsxToken(): SyntaxKind;
|
||||
scanJsxToken(): SyntaxKind;
|
||||
scanJSDocToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
setText(text: string, start?: number, length?: number): void;
|
||||
setOnError(onError: ErrorCallback): void;
|
||||
@@ -1611,6 +1638,7 @@ declare namespace ts {
|
||||
setLanguageVariant(variant: LanguageVariant): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
scanRange<T>(start: number, length: number, callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
@@ -1661,7 +1689,7 @@ declare namespace ts {
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare namespace ts {
|
||||
@@ -1702,8 +1730,8 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions): ParsedCommandLine;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): {
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
errors: Diagnostic[];
|
||||
};
|
||||
@@ -1796,6 +1824,7 @@ declare namespace ts {
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptKind?(fileName: string): ScriptKind;
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
getLocalizedDiagnosticMessages?(): any;
|
||||
@@ -2164,7 +2193,7 @@ declare namespace ts {
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
*/
|
||||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
@@ -2177,7 +2206,7 @@ declare namespace ts {
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
*
|
||||
@@ -2301,7 +2330,7 @@ declare namespace ts {
|
||||
}
|
||||
function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
|
||||
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
|
||||
|
||||
+7071
-5624
File diff suppressed because it is too large
Load Diff
Vendored
+232
-203
@@ -160,169 +160,170 @@ declare namespace ts {
|
||||
IsKeyword = 124,
|
||||
ModuleKeyword = 125,
|
||||
NamespaceKeyword = 126,
|
||||
RequireKeyword = 127,
|
||||
NumberKeyword = 128,
|
||||
SetKeyword = 129,
|
||||
StringKeyword = 130,
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
GlobalKeyword = 134,
|
||||
OfKeyword = 135,
|
||||
QualifiedName = 136,
|
||||
ComputedPropertyName = 137,
|
||||
TypeParameter = 138,
|
||||
Parameter = 139,
|
||||
Decorator = 140,
|
||||
PropertySignature = 141,
|
||||
PropertyDeclaration = 142,
|
||||
MethodSignature = 143,
|
||||
MethodDeclaration = 144,
|
||||
Constructor = 145,
|
||||
GetAccessor = 146,
|
||||
SetAccessor = 147,
|
||||
CallSignature = 148,
|
||||
ConstructSignature = 149,
|
||||
IndexSignature = 150,
|
||||
TypePredicate = 151,
|
||||
TypeReference = 152,
|
||||
FunctionType = 153,
|
||||
ConstructorType = 154,
|
||||
TypeQuery = 155,
|
||||
TypeLiteral = 156,
|
||||
ArrayType = 157,
|
||||
TupleType = 158,
|
||||
UnionType = 159,
|
||||
IntersectionType = 160,
|
||||
ParenthesizedType = 161,
|
||||
ThisType = 162,
|
||||
StringLiteralType = 163,
|
||||
ObjectBindingPattern = 164,
|
||||
ArrayBindingPattern = 165,
|
||||
BindingElement = 166,
|
||||
ArrayLiteralExpression = 167,
|
||||
ObjectLiteralExpression = 168,
|
||||
PropertyAccessExpression = 169,
|
||||
ElementAccessExpression = 170,
|
||||
CallExpression = 171,
|
||||
NewExpression = 172,
|
||||
TaggedTemplateExpression = 173,
|
||||
TypeAssertionExpression = 174,
|
||||
ParenthesizedExpression = 175,
|
||||
FunctionExpression = 176,
|
||||
ArrowFunction = 177,
|
||||
DeleteExpression = 178,
|
||||
TypeOfExpression = 179,
|
||||
VoidExpression = 180,
|
||||
AwaitExpression = 181,
|
||||
PrefixUnaryExpression = 182,
|
||||
PostfixUnaryExpression = 183,
|
||||
BinaryExpression = 184,
|
||||
ConditionalExpression = 185,
|
||||
TemplateExpression = 186,
|
||||
YieldExpression = 187,
|
||||
SpreadElementExpression = 188,
|
||||
ClassExpression = 189,
|
||||
OmittedExpression = 190,
|
||||
ExpressionWithTypeArguments = 191,
|
||||
AsExpression = 192,
|
||||
TemplateSpan = 193,
|
||||
SemicolonClassElement = 194,
|
||||
Block = 195,
|
||||
VariableStatement = 196,
|
||||
EmptyStatement = 197,
|
||||
ExpressionStatement = 198,
|
||||
IfStatement = 199,
|
||||
DoStatement = 200,
|
||||
WhileStatement = 201,
|
||||
ForStatement = 202,
|
||||
ForInStatement = 203,
|
||||
ForOfStatement = 204,
|
||||
ContinueStatement = 205,
|
||||
BreakStatement = 206,
|
||||
ReturnStatement = 207,
|
||||
WithStatement = 208,
|
||||
SwitchStatement = 209,
|
||||
LabeledStatement = 210,
|
||||
ThrowStatement = 211,
|
||||
TryStatement = 212,
|
||||
DebuggerStatement = 213,
|
||||
VariableDeclaration = 214,
|
||||
VariableDeclarationList = 215,
|
||||
FunctionDeclaration = 216,
|
||||
ClassDeclaration = 217,
|
||||
InterfaceDeclaration = 218,
|
||||
TypeAliasDeclaration = 219,
|
||||
EnumDeclaration = 220,
|
||||
ModuleDeclaration = 221,
|
||||
ModuleBlock = 222,
|
||||
CaseBlock = 223,
|
||||
ImportEqualsDeclaration = 224,
|
||||
ImportDeclaration = 225,
|
||||
ImportClause = 226,
|
||||
NamespaceImport = 227,
|
||||
NamedImports = 228,
|
||||
ImportSpecifier = 229,
|
||||
ExportAssignment = 230,
|
||||
ExportDeclaration = 231,
|
||||
NamedExports = 232,
|
||||
ExportSpecifier = 233,
|
||||
MissingDeclaration = 234,
|
||||
ExternalModuleReference = 235,
|
||||
JsxElement = 236,
|
||||
JsxSelfClosingElement = 237,
|
||||
JsxOpeningElement = 238,
|
||||
JsxText = 239,
|
||||
JsxClosingElement = 240,
|
||||
JsxAttribute = 241,
|
||||
JsxSpreadAttribute = 242,
|
||||
JsxExpression = 243,
|
||||
CaseClause = 244,
|
||||
DefaultClause = 245,
|
||||
HeritageClause = 246,
|
||||
CatchClause = 247,
|
||||
PropertyAssignment = 248,
|
||||
ShorthandPropertyAssignment = 249,
|
||||
EnumMember = 250,
|
||||
SourceFile = 251,
|
||||
JSDocTypeExpression = 252,
|
||||
JSDocAllType = 253,
|
||||
JSDocUnknownType = 254,
|
||||
JSDocArrayType = 255,
|
||||
JSDocUnionType = 256,
|
||||
JSDocTupleType = 257,
|
||||
JSDocNullableType = 258,
|
||||
JSDocNonNullableType = 259,
|
||||
JSDocRecordType = 260,
|
||||
JSDocRecordMember = 261,
|
||||
JSDocTypeReference = 262,
|
||||
JSDocOptionalType = 263,
|
||||
JSDocFunctionType = 264,
|
||||
JSDocVariadicType = 265,
|
||||
JSDocConstructorType = 266,
|
||||
JSDocThisType = 267,
|
||||
JSDocComment = 268,
|
||||
JSDocTag = 269,
|
||||
JSDocParameterTag = 270,
|
||||
JSDocReturnTag = 271,
|
||||
JSDocTypeTag = 272,
|
||||
JSDocTemplateTag = 273,
|
||||
SyntaxList = 274,
|
||||
Count = 275,
|
||||
ReadonlyKeyword = 127,
|
||||
RequireKeyword = 128,
|
||||
NumberKeyword = 129,
|
||||
SetKeyword = 130,
|
||||
StringKeyword = 131,
|
||||
SymbolKeyword = 132,
|
||||
TypeKeyword = 133,
|
||||
FromKeyword = 134,
|
||||
GlobalKeyword = 135,
|
||||
OfKeyword = 136,
|
||||
QualifiedName = 137,
|
||||
ComputedPropertyName = 138,
|
||||
TypeParameter = 139,
|
||||
Parameter = 140,
|
||||
Decorator = 141,
|
||||
PropertySignature = 142,
|
||||
PropertyDeclaration = 143,
|
||||
MethodSignature = 144,
|
||||
MethodDeclaration = 145,
|
||||
Constructor = 146,
|
||||
GetAccessor = 147,
|
||||
SetAccessor = 148,
|
||||
CallSignature = 149,
|
||||
ConstructSignature = 150,
|
||||
IndexSignature = 151,
|
||||
TypePredicate = 152,
|
||||
TypeReference = 153,
|
||||
FunctionType = 154,
|
||||
ConstructorType = 155,
|
||||
TypeQuery = 156,
|
||||
TypeLiteral = 157,
|
||||
ArrayType = 158,
|
||||
TupleType = 159,
|
||||
UnionType = 160,
|
||||
IntersectionType = 161,
|
||||
ParenthesizedType = 162,
|
||||
ThisType = 163,
|
||||
StringLiteralType = 164,
|
||||
ObjectBindingPattern = 165,
|
||||
ArrayBindingPattern = 166,
|
||||
BindingElement = 167,
|
||||
ArrayLiteralExpression = 168,
|
||||
ObjectLiteralExpression = 169,
|
||||
PropertyAccessExpression = 170,
|
||||
ElementAccessExpression = 171,
|
||||
CallExpression = 172,
|
||||
NewExpression = 173,
|
||||
TaggedTemplateExpression = 174,
|
||||
TypeAssertionExpression = 175,
|
||||
ParenthesizedExpression = 176,
|
||||
FunctionExpression = 177,
|
||||
ArrowFunction = 178,
|
||||
DeleteExpression = 179,
|
||||
TypeOfExpression = 180,
|
||||
VoidExpression = 181,
|
||||
AwaitExpression = 182,
|
||||
PrefixUnaryExpression = 183,
|
||||
PostfixUnaryExpression = 184,
|
||||
BinaryExpression = 185,
|
||||
ConditionalExpression = 186,
|
||||
TemplateExpression = 187,
|
||||
YieldExpression = 188,
|
||||
SpreadElementExpression = 189,
|
||||
ClassExpression = 190,
|
||||
OmittedExpression = 191,
|
||||
ExpressionWithTypeArguments = 192,
|
||||
AsExpression = 193,
|
||||
TemplateSpan = 194,
|
||||
SemicolonClassElement = 195,
|
||||
Block = 196,
|
||||
VariableStatement = 197,
|
||||
EmptyStatement = 198,
|
||||
ExpressionStatement = 199,
|
||||
IfStatement = 200,
|
||||
DoStatement = 201,
|
||||
WhileStatement = 202,
|
||||
ForStatement = 203,
|
||||
ForInStatement = 204,
|
||||
ForOfStatement = 205,
|
||||
ContinueStatement = 206,
|
||||
BreakStatement = 207,
|
||||
ReturnStatement = 208,
|
||||
WithStatement = 209,
|
||||
SwitchStatement = 210,
|
||||
LabeledStatement = 211,
|
||||
ThrowStatement = 212,
|
||||
TryStatement = 213,
|
||||
DebuggerStatement = 214,
|
||||
VariableDeclaration = 215,
|
||||
VariableDeclarationList = 216,
|
||||
FunctionDeclaration = 217,
|
||||
ClassDeclaration = 218,
|
||||
InterfaceDeclaration = 219,
|
||||
TypeAliasDeclaration = 220,
|
||||
EnumDeclaration = 221,
|
||||
ModuleDeclaration = 222,
|
||||
ModuleBlock = 223,
|
||||
CaseBlock = 224,
|
||||
ImportEqualsDeclaration = 225,
|
||||
ImportDeclaration = 226,
|
||||
ImportClause = 227,
|
||||
NamespaceImport = 228,
|
||||
NamedImports = 229,
|
||||
ImportSpecifier = 230,
|
||||
ExportAssignment = 231,
|
||||
ExportDeclaration = 232,
|
||||
NamedExports = 233,
|
||||
ExportSpecifier = 234,
|
||||
MissingDeclaration = 235,
|
||||
ExternalModuleReference = 236,
|
||||
JsxElement = 237,
|
||||
JsxSelfClosingElement = 238,
|
||||
JsxOpeningElement = 239,
|
||||
JsxText = 240,
|
||||
JsxClosingElement = 241,
|
||||
JsxAttribute = 242,
|
||||
JsxSpreadAttribute = 243,
|
||||
JsxExpression = 244,
|
||||
CaseClause = 245,
|
||||
DefaultClause = 246,
|
||||
HeritageClause = 247,
|
||||
CatchClause = 248,
|
||||
PropertyAssignment = 249,
|
||||
ShorthandPropertyAssignment = 250,
|
||||
EnumMember = 251,
|
||||
SourceFile = 252,
|
||||
JSDocTypeExpression = 253,
|
||||
JSDocAllType = 254,
|
||||
JSDocUnknownType = 255,
|
||||
JSDocArrayType = 256,
|
||||
JSDocUnionType = 257,
|
||||
JSDocTupleType = 258,
|
||||
JSDocNullableType = 259,
|
||||
JSDocNonNullableType = 260,
|
||||
JSDocRecordType = 261,
|
||||
JSDocRecordMember = 262,
|
||||
JSDocTypeReference = 263,
|
||||
JSDocOptionalType = 264,
|
||||
JSDocFunctionType = 265,
|
||||
JSDocVariadicType = 266,
|
||||
JSDocConstructorType = 267,
|
||||
JSDocThisType = 268,
|
||||
JSDocComment = 269,
|
||||
JSDocTag = 270,
|
||||
JSDocParameterTag = 271,
|
||||
JSDocReturnTag = 272,
|
||||
JSDocTypeTag = 273,
|
||||
JSDocTemplateTag = 274,
|
||||
SyntaxList = 275,
|
||||
Count = 276,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 135,
|
||||
LastKeyword = 136,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 163,
|
||||
FirstTypeNode = 152,
|
||||
LastTypeNode = 164,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 135,
|
||||
LastToken = 136,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -331,40 +332,47 @@ declare namespace ts {
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 136,
|
||||
FirstNode = 137,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
Export = 2,
|
||||
Ambient = 4,
|
||||
Public = 8,
|
||||
Private = 16,
|
||||
Protected = 32,
|
||||
Static = 64,
|
||||
Export = 1,
|
||||
Ambient = 2,
|
||||
Public = 4,
|
||||
Private = 8,
|
||||
Protected = 16,
|
||||
Static = 32,
|
||||
Readonly = 64,
|
||||
Abstract = 128,
|
||||
Async = 256,
|
||||
Default = 512,
|
||||
MultiLine = 1024,
|
||||
Synthetic = 2048,
|
||||
DeclarationFile = 4096,
|
||||
Let = 8192,
|
||||
Const = 16384,
|
||||
OctalLiteral = 32768,
|
||||
Namespace = 65536,
|
||||
ExportContext = 131072,
|
||||
ContainsThis = 262144,
|
||||
HasImplicitReturn = 524288,
|
||||
HasExplicitReturn = 1048576,
|
||||
GlobalAugmentation = 2097152,
|
||||
HasClassExtends = 4194304,
|
||||
HasDecorators = 8388608,
|
||||
HasParamDecorators = 16777216,
|
||||
HasAsyncFunctions = 33554432,
|
||||
Modifier = 1022,
|
||||
AccessibilityModifier = 56,
|
||||
BlockScoped = 24576,
|
||||
ReachabilityCheckFlags = 1572864,
|
||||
EmitHelperFlags = 62914560,
|
||||
Let = 1024,
|
||||
Const = 2048,
|
||||
Namespace = 4096,
|
||||
ExportContext = 8192,
|
||||
ContainsThis = 16384,
|
||||
HasImplicitReturn = 32768,
|
||||
HasExplicitReturn = 65536,
|
||||
GlobalAugmentation = 131072,
|
||||
HasClassExtends = 262144,
|
||||
HasDecorators = 524288,
|
||||
HasParamDecorators = 1048576,
|
||||
HasAsyncFunctions = 2097152,
|
||||
DisallowInContext = 4194304,
|
||||
YieldContext = 8388608,
|
||||
DecoratorContext = 16777216,
|
||||
AwaitContext = 33554432,
|
||||
ThisNodeHasError = 67108864,
|
||||
JavaScriptFile = 134217728,
|
||||
ThisNodeOrAnySubNodesHasError = 268435456,
|
||||
HasAggregatedChildData = 536870912,
|
||||
Modifier = 959,
|
||||
AccessibilityModifier = 28,
|
||||
BlockScoped = 3072,
|
||||
ReachabilityCheckFlags = 98304,
|
||||
EmitHelperFlags = 3932160,
|
||||
ContextFlags = 62914560,
|
||||
TypeExcludesFlags = 41943040,
|
||||
}
|
||||
enum JsxFlags {
|
||||
None = 0,
|
||||
@@ -372,10 +380,6 @@ declare namespace ts {
|
||||
IntrinsicNamedElement = 1,
|
||||
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
|
||||
IntrinsicIndexedElement = 2,
|
||||
/** An element backed by a class, class-like, or function value */
|
||||
ValueElement = 4,
|
||||
/** Element resolution failed */
|
||||
UnknownElement = 16,
|
||||
IntrinsicElement = 3,
|
||||
}
|
||||
interface Node extends TextRange {
|
||||
@@ -702,7 +706,7 @@ declare namespace ts {
|
||||
expression: LeftHandSideExpression;
|
||||
argumentExpression?: Expression;
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
interface CallExpression extends LeftHandSideExpression, Declaration {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
@@ -1000,6 +1004,7 @@ declare namespace ts {
|
||||
interface JSDocThisType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
|
||||
interface JSDocRecordMember extends PropertySignature {
|
||||
name: Identifier | LiteralExpression;
|
||||
type?: JSDocType;
|
||||
@@ -1040,6 +1045,7 @@ declare namespace ts {
|
||||
moduleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
languageVariant: LanguageVariant;
|
||||
isDeclarationFile: boolean;
|
||||
/**
|
||||
* lib.d.ts should have a reference comment like
|
||||
*
|
||||
@@ -1133,6 +1139,7 @@ declare namespace ts {
|
||||
}
|
||||
interface EmitResult {
|
||||
emitSkipped: boolean;
|
||||
/** Contains declaration emit diagnostics */
|
||||
diagnostics: Diagnostic[];
|
||||
}
|
||||
interface TypeChecker {
|
||||
@@ -1177,7 +1184,8 @@ declare 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;
|
||||
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: 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;
|
||||
buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -1217,17 +1225,18 @@ declare namespace ts {
|
||||
This = 0,
|
||||
Identifier = 1,
|
||||
}
|
||||
interface TypePredicate {
|
||||
interface TypePredicateBase {
|
||||
kind: TypePredicateKind;
|
||||
type: Type;
|
||||
}
|
||||
interface ThisTypePredicate extends TypePredicate {
|
||||
interface ThisTypePredicate extends TypePredicateBase {
|
||||
_thisTypePredicateBrand: any;
|
||||
}
|
||||
interface IdentifierTypePredicate extends TypePredicate {
|
||||
interface IdentifierTypePredicate extends TypePredicateBase {
|
||||
parameterName: string;
|
||||
parameterIndex: number;
|
||||
}
|
||||
type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
|
||||
enum SymbolFlags {
|
||||
None = 0,
|
||||
FunctionScopedVariable = 1,
|
||||
@@ -1328,7 +1337,6 @@ declare namespace ts {
|
||||
ESSymbol = 16777216,
|
||||
ThisType = 33554432,
|
||||
ObjectLiteralPatternWithComputedProperties = 67108864,
|
||||
PredicateType = 134217728,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 80896,
|
||||
@@ -1341,9 +1349,6 @@ declare namespace ts {
|
||||
symbol?: Symbol;
|
||||
pattern?: DestructuringPattern;
|
||||
}
|
||||
interface PredicateType extends Type {
|
||||
predicate: ThisTypePredicate | IdentifierTypePredicate;
|
||||
}
|
||||
interface StringLiteralType extends Type {
|
||||
text: string;
|
||||
}
|
||||
@@ -1359,8 +1364,8 @@ declare namespace ts {
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
declaredStringIndexInfo: IndexInfo;
|
||||
declaredNumberIndexInfo: IndexInfo;
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
@@ -1394,6 +1399,11 @@ declare namespace ts {
|
||||
String = 0,
|
||||
Number = 1,
|
||||
}
|
||||
interface IndexInfo {
|
||||
type: Type;
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1429,6 +1439,9 @@ declare namespace ts {
|
||||
Classic = 1,
|
||||
NodeJs = 2,
|
||||
}
|
||||
type RootPaths = string[];
|
||||
type PathSubstitutions = Map<string[]>;
|
||||
type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
|
||||
interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
@@ -1476,9 +1489,14 @@ declare namespace ts {
|
||||
noImplicitReturns?: boolean;
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
baseUrl?: string;
|
||||
paths?: PathSubstitutions;
|
||||
rootDirs?: RootPaths;
|
||||
traceModuleResolution?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowJs?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
noImplicitUseStrict?: boolean;
|
||||
[option: string]: string | number | boolean | TsConfigOnlyOptions;
|
||||
}
|
||||
enum ModuleKind {
|
||||
None = 0,
|
||||
@@ -1502,6 +1520,13 @@ declare namespace ts {
|
||||
line: number;
|
||||
character: number;
|
||||
}
|
||||
enum ScriptKind {
|
||||
Unknown = 0,
|
||||
JS = 1,
|
||||
JSX = 2,
|
||||
TS = 3,
|
||||
TSX = 4,
|
||||
}
|
||||
enum ScriptTarget {
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
@@ -1521,6 +1546,7 @@ declare namespace ts {
|
||||
interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string;
|
||||
trace?(s: string): void;
|
||||
directoryExists?(directoryName: string): boolean;
|
||||
}
|
||||
interface ResolvedModule {
|
||||
@@ -1604,6 +1630,7 @@ declare namespace ts {
|
||||
scanJsxIdentifier(): SyntaxKind;
|
||||
reScanJsxToken(): SyntaxKind;
|
||||
scanJsxToken(): SyntaxKind;
|
||||
scanJSDocToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
setText(text: string, start?: number, length?: number): void;
|
||||
setOnError(onError: ErrorCallback): void;
|
||||
@@ -1611,6 +1638,7 @@ declare namespace ts {
|
||||
setLanguageVariant(variant: LanguageVariant): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
scanRange<T>(start: number, length: number, callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
@@ -1661,7 +1689,7 @@ declare namespace ts {
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare namespace ts {
|
||||
@@ -1702,8 +1730,8 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions): ParsedCommandLine;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): {
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
errors: Diagnostic[];
|
||||
};
|
||||
@@ -1796,6 +1824,7 @@ declare namespace ts {
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptKind?(fileName: string): ScriptKind;
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
getLocalizedDiagnosticMessages?(): any;
|
||||
@@ -2164,7 +2193,7 @@ declare namespace ts {
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
*/
|
||||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
@@ -2177,7 +2206,7 @@ declare namespace ts {
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
*
|
||||
@@ -2301,7 +2330,7 @@ declare namespace ts {
|
||||
}
|
||||
function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
|
||||
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
|
||||
|
||||
+7071
-5624
File diff suppressed because it is too large
Load Diff
@@ -13,4 +13,4 @@ Refer to CONTRIBUTING.MD for more details.
|
||||
https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md
|
||||
-->
|
||||
|
||||
**Fixes issue:** #
|
||||
Fixes #
|
||||
|
||||
@@ -685,7 +685,7 @@ namespace ts {
|
||||
// post catch/finally state is reachable if
|
||||
// - post try state is reachable - control flow can fall out of try block
|
||||
// - post catch state is reachable - control flow can fall out of catch block
|
||||
currentReachabilityState = or(postTryState, postCatchState);
|
||||
currentReachabilityState = n.catchClause ? or(postTryState, postCatchState) : postTryState;
|
||||
}
|
||||
|
||||
function bindSwitchStatement(n: SwitchStatement): void {
|
||||
|
||||
+60
-17
@@ -5521,8 +5521,20 @@ namespace ts {
|
||||
// on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or
|
||||
// A & B = (A & B) | (C & D).
|
||||
if (source.flags & TypeFlags.Intersection) {
|
||||
// If target is a union type the following check will report errors so we suppress them here
|
||||
if (result = someTypeRelatedToType(<IntersectionType>source, target, reportErrors && !(target.flags & TypeFlags.Union))) {
|
||||
// Check to see if any constituents of the intersection are immediately related to the target.
|
||||
//
|
||||
// Don't report errors though. Checking whether a constituent is related to the source is not actually
|
||||
// useful and leads to some confusing error messages. Instead it is better to let the below checks
|
||||
// take care of this, or to not elaborate at all. For instance,
|
||||
//
|
||||
// - For an object type (such as 'C = A & B'), users are usually more interested in structural errors.
|
||||
//
|
||||
// - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection
|
||||
// than to report that 'D' is not assignable to 'A' or 'B'.
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
if (result = someTypeRelatedToType(<IntersectionType>source, target, /*reportErrors*/ false)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -6524,6 +6536,7 @@ namespace ts {
|
||||
let targetStack: Type[];
|
||||
let depth = 0;
|
||||
let inferiority = 0;
|
||||
const visited: Map<boolean> = {};
|
||||
inferFromTypes(source, target);
|
||||
|
||||
function isInProcess(source: Type, target: Type) {
|
||||
@@ -6653,6 +6666,12 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = source.id + "," + target.id;
|
||||
if (hasProperty(visited, key)) {
|
||||
return;
|
||||
}
|
||||
visited[key] = true;
|
||||
|
||||
if (depth === 0) {
|
||||
sourceStack = [];
|
||||
targetStack = [];
|
||||
@@ -10112,8 +10131,10 @@ namespace ts {
|
||||
// In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated
|
||||
// with the type arguments specified in the extends clause.
|
||||
const baseTypeNode = getClassExtendsHeritageClauseElement(getContainingClass(node));
|
||||
const baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);
|
||||
return resolveCall(node, baseConstructors, candidatesOutArray);
|
||||
if (baseTypeNode) {
|
||||
const baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);
|
||||
return resolveCall(node, baseConstructors, candidatesOutArray);
|
||||
}
|
||||
}
|
||||
return resolveUntypedCall(node);
|
||||
}
|
||||
@@ -10733,6 +10754,7 @@ namespace ts {
|
||||
|
||||
// The identityMapper object is used to indicate that function expressions are wildcards
|
||||
if (contextualMapper === identityMapper && isContextSensitive(node)) {
|
||||
checkNodeDeferred(node);
|
||||
return anyFunctionType;
|
||||
}
|
||||
|
||||
@@ -12049,6 +12071,9 @@ namespace ts {
|
||||
if (((node.flags & NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & NodeFlags.AccessibilityModifier))) {
|
||||
error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);
|
||||
}
|
||||
if (((node.flags & NodeFlags.Abstract) !== (otherAccessor.flags & NodeFlags.Abstract))) {
|
||||
error(node.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
||||
}
|
||||
|
||||
const currentAccessorType = getAnnotatedAccessorType(node);
|
||||
const otherAccessorType = getAnnotatedAccessorType(otherAccessor);
|
||||
@@ -12194,7 +12219,7 @@ namespace ts {
|
||||
forEach(overloads, o => {
|
||||
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags;
|
||||
if (deviation & NodeFlags.Export) {
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported);
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
||||
}
|
||||
else if (deviation & NodeFlags.Ambient) {
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
||||
@@ -12203,7 +12228,7 @@ namespace ts {
|
||||
error(o.name || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
||||
}
|
||||
else if (deviation & NodeFlags.Abstract) {
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract);
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -12248,7 +12273,7 @@ namespace ts {
|
||||
seen = c === node;
|
||||
}
|
||||
});
|
||||
// We may be here because of some extra junk between overloads that could not be parsed into a valid node.
|
||||
// We may be here because of some extra nodes between overloads that could not be parsed into a valid node.
|
||||
// In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here.
|
||||
if (subsequentNode && subsequentNode.pos === node.end) {
|
||||
if (subsequentNode.kind === node.kind) {
|
||||
@@ -14011,7 +14036,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// Check each type parameter and check that list has no duplicate type parameter declarations
|
||||
/** Check each type parameter and check that type parameters have no duplicate type parameter declarations */
|
||||
function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) {
|
||||
if (typeParameterDeclarations) {
|
||||
for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) {
|
||||
@@ -14029,6 +14054,24 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/** Check that type parameter lists are identical across multiple declarations */
|
||||
function checkTypeParameterListsIdentical(node: ClassLikeDeclaration | InterfaceDeclaration, symbol: Symbol) {
|
||||
if (symbol.declarations.length === 1) {
|
||||
return;
|
||||
}
|
||||
let firstDecl: ClassLikeDeclaration | InterfaceDeclaration;
|
||||
for (const declaration of symbol.declarations) {
|
||||
if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) {
|
||||
if (!firstDecl) {
|
||||
firstDecl = <ClassLikeDeclaration | InterfaceDeclaration>declaration;
|
||||
}
|
||||
else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) {
|
||||
error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkClassExpression(node: ClassExpression): Type {
|
||||
checkClassLikeDeclaration(node);
|
||||
checkNodeDeferred(node);
|
||||
@@ -14062,6 +14105,7 @@ namespace ts {
|
||||
const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
|
||||
const typeWithThis = getTypeWithThisArgument(type);
|
||||
const staticType = <ObjectType>getTypeOfSymbol(symbol);
|
||||
checkTypeParameterListsIdentical(node, symbol);
|
||||
|
||||
const baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
@@ -14324,14 +14368,10 @@ namespace ts {
|
||||
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
const symbol = getSymbolOfNode(node);
|
||||
const firstInterfaceDecl = <InterfaceDeclaration>getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration);
|
||||
if (symbol.declarations.length > 1) {
|
||||
if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) {
|
||||
error(node.name, Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters);
|
||||
}
|
||||
}
|
||||
checkTypeParameterListsIdentical(node, symbol);
|
||||
|
||||
// Only check this symbol once
|
||||
const firstInterfaceDecl = <InterfaceDeclaration>getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration);
|
||||
if (node === firstInterfaceDecl) {
|
||||
const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
|
||||
const typeWithThis = getTypeWithThisArgument(type);
|
||||
@@ -16481,8 +16521,11 @@ namespace ts {
|
||||
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract");
|
||||
}
|
||||
if (node.kind !== SyntaxKind.ClassDeclaration) {
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration) {
|
||||
return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration);
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration &&
|
||||
node.kind !== SyntaxKind.PropertyDeclaration &&
|
||||
node.kind !== SyntaxKind.GetAccessor &&
|
||||
node.kind !== SyntaxKind.SetAccessor) {
|
||||
return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
|
||||
}
|
||||
if (!(node.parent.kind === SyntaxKind.ClassDeclaration && node.parent.flags & NodeFlags.Abstract)) {
|
||||
return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
|
||||
@@ -16976,7 +17019,7 @@ namespace ts {
|
||||
else if (isInAmbientContext(accessor)) {
|
||||
return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
|
||||
}
|
||||
else if (accessor.body === undefined) {
|
||||
else if (accessor.body === undefined && !(accessor.flags & NodeFlags.Abstract)) {
|
||||
return grammarErrorAtPos(getSourceFileOfNode(accessor), accessor.end - 1, ";".length, Diagnostics._0_expected, "{");
|
||||
}
|
||||
else if (accessor.typeParameters) {
|
||||
|
||||
@@ -17,6 +17,12 @@ namespace ts {
|
||||
type: "boolean",
|
||||
description: Diagnostics.Generates_corresponding_d_ts_file,
|
||||
},
|
||||
{
|
||||
name: "declarationDir",
|
||||
type: "string",
|
||||
isFilePath: true,
|
||||
paramType: Diagnostics.DIRECTORY,
|
||||
},
|
||||
{
|
||||
name: "diagnostics",
|
||||
type: "boolean",
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace ts {
|
||||
export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] {
|
||||
const declarationDiagnostics = createDiagnosticCollection();
|
||||
forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile);
|
||||
return declarationDiagnostics.getDiagnostics(targetSourceFile.fileName);
|
||||
return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined);
|
||||
|
||||
function getDeclarationDiagnosticsFromFile({ declarationFilePath }, sources: SourceFile[], isBundledEmit: boolean) {
|
||||
emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit);
|
||||
|
||||
@@ -779,7 +779,7 @@
|
||||
"category": "Error",
|
||||
"code": 1241
|
||||
},
|
||||
"'abstract' modifier can only appear on a class or method declaration.": {
|
||||
"'abstract' modifier can only appear on a class, method, or property declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1242
|
||||
},
|
||||
@@ -1151,7 +1151,7 @@
|
||||
"category": "Error",
|
||||
"code": 2382
|
||||
},
|
||||
"Overload signatures must all be exported or not exported.": {
|
||||
"Overload signatures must all be exported or non-exported.": {
|
||||
"category": "Error",
|
||||
"code": 2383
|
||||
},
|
||||
@@ -1311,7 +1311,7 @@
|
||||
"category": "Error",
|
||||
"code": 2427
|
||||
},
|
||||
"All declarations of an interface must have identical type parameters.": {
|
||||
"All declarations of '{0}' must have identical type parameters.": {
|
||||
"category": "Error",
|
||||
"code": 2428
|
||||
},
|
||||
@@ -1635,7 +1635,7 @@
|
||||
"category": "Error",
|
||||
"code": 2511
|
||||
},
|
||||
"Overload signatures must all be abstract or not abstract.": {
|
||||
"Overload signatures must all be abstract or non-abstract.": {
|
||||
"category": "Error",
|
||||
"code": 2512
|
||||
},
|
||||
@@ -1843,6 +1843,10 @@
|
||||
"category": "Error",
|
||||
"code": 2675
|
||||
},
|
||||
"Accessors must both be abstract or non-abstract.": {
|
||||
"category": "Error",
|
||||
"code": 2676
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
@@ -2801,4 +2805,4 @@
|
||||
"category": "Error",
|
||||
"code": 17009
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7402,8 +7402,8 @@ const _super = (function (geti, seti) {
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
emitExportEquals(/*emitAsReturn*/ true);
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
@@ -7416,8 +7416,8 @@ const _super = (function (geti, seti) {
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
emitExportEquals(/*emitAsReturn*/ false);
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
}
|
||||
|
||||
function emitUMDModule(node: SourceFile) {
|
||||
@@ -7443,8 +7443,8 @@ const _super = (function (geti, seti) {
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
emitExportEquals(/*emitAsReturn*/ true);
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
|
||||
+43
-19
@@ -399,14 +399,31 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile {
|
||||
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile {
|
||||
const start = new Date().getTime();
|
||||
const result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes);
|
||||
const result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
|
||||
|
||||
parseTime += new Date().getTime() - start;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function getScriptKindFromFileName(fileName: string): ScriptKind {
|
||||
const ext = fileName.substr(fileName.lastIndexOf("."));
|
||||
switch (ext.toLowerCase()) {
|
||||
case ".js":
|
||||
return ScriptKind.JS;
|
||||
case ".jsx":
|
||||
return ScriptKind.JSX;
|
||||
case ".ts":
|
||||
return ScriptKind.TS;
|
||||
case ".tsx":
|
||||
return ScriptKind.TSX;
|
||||
default:
|
||||
return ScriptKind.TS;
|
||||
}
|
||||
}
|
||||
|
||||
// Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter
|
||||
// indicates what changed between the 'text' that this SourceFile has and the 'newText'.
|
||||
// The SourceFile will be created with the compiler attempting to reuse as many nodes from
|
||||
@@ -533,23 +550,29 @@ namespace ts {
|
||||
// attached to the EOF token.
|
||||
let parseErrorBeforeNextFinishedNode = false;
|
||||
|
||||
export function parseSourceFile(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, setParentNodes?: boolean): SourceFile {
|
||||
const isJavaScriptFile = hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0;
|
||||
initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor);
|
||||
export function parseSourceFile(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile {
|
||||
// Using scriptKind as a condition handles both:
|
||||
// - 'scriptKind' is unspecified and thus it is `undefined`
|
||||
// - 'scriptKind' is set and it is `Unknown` (0)
|
||||
// If the 'scriptKind' is 'undefined' or 'Unknown' then attempt
|
||||
// to get the ScriptKind from the file name.
|
||||
scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName);
|
||||
|
||||
const result = parseSourceFileWorker(fileName, languageVersion, setParentNodes);
|
||||
initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind);
|
||||
|
||||
const result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind);
|
||||
|
||||
clearState();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getLanguageVariant(fileName: string) {
|
||||
function getLanguageVariant(scriptKind: ScriptKind) {
|
||||
// .tsx and .jsx files are treated as jsx language variant.
|
||||
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") || fileExtensionIs(fileName, ".js") ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
return scriptKind === ScriptKind.TSX || scriptKind === ScriptKind.JSX || scriptKind === ScriptKind.JS ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
}
|
||||
|
||||
function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, isJavaScriptFile: boolean, _syntaxCursor: IncrementalParser.SyntaxCursor) {
|
||||
function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, scriptKind: ScriptKind) {
|
||||
NodeConstructor = objectAllocator.getNodeConstructor();
|
||||
SourceFileConstructor = objectAllocator.getSourceFileConstructor();
|
||||
|
||||
@@ -562,14 +585,14 @@ namespace ts {
|
||||
identifierCount = 0;
|
||||
nodeCount = 0;
|
||||
|
||||
contextFlags = isJavaScriptFile ? NodeFlags.JavaScriptFile : NodeFlags.None;
|
||||
contextFlags = scriptKind === ScriptKind.JS || scriptKind === ScriptKind.JSX ? NodeFlags.JavaScriptFile : NodeFlags.None;
|
||||
parseErrorBeforeNextFinishedNode = false;
|
||||
|
||||
// Initialize and prime the scanner before parsing the source elements.
|
||||
scanner.setText(sourceText);
|
||||
scanner.setOnError(scanError);
|
||||
scanner.setScriptTarget(languageVersion);
|
||||
scanner.setLanguageVariant(getLanguageVariant(fileName));
|
||||
scanner.setLanguageVariant(getLanguageVariant(scriptKind));
|
||||
}
|
||||
|
||||
function clearState() {
|
||||
@@ -585,8 +608,8 @@ namespace ts {
|
||||
sourceText = undefined;
|
||||
}
|
||||
|
||||
function parseSourceFileWorker(fileName: string, languageVersion: ScriptTarget, setParentNodes: boolean): SourceFile {
|
||||
sourceFile = createSourceFile(fileName, languageVersion);
|
||||
function parseSourceFileWorker(fileName: string, languageVersion: ScriptTarget, setParentNodes: boolean, scriptKind: ScriptKind): SourceFile {
|
||||
sourceFile = createSourceFile(fileName, languageVersion, scriptKind);
|
||||
sourceFile.flags = contextFlags;
|
||||
|
||||
// Prime the scanner.
|
||||
@@ -653,7 +676,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function createSourceFile(fileName: string, languageVersion: ScriptTarget): SourceFile {
|
||||
function createSourceFile(fileName: string, languageVersion: ScriptTarget, scriptKind: ScriptKind): SourceFile {
|
||||
// code from createNode is inlined here so createNode won't have to deal with special case of creating source files
|
||||
// this is quite rare comparing to other nodes and createNode should be as fast as possible
|
||||
const sourceFile = <SourceFile>new SourceFileConstructor(SyntaxKind.SourceFile, /*pos*/ 0, /* end */ sourceText.length);
|
||||
@@ -663,8 +686,9 @@ namespace ts {
|
||||
sourceFile.bindDiagnostics = [];
|
||||
sourceFile.languageVersion = languageVersion;
|
||||
sourceFile.fileName = normalizePath(fileName);
|
||||
sourceFile.languageVariant = getLanguageVariant(sourceFile.fileName);
|
||||
sourceFile.languageVariant = getLanguageVariant(scriptKind);
|
||||
sourceFile.isDeclarationFile = fileExtensionIs(sourceFile.fileName, ".d.ts");
|
||||
sourceFile.scriptKind = scriptKind;
|
||||
|
||||
return sourceFile;
|
||||
}
|
||||
@@ -5589,7 +5613,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function parseJSDocTypeExpressionForTests(content: string, start: number, length: number) {
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined);
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS);
|
||||
scanner.setText(content, start, length);
|
||||
token = scanner.scan();
|
||||
const jsDocTypeExpression = parseJSDocTypeExpression();
|
||||
@@ -5908,7 +5932,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function parseIsolatedJSDocComment(content: string, start: number, length: number) {
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined);
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS);
|
||||
sourceFile = <SourceFile>{ languageVariant: LanguageVariant.Standard, text: content };
|
||||
const jsDocComment = parseJSDocCommentWorker(start, length);
|
||||
const diagnostics = parseDiagnostics;
|
||||
@@ -6234,7 +6258,7 @@ namespace ts {
|
||||
if (sourceFile.statements.length === 0) {
|
||||
// If we don't have any statements in the current source file, then there's no real
|
||||
// way to incrementally parse. So just do a full parse instead.
|
||||
return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true);
|
||||
return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind);
|
||||
}
|
||||
|
||||
// Make sure we're not trying to incrementally update a source file more than once. Once
|
||||
@@ -6298,7 +6322,7 @@ namespace ts {
|
||||
// inconsistent tree. Setting the parents on the new tree should be very fast. We
|
||||
// will immediately bail out of walking any subtrees when we can see that their parents
|
||||
// are already correct.
|
||||
const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true);
|
||||
const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+26
-8
@@ -1030,7 +1030,14 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getDeclarationDiagnostics(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
|
||||
return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
|
||||
const options = program.getCompilerOptions();
|
||||
// collect diagnostics from the program only once if either no source file was specified or out/outFile is set (bundled emit)
|
||||
if (!sourceFile || options.out || options.outFile) {
|
||||
return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
|
||||
}
|
||||
else {
|
||||
return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
function getSyntacticDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
|
||||
@@ -1244,17 +1251,19 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
function getDeclarationDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
|
||||
function getDeclarationDiagnosticsWorker(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
|
||||
return runWithCancellationToken(() => {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
const resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken);
|
||||
// Don't actually write any files since we're just getting diagnostics.
|
||||
const writeFile: WriteFileCallback = () => { };
|
||||
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
|
||||
}
|
||||
const resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken);
|
||||
// Don't actually write any files since we're just getting diagnostics.
|
||||
const writeFile: WriteFileCallback = () => { };
|
||||
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
|
||||
});
|
||||
}
|
||||
|
||||
function getDeclarationDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
|
||||
return isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
|
||||
}
|
||||
|
||||
function getOptionsDiagnostics(): Diagnostic[] {
|
||||
const allDiagnostics: Diagnostic[] = [];
|
||||
addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());
|
||||
@@ -1670,6 +1679,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (options.declarationDir) {
|
||||
if (!options.declaration) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration"));
|
||||
}
|
||||
if (options.out || options.outFile) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile"));
|
||||
}
|
||||
}
|
||||
|
||||
const languageVersion = options.target || ScriptTarget.ES3;
|
||||
const outFile = options.outFile || options.out;
|
||||
|
||||
|
||||
+15
-8
@@ -240,6 +240,11 @@ namespace ts {
|
||||
return typeof JSON === "object" && typeof JSON.parse === "function";
|
||||
}
|
||||
|
||||
function isWatchSet(options: CompilerOptions) {
|
||||
// Firefox has Object.prototype.watch
|
||||
return options.watch && options.hasOwnProperty("watch");
|
||||
}
|
||||
|
||||
export function executeCommandLine(args: string[]): void {
|
||||
const commandLine = parseCommandLine(args);
|
||||
let configFileName: string; // Configuration file name (if any)
|
||||
@@ -327,8 +332,7 @@ namespace ts {
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
// Firefox has Object.prototype.watch
|
||||
if (commandLine.options.watch && commandLine.options.hasOwnProperty("watch")) {
|
||||
if (isWatchSet(commandLine.options)) {
|
||||
if (!sys.watchFile) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* compilerHost */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
@@ -415,7 +419,7 @@ namespace ts {
|
||||
|
||||
const compileResult = compile(rootFileNames, compilerOptions, compilerHost);
|
||||
|
||||
if (!compilerOptions.watch) {
|
||||
if (!isWatchSet(compilerOptions)) {
|
||||
return sys.exit(compileResult.exitStatus);
|
||||
}
|
||||
|
||||
@@ -441,7 +445,7 @@ namespace ts {
|
||||
}
|
||||
// Use default host function
|
||||
const sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
|
||||
if (sourceFile && compilerOptions.watch) {
|
||||
if (sourceFile && isWatchSet(compilerOptions)) {
|
||||
// Attach a file watcher
|
||||
const filePath = toPath(sourceFile.fileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
|
||||
sourceFile.fileWatcher = sys.watchFile(filePath, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));
|
||||
@@ -710,16 +714,19 @@ namespace ts {
|
||||
else {
|
||||
const compilerOptions = extend(options, defaultInitCompilerOptions);
|
||||
const configurations: any = {
|
||||
compilerOptions: serializeCompilerOptions(compilerOptions)
|
||||
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"];
|
||||
}
|
||||
else {
|
||||
configurations.exclude = ["node_modules"];
|
||||
if (compilerOptions.outDir) {
|
||||
configurations.exclude.push(compilerOptions.outDir);
|
||||
}
|
||||
}
|
||||
|
||||
sys.writeFile(file, JSON.stringify(configurations, undefined, 4));
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* compilerHost */ undefined);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
namespace ts {
|
||||
export interface Map<T> {
|
||||
[index: string]: T;
|
||||
@@ -1530,6 +1531,7 @@ namespace ts {
|
||||
hasNoDefaultLib: boolean;
|
||||
|
||||
languageVersion: ScriptTarget;
|
||||
/* @internal */ scriptKind: ScriptKind;
|
||||
|
||||
// The first node that causes this file to be an external module
|
||||
/* @internal */ externalModuleIndicator: Node;
|
||||
@@ -2369,6 +2371,7 @@ namespace ts {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
declaration?: boolean;
|
||||
declarationDir?: string;
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
@@ -2459,6 +2462,14 @@ namespace ts {
|
||||
character: number;
|
||||
}
|
||||
|
||||
export const enum ScriptKind {
|
||||
Unknown = 0,
|
||||
JS = 1,
|
||||
JSX = 2,
|
||||
TS = 3,
|
||||
TSX = 4
|
||||
}
|
||||
|
||||
export const enum ScriptTarget {
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
|
||||
+18
-10
@@ -2012,6 +2012,18 @@ namespace ts {
|
||||
return emitOutputFilePathWithoutExtension + extension;
|
||||
}
|
||||
|
||||
export function getDeclarationEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost) {
|
||||
const options = host.getCompilerOptions();
|
||||
const outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified
|
||||
|
||||
if (options.declaration) {
|
||||
const path = outputDir
|
||||
? getSourceFilePathInNewDir(sourceFile, host, outputDir)
|
||||
: sourceFile.fileName;
|
||||
return removeFileExtension(path) + ".d.ts";
|
||||
}
|
||||
}
|
||||
|
||||
export function getEmitScriptTarget(compilerOptions: CompilerOptions) {
|
||||
return compilerOptions.target || ScriptTarget.ES3;
|
||||
}
|
||||
@@ -2065,23 +2077,23 @@ namespace ts {
|
||||
const emitFileNames: EmitFileNames = {
|
||||
jsFilePath,
|
||||
sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
|
||||
declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitFilePath(jsFilePath, options) : undefined
|
||||
declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined
|
||||
};
|
||||
action(emitFileNames, [sourceFile], /*isBundledEmit*/false);
|
||||
}
|
||||
|
||||
function onBundledEmit(host: EmitHost) {
|
||||
// Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified
|
||||
const bundledSources = filter(host.getSourceFiles(),
|
||||
sourceFile => !isDeclarationFile(sourceFile) && // Not a declaration file
|
||||
(!isExternalModule(sourceFile) || // non module file
|
||||
(getEmitModuleKind(options) && isExternalModule(sourceFile)))); // module that can emit - note falsy value from getEmitModuleKind means the module kind that shouldn't be emitted
|
||||
const bundledSources = filter(host.getSourceFiles(), sourceFile =>
|
||||
!isDeclarationFile(sourceFile) // Not a declaration file
|
||||
&& (!isExternalModule(sourceFile) || !!getEmitModuleKind(options))); // and not a module, unless module emit enabled
|
||||
|
||||
if (bundledSources.length) {
|
||||
const jsFilePath = options.outFile || options.out;
|
||||
const emitFileNames: EmitFileNames = {
|
||||
jsFilePath,
|
||||
sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
|
||||
declarationFilePath: getDeclarationEmitFilePath(jsFilePath, options)
|
||||
declarationFilePath: options.declaration ? removeFileExtension(jsFilePath) + ".d.ts" : undefined
|
||||
};
|
||||
action(emitFileNames, bundledSources, /*isBundledEmit*/true);
|
||||
}
|
||||
@@ -2090,10 +2102,6 @@ namespace ts {
|
||||
function getSourceMapFilePath(jsFilePath: string, options: CompilerOptions) {
|
||||
return options.sourceMap ? jsFilePath + ".map" : undefined;
|
||||
}
|
||||
|
||||
function getDeclarationEmitFilePath(jsFilePath: string, options: CompilerOptions) {
|
||||
return options.declaration ? removeFileExtension(jsFilePath) + ".d.ts" : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) {
|
||||
|
||||
@@ -262,8 +262,8 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
// different order with 'pull' operations, and thus can produce slightly differing
|
||||
// output.
|
||||
//
|
||||
// For example, with a full type check, we may see a type outputed as: number | string
|
||||
// But with a pull type check, we may see it as: string | number
|
||||
// For example, with a full type check, we may see a type displayed as: number | string
|
||||
// But with a pull type check, we may see it as: string | number
|
||||
//
|
||||
// These types are equivalent, but depend on what order the compiler observed
|
||||
// certain parts of the program.
|
||||
|
||||
Vendored
+2
-2
@@ -1073,7 +1073,7 @@ declare module "crypto" {
|
||||
update(data: any): void;
|
||||
sign(private_key: string, output_format: string): string;
|
||||
}
|
||||
export function createVerify(algorith: string): Verify;
|
||||
export function createVerify(algorithm: string): Verify;
|
||||
interface Verify {
|
||||
update(data: any): void;
|
||||
verify(object: string, signature: string, signature_format?: string): boolean;
|
||||
@@ -1237,7 +1237,7 @@ declare module "assert" {
|
||||
export function equal(actual: any, expected: any, message?: string): void;
|
||||
export function notEqual(actual: any, expected: any, message?: string): void;
|
||||
export function deepEqual(actual: any, expected: any, message?: string): void;
|
||||
export function notDeepEqual(acutal: any, expected: any, message?: string): void;
|
||||
export function notDeepEqual(actual: any, expected: any, message?: string): void;
|
||||
export function strictEqual(actual: any, expected: any, message?: string): void;
|
||||
export function notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||
export var throws: {
|
||||
|
||||
@@ -231,13 +231,13 @@ namespace FourSlash {
|
||||
private getLanguageServiceAdapter(testType: FourSlashTestType, cancellationToken: TestCancellationToken, compilationOptions: ts.CompilerOptions): Harness.LanguageService.LanguageServiceAdapter {
|
||||
switch (testType) {
|
||||
case FourSlashTestType.Native:
|
||||
return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
return new Harness.LanguageService.NativeLanguageServiceAdapter(cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.Shims:
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ false, cancellationToken, compilationOptions);
|
||||
return new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ false, cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.ShimsWithPreprocess:
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ true, cancellationToken, compilationOptions);
|
||||
return new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ true, cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.Server:
|
||||
return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
return new Harness.LanguageService.ServerLanguageServiceAdapter(cancellationToken, compilationOptions);
|
||||
default:
|
||||
throw new Error("Unknown FourSlash test type: ");
|
||||
}
|
||||
@@ -1279,7 +1279,7 @@ namespace FourSlash {
|
||||
const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
|
||||
if (edits.length) {
|
||||
offset += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
|
||||
// this.checkPostEditInletiants();
|
||||
// this.checkPostEditInvariants();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1370,7 +1370,7 @@ namespace FourSlash {
|
||||
const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
|
||||
if (edits.length) {
|
||||
offset += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
|
||||
// this.checkPostEditInletiants();
|
||||
// this.checkPostEditInvariants();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2771,12 +2771,12 @@ namespace FourSlashInterface {
|
||||
|
||||
// Verifies the member list contains the specified symbol. The
|
||||
// member list is brought up if necessary
|
||||
public memberListContains(symbol: string, text?: string, documenation?: string, kind?: string) {
|
||||
public memberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
|
||||
if (this.negative) {
|
||||
this.state.verifyMemberListDoesNotContain(symbol);
|
||||
}
|
||||
else {
|
||||
this.state.verifyMemberListContains(symbol, text, documenation, kind);
|
||||
this.state.verifyMemberListContains(symbol, text, documentation, kind);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1330,7 +1330,7 @@ namespace Harness {
|
||||
|
||||
public getSourceMapRecord() {
|
||||
if (this.sourceMapData) {
|
||||
return Harness.SourceMapRecoder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
|
||||
return Harness.SourceMapRecorder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ namespace Harness.LanguageService {
|
||||
const script = this.getScriptInfo(fileName);
|
||||
return script ? new ScriptSnapshot(script) : undefined;
|
||||
}
|
||||
getScriptKind(fileName: string): ts.ScriptKind { return ts.ScriptKind.Unknown; }
|
||||
getScriptVersion(fileName: string): string {
|
||||
const script = this.getScriptInfo(fileName);
|
||||
return script ? script.version.toString() : undefined;
|
||||
@@ -193,7 +194,7 @@ namespace Harness.LanguageService {
|
||||
error(s: string): void { }
|
||||
}
|
||||
|
||||
export class NativeLanugageServiceAdapter implements LanguageServiceAdapter {
|
||||
export class NativeLanguageServiceAdapter implements LanguageServiceAdapter {
|
||||
private host: NativeLanguageServiceHost;
|
||||
constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
this.host = new NativeLanguageServiceHost(cancellationToken, options);
|
||||
@@ -253,6 +254,7 @@ namespace Harness.LanguageService {
|
||||
const nativeScriptSnapshot = this.nativeHost.getScriptSnapshot(fileName);
|
||||
return nativeScriptSnapshot && new ScriptSnapshotProxy(nativeScriptSnapshot);
|
||||
}
|
||||
getScriptKind(fileName: string): ts.ScriptKind { return this.nativeHost.getScriptKind(fileName); }
|
||||
getScriptVersion(fileName: string): string { return this.nativeHost.getScriptVersion(fileName); }
|
||||
getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); }
|
||||
|
||||
@@ -427,7 +429,7 @@ namespace Harness.LanguageService {
|
||||
dispose(): void { this.shim.dispose({}); }
|
||||
}
|
||||
|
||||
export class ShimLanugageServiceAdapter implements LanguageServiceAdapter {
|
||||
export class ShimLanguageServiceAdapter implements LanguageServiceAdapter {
|
||||
private host: ShimLanguageServiceHost;
|
||||
private factory: ts.TypeScriptServicesFactory;
|
||||
constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
@@ -609,7 +611,7 @@ namespace Harness.LanguageService {
|
||||
}
|
||||
}
|
||||
|
||||
export class ServerLanugageServiceAdapter implements LanguageServiceAdapter {
|
||||
export class ServerLanguageServiceAdapter implements LanguageServiceAdapter {
|
||||
private host: SessionClientHost;
|
||||
private client: ts.server.SessionClient;
|
||||
constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Playback {
|
||||
};
|
||||
wrapper.startReplayFromData = log => {
|
||||
replayLog = log;
|
||||
// Remove non-found files from the log (shouldn't really need them, but we still record them for diganostic purposes)
|
||||
// Remove non-found files from the log (shouldn't really need them, but we still record them for diagnostic purposes)
|
||||
replayLog.filesRead = replayLog.filesRead.filter(f => f.result.contents !== undefined);
|
||||
};
|
||||
|
||||
|
||||
@@ -370,14 +370,14 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
const outputDtsFileName = emitOutputFilePathWithoutExtension + ".d.ts";
|
||||
const file = findOutpuDtsFile(outputDtsFileName);
|
||||
const file = findOutputDtsFile(outputDtsFileName);
|
||||
if (file) {
|
||||
allInputFiles.unshift(file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts";
|
||||
const outputDtsFile = findOutpuDtsFile(outputDtsFileName);
|
||||
const outputDtsFile = findOutputDtsFile(outputDtsFileName);
|
||||
if (!ts.contains(allInputFiles, outputDtsFile)) {
|
||||
allInputFiles.unshift(outputDtsFile);
|
||||
}
|
||||
@@ -387,7 +387,7 @@ class ProjectRunner extends RunnerBase {
|
||||
// Dont allow config files since we are compiling existing source options
|
||||
return compileProjectFiles(compilerResult.moduleKind, getInputFiles, getSourceFileText, writeFile, compilerResult.compilerOptions);
|
||||
|
||||
function findOutpuDtsFile(fileName: string) {
|
||||
function findOutputDtsFile(fileName: string) {
|
||||
return ts.forEach(compilerResult.outputFiles, outputFile => outputFile.emittedFileName === fileName ? outputFile : undefined);
|
||||
}
|
||||
function getInputFiles() {
|
||||
@@ -484,7 +484,7 @@ class ProjectRunner extends RunnerBase {
|
||||
it("SourceMapRecord for (" + moduleNameToString(moduleKind) + "): " + testCaseFileName, () => {
|
||||
if (compilerResult.sourceMapData) {
|
||||
Harness.Baseline.runBaseline("SourceMapRecord for (" + moduleNameToString(compilerResult.moduleKind) + "): " + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + ".sourcemap.txt", () => {
|
||||
return Harness.SourceMapRecoder.getSourceMapRecord(compilerResult.sourceMapData, compilerResult.program,
|
||||
return Harness.SourceMapRecorder.getSourceMapRecord(compilerResult.sourceMapData, compilerResult.program,
|
||||
ts.filter(compilerResult.outputFiles, outputFile => Harness.Compiler.isJS(outputFile.emittedFileName)));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
///<reference path="harness.ts"/>
|
||||
|
||||
namespace Harness.SourceMapRecoder {
|
||||
namespace Harness.SourceMapRecorder {
|
||||
|
||||
interface SourceMapSpanWithDecodeErrors {
|
||||
sourceMapSpan: ts.SourceMapSpan;
|
||||
@@ -202,7 +202,7 @@ namespace Harness.SourceMapRecoder {
|
||||
}
|
||||
|
||||
namespace SourceMapSpanWriter {
|
||||
let sourceMapRecoder: Compiler.WriterAggregator;
|
||||
let sourceMapRecorder: Compiler.WriterAggregator;
|
||||
let sourceMapSources: string[];
|
||||
let sourceMapNames: string[];
|
||||
|
||||
@@ -216,8 +216,8 @@ namespace Harness.SourceMapRecoder {
|
||||
let prevWrittenJsLine: number;
|
||||
let spanMarkerContinues: boolean;
|
||||
|
||||
export function intializeSourceMapSpanWriter(sourceMapRecordWriter: Compiler.WriterAggregator, sourceMapData: ts.SourceMapData, currentJsFile: Compiler.GeneratedFile) {
|
||||
sourceMapRecoder = sourceMapRecordWriter;
|
||||
export function initializeSourceMapSpanWriter(sourceMapRecordWriter: Compiler.WriterAggregator, sourceMapData: ts.SourceMapData, currentJsFile: Compiler.GeneratedFile) {
|
||||
sourceMapRecorder = sourceMapRecordWriter;
|
||||
sourceMapSources = sourceMapData.sourceMapSources;
|
||||
sourceMapNames = sourceMapData.sourceMapNames;
|
||||
|
||||
@@ -231,15 +231,15 @@ namespace Harness.SourceMapRecoder {
|
||||
|
||||
SourceMapDecoder.initializeSourceMapDecoding(sourceMapData);
|
||||
|
||||
sourceMapRecoder.WriteLine("===================================================================");
|
||||
sourceMapRecoder.WriteLine("JsFile: " + sourceMapData.sourceMapFile);
|
||||
sourceMapRecoder.WriteLine("mapUrl: " + sourceMapData.jsSourceMappingURL);
|
||||
sourceMapRecoder.WriteLine("sourceRoot: " + sourceMapData.sourceMapSourceRoot);
|
||||
sourceMapRecoder.WriteLine("sources: " + sourceMapData.sourceMapSources);
|
||||
sourceMapRecorder.WriteLine("===================================================================");
|
||||
sourceMapRecorder.WriteLine("JsFile: " + sourceMapData.sourceMapFile);
|
||||
sourceMapRecorder.WriteLine("mapUrl: " + sourceMapData.jsSourceMappingURL);
|
||||
sourceMapRecorder.WriteLine("sourceRoot: " + sourceMapData.sourceMapSourceRoot);
|
||||
sourceMapRecorder.WriteLine("sources: " + sourceMapData.sourceMapSources);
|
||||
if (sourceMapData.sourceMapSourcesContent) {
|
||||
sourceMapRecoder.WriteLine("sourcesContent: " + JSON.stringify(sourceMapData.sourceMapSourcesContent));
|
||||
sourceMapRecorder.WriteLine("sourcesContent: " + JSON.stringify(sourceMapData.sourceMapSourcesContent));
|
||||
}
|
||||
sourceMapRecoder.WriteLine("===================================================================");
|
||||
sourceMapRecorder.WriteLine("===================================================================");
|
||||
}
|
||||
|
||||
function getSourceMapSpanString(mapEntry: ts.SourceMapSpan, getAbsentNameIndex?: boolean) {
|
||||
@@ -291,10 +291,10 @@ namespace Harness.SourceMapRecoder {
|
||||
recordSourceMapSpan(sourceMapSpan);
|
||||
|
||||
assert.isTrue(spansOnSingleLine.length === 1);
|
||||
sourceMapRecoder.WriteLine("-------------------------------------------------------------------");
|
||||
sourceMapRecoder.WriteLine("emittedFile:" + jsFile.fileName);
|
||||
sourceMapRecoder.WriteLine("sourceFile:" + sourceMapSources[spansOnSingleLine[0].sourceMapSpan.sourceIndex]);
|
||||
sourceMapRecoder.WriteLine("-------------------------------------------------------------------");
|
||||
sourceMapRecorder.WriteLine("-------------------------------------------------------------------");
|
||||
sourceMapRecorder.WriteLine("emittedFile:" + jsFile.fileName);
|
||||
sourceMapRecorder.WriteLine("sourceFile:" + sourceMapSources[spansOnSingleLine[0].sourceMapSpan.sourceIndex]);
|
||||
sourceMapRecorder.WriteLine("-------------------------------------------------------------------");
|
||||
|
||||
tsLineMap = ts.computeLineStarts(newSourceFileCode);
|
||||
tsCode = newSourceFileCode;
|
||||
@@ -306,8 +306,8 @@ namespace Harness.SourceMapRecoder {
|
||||
writeRecordedSpans();
|
||||
|
||||
if (!SourceMapDecoder.hasCompletedDecoding()) {
|
||||
sourceMapRecoder.WriteLine("!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded");
|
||||
sourceMapRecoder.WriteLine("!!!! **** Remaining decoded string: " + SourceMapDecoder.getRemainingDecodeString());
|
||||
sourceMapRecorder.WriteLine("!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded");
|
||||
sourceMapRecorder.WriteLine("!!!! **** Remaining decoded string: " + SourceMapDecoder.getRemainingDecodeString());
|
||||
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace Harness.SourceMapRecoder {
|
||||
|
||||
function writeJsFileLines(endJsLine: number) {
|
||||
for (; prevWrittenJsLine < endJsLine; prevWrittenJsLine++) {
|
||||
sourceMapRecoder.Write(">>>" + getTextOfLine(prevWrittenJsLine, jsLineMap, jsFile.code));
|
||||
sourceMapRecorder.Write(">>>" + getTextOfLine(prevWrittenJsLine, jsLineMap, jsFile.code));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,9 +356,9 @@ namespace Harness.SourceMapRecoder {
|
||||
}
|
||||
|
||||
function writeSourceMapIndent(indentLength: number, indentPrefix: string) {
|
||||
sourceMapRecoder.Write(indentPrefix);
|
||||
sourceMapRecorder.Write(indentPrefix);
|
||||
for (let i = 1; i < indentLength; i++) {
|
||||
sourceMapRecoder.Write(" ");
|
||||
sourceMapRecorder.Write(" ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,12 +369,12 @@ namespace Harness.SourceMapRecoder {
|
||||
writeSourceMapIndent(prevEmittedCol, markerId);
|
||||
|
||||
for (let i = prevEmittedCol; i < endColumn; i++) {
|
||||
sourceMapRecoder.Write("^");
|
||||
sourceMapRecorder.Write("^");
|
||||
}
|
||||
if (endContinues) {
|
||||
sourceMapRecoder.Write("->");
|
||||
sourceMapRecorder.Write("->");
|
||||
}
|
||||
sourceMapRecoder.WriteLine("");
|
||||
sourceMapRecorder.WriteLine("");
|
||||
spanMarkerContinues = endContinues;
|
||||
}
|
||||
|
||||
@@ -390,16 +390,16 @@ namespace Harness.SourceMapRecoder {
|
||||
// If there are decode errors, write
|
||||
for (let i = 0; i < currentSpan.decodeErrors.length; i++) {
|
||||
writeSourceMapIndent(prevEmittedCol, markerIds[index]);
|
||||
sourceMapRecoder.WriteLine(currentSpan.decodeErrors[i]);
|
||||
sourceMapRecorder.WriteLine(currentSpan.decodeErrors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
const tsCodeLineMap = ts.computeLineStarts(sourceText);
|
||||
for (let i = 0; i < tsCodeLineMap.length; i++) {
|
||||
writeSourceMapIndent(prevEmittedCol, i === 0 ? markerIds[index] : " >");
|
||||
sourceMapRecoder.Write(getTextOfLine(i, tsCodeLineMap, sourceText));
|
||||
sourceMapRecorder.Write(getTextOfLine(i, tsCodeLineMap, sourceText));
|
||||
if (i === tsCodeLineMap.length - 1) {
|
||||
sourceMapRecoder.WriteLine("");
|
||||
sourceMapRecorder.WriteLine("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ namespace Harness.SourceMapRecoder {
|
||||
}
|
||||
|
||||
function writeSpanDetails(currentSpan: SourceMapSpanWithDecodeErrors, index: number) {
|
||||
sourceMapRecoder.WriteLine(markerIds[index] + getSourceMapSpanString(currentSpan.sourceMapSpan));
|
||||
sourceMapRecorder.WriteLine(markerIds[index] + getSourceMapSpanString(currentSpan.sourceMapSpan));
|
||||
}
|
||||
|
||||
if (spansOnSingleLine.length) {
|
||||
@@ -431,19 +431,19 @@ namespace Harness.SourceMapRecoder {
|
||||
// Emit column number etc
|
||||
iterateSpans(writeSpanDetails);
|
||||
|
||||
sourceMapRecoder.WriteLine("---");
|
||||
sourceMapRecorder.WriteLine("---");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getSourceMapRecord(sourceMapDataList: ts.SourceMapData[], program: ts.Program, jsFiles: Compiler.GeneratedFile[]) {
|
||||
const sourceMapRecoder = new Compiler.WriterAggregator();
|
||||
const sourceMapRecorder = new Compiler.WriterAggregator();
|
||||
|
||||
for (let i = 0; i < sourceMapDataList.length; i++) {
|
||||
const sourceMapData = sourceMapDataList[i];
|
||||
let prevSourceFile: ts.SourceFile;
|
||||
|
||||
SourceMapSpanWriter.intializeSourceMapSpanWriter(sourceMapRecoder, sourceMapData, jsFiles[i]);
|
||||
SourceMapSpanWriter.initializeSourceMapSpanWriter(sourceMapRecorder, sourceMapData, jsFiles[i]);
|
||||
for (let j = 0; j < sourceMapData.sourceMapDecodedMappings.length; j++) {
|
||||
const decodedSourceMapping = sourceMapData.sourceMapDecodedMappings[j];
|
||||
const currentSourceFile = program.getSourceFile(sourceMapData.inputSourceFileNames[decodedSourceMapping.sourceIndex]);
|
||||
@@ -457,7 +457,7 @@ namespace Harness.SourceMapRecoder {
|
||||
}
|
||||
SourceMapSpanWriter.close(); // If the last spans werent emitted, emit them
|
||||
}
|
||||
sourceMapRecoder.Close();
|
||||
return sourceMapRecoder.lines.join("\r\n");
|
||||
sourceMapRecorder.Close();
|
||||
return sourceMapRecorder.lines.join("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-5
@@ -194,7 +194,7 @@ declare var ANGLE_instanced_arrays: {
|
||||
VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;
|
||||
}
|
||||
|
||||
interface AnalyserNode extends AudioNode {
|
||||
interface AnalyzerNode extends AudioNode {
|
||||
fftSize: number;
|
||||
frequencyBinCount: number;
|
||||
maxDecibels: number;
|
||||
@@ -206,9 +206,9 @@ interface AnalyserNode extends AudioNode {
|
||||
getFloatTimeDomainData(array: Float32Array): void;
|
||||
}
|
||||
|
||||
declare var AnalyserNode: {
|
||||
prototype: AnalyserNode;
|
||||
new(): AnalyserNode;
|
||||
declare var AnalyzerNode: {
|
||||
prototype: AnalyzerNode;
|
||||
new(): AnalyzerNode;
|
||||
}
|
||||
|
||||
interface AnimationEvent extends Event {
|
||||
@@ -322,7 +322,7 @@ interface AudioContext extends EventTarget {
|
||||
listener: AudioListener;
|
||||
sampleRate: number;
|
||||
state: string;
|
||||
createAnalyser(): AnalyserNode;
|
||||
createAnalyzer(): AnalyzerNode;
|
||||
createBiquadFilter(): BiquadFilterNode;
|
||||
createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;
|
||||
createBufferSource(): AudioBufferSourceNode;
|
||||
|
||||
Vendored
+1
-1
@@ -222,7 +222,7 @@ interface NumberConstructor {
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace ts.server {
|
||||
|
||||
private processResponse<T extends protocol.Response>(request: protocol.Request): T {
|
||||
var lastMessage = this.messages.shift();
|
||||
Debug.assert(!!lastMessage, "Did not recieve any responses.");
|
||||
Debug.assert(!!lastMessage, "Did not receive any responses.");
|
||||
|
||||
// Read the content length
|
||||
var contentLengthPrefix = "Content-Length: ";
|
||||
@@ -108,7 +108,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
// verify the sequence numbers
|
||||
Debug.assert(response.request_seq === request.seq, "Malformed response: response sequance number did not match request sequence number.");
|
||||
Debug.assert(response.request_seq === request.seq, "Malformed response: response sequence number did not match request sequence number.");
|
||||
|
||||
// unmarshal errors
|
||||
if (!response.success) {
|
||||
|
||||
@@ -192,6 +192,10 @@ namespace ts.server {
|
||||
return this.roots.map(root => root.fileName);
|
||||
}
|
||||
|
||||
getScriptKind() {
|
||||
return ScriptKind.Unknown;
|
||||
}
|
||||
|
||||
getScriptVersion(filename: string) {
|
||||
return this.getScriptInfo(filename).svc.latestVersion().toString();
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -444,7 +444,7 @@ declare namespace ts.server.protocol {
|
||||
/** Defines space handling after a comma delimiter. Default value is true. */
|
||||
insertSpaceAfterCommaDelimiter?: boolean;
|
||||
|
||||
/** Defines space handling after a semicolon in a for statemen. Default value is true */
|
||||
/** Defines space handling after a semicolon in a for statement. Default value is true */
|
||||
insertSpaceAfterSemicolonInForStatements?: boolean;
|
||||
|
||||
/** Defines space handling after a binary operator. Default value is true. */
|
||||
@@ -469,7 +469,7 @@ declare namespace ts.server.protocol {
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
|
||||
/** Index operator */
|
||||
[key: string] : string | number | boolean;
|
||||
[key: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -835,7 +835,7 @@ declare namespace ts.server.protocol {
|
||||
prefixDisplayParts: SymbolDisplayPart[];
|
||||
|
||||
/**
|
||||
* The suffix disaply parts.
|
||||
* The suffix display parts.
|
||||
*/
|
||||
suffixDisplayParts: SymbolDisplayPart[];
|
||||
|
||||
@@ -903,7 +903,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* Repsonse object for a SignatureHelpRequest.
|
||||
* Response object for a SignatureHelpRequest.
|
||||
*/
|
||||
export interface SignatureHelpResponse extends Response {
|
||||
body?: SignatureHelpItems;
|
||||
@@ -970,7 +970,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
export interface Diagnostic {
|
||||
/**
|
||||
* Starting file location at which text appies.
|
||||
* Starting file location at which text applies.
|
||||
*/
|
||||
start: Location;
|
||||
|
||||
@@ -1179,7 +1179,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* NavBar itesm request; value of command field is "navbar".
|
||||
* NavBar items request; value of command field is "navbar".
|
||||
* Return response giving the list of navigation bar entries
|
||||
* extracted from the requested file.
|
||||
*/
|
||||
|
||||
@@ -603,7 +603,7 @@ namespace ts.server {
|
||||
// Check whether we should auto-indent. This will be when
|
||||
// the position is on a line containing only whitespace.
|
||||
// This should leave the edits returned from
|
||||
// getFormattingEditsAfterKeytroke either empty or pertaining
|
||||
// getFormattingEditsAfterKeystroke either empty or pertaining
|
||||
// only to the previous line. If all this is true, then
|
||||
// add edits necessary to properly indent the current line.
|
||||
if ((key == "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) {
|
||||
|
||||
@@ -490,17 +490,17 @@ namespace ts.BreakpointResolver {
|
||||
return spanInNode(block.statements[0]);
|
||||
}
|
||||
|
||||
function spanInInitializerOfForLike(forLikeStaement: ForStatement | ForOfStatement | ForInStatement): TextSpan {
|
||||
if (forLikeStaement.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
function spanInInitializerOfForLike(forLikeStatement: ForStatement | ForOfStatement | ForInStatement): TextSpan {
|
||||
if (forLikeStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
// declaration list, set breakpoint in first declaration
|
||||
let variableDeclarationList = <VariableDeclarationList>forLikeStaement.initializer;
|
||||
let variableDeclarationList = <VariableDeclarationList>forLikeStatement.initializer;
|
||||
if (variableDeclarationList.declarations.length > 0) {
|
||||
return spanInNode(variableDeclarationList.declarations[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Expression - set breakpoint in it
|
||||
return spanInNode(forLikeStaement.initializer);
|
||||
return spanInNode(forLikeStatement.initializer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace ts.formatting {
|
||||
return enclosingNode.pos;
|
||||
}
|
||||
|
||||
// preceding token ends after the start of original range (i.e when originaRange.pos falls in the middle of literal)
|
||||
// preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal)
|
||||
// start from the beginning of enclosingNode to handle the entire 'originalRange'
|
||||
if (precedingToken.end >= originalRange.pos) {
|
||||
return enclosingNode.pos;
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace ts.formatting {
|
||||
// readTokenInfo was called before with the same expected scan action.
|
||||
// No need to re-scan text, return existing 'lastTokenInfo'
|
||||
// it is ok to call fixTokenKind here since it does not affect
|
||||
// what portion of text is consumed. In opposize rescanning can change it,
|
||||
// what portion of text is consumed. In contrast rescanning can change it,
|
||||
// i.e. for '>=' when originally scanner eats just one character
|
||||
// and rescanning forces it to consume more.
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
|
||||
@@ -235,29 +235,29 @@ namespace ts.formatting {
|
||||
this.IgnoreAfterLineComment = new Rule(RuleDescriptor.create3(SyntaxKind.SingleLineCommentTrivia, Shared.TokenRange.Any), RuleOperation.create1(RuleAction.Ignore));
|
||||
|
||||
// Space after keyword but not before ; or : or ?
|
||||
this.NoSpaceBeforeSemicolon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeColon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.ColonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeQuestionMark = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.QuestionToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
this.SpaceAfterColon = new Rule(RuleDescriptor.create3(SyntaxKind.ColonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterQuestionMarkInConditionalOperator = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), RuleAction.Space));
|
||||
this.NoSpaceAfterQuestionMark = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterSemicolon = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeSemicolon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeColon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.ColonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeQuestionMark = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.QuestionToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
this.SpaceAfterColon = new Rule(RuleDescriptor.create3(SyntaxKind.ColonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterQuestionMarkInConditionalOperator = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), RuleAction.Space));
|
||||
this.NoSpaceAfterQuestionMark = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterSemicolon = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// Space after }.
|
||||
this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space));
|
||||
this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space));
|
||||
|
||||
// Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied
|
||||
this.SpaceBetweenCloseBraceAndElse = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.ElseKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceBetweenCloseBraceAndElse = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.ElseKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// No space for dot
|
||||
this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterDot = new Rule(RuleDescriptor.create3(SyntaxKind.DotToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterDot = new Rule(RuleDescriptor.create3(SyntaxKind.DotToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// No space before and after indexer
|
||||
this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete));
|
||||
|
||||
// Place a space before open brace in a function declaration
|
||||
this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments;
|
||||
@@ -274,7 +274,7 @@ namespace ts.formatting {
|
||||
// Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}.
|
||||
this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete));
|
||||
|
||||
// Insert new line after { and before } in multi-line contexts.
|
||||
this.NewLineAfterOpenBraceInBlockContext = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsMultilineBlockContext), RuleAction.NewLine));
|
||||
@@ -285,100 +285,100 @@ namespace ts.formatting {
|
||||
// Special handling of unary operators.
|
||||
// Prefix operators generally shouldn't have a space between
|
||||
// them and their target unary expression.
|
||||
this.NoSpaceAfterUnaryPrefixOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.UnaryPrefixOperators, Shared.TokenRange.UnaryPrefixExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterUnaryPreincrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.PlusPlusToken, Shared.TokenRange.UnaryPreincrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterUnaryPredecrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.MinusMinusToken, Shared.TokenRange.UnaryPredecrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeUnaryPostincrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostincrementExpressions, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeUnaryPostdecrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostdecrementExpressions, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterUnaryPrefixOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.UnaryPrefixOperators, Shared.TokenRange.UnaryPrefixExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterUnaryPreincrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.PlusPlusToken, Shared.TokenRange.UnaryPreincrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterUnaryPredecrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.MinusMinusToken, Shared.TokenRange.UnaryPredecrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeUnaryPostincrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostincrementExpressions, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeUnaryPostdecrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostdecrementExpressions, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// More unary operator special-casing.
|
||||
// DevDiv 181814: Be careful when removing leading whitespace
|
||||
// around unary operators. Examples:
|
||||
// 1 - -2 --X--> 1--2
|
||||
// a + ++b --X--> a+++b
|
||||
this.SpaceAfterPostincrementWhenFollowedByAdd = new Rule(RuleDescriptor.create1(SyntaxKind.PlusPlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterAddWhenFollowedByUnaryPlus = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterAddWhenFollowedByPreincrement = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterPostdecrementWhenFollowedBySubtract = new Rule(RuleDescriptor.create1(SyntaxKind.MinusMinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterSubtractWhenFollowedByPredecrement = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterPostincrementWhenFollowedByAdd = new Rule(RuleDescriptor.create1(SyntaxKind.PlusPlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterAddWhenFollowedByUnaryPlus = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterAddWhenFollowedByPreincrement = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterPostdecrementWhenFollowedBySubtract = new Rule(RuleDescriptor.create1(SyntaxKind.MinusMinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterSubtractWhenFollowedByPredecrement = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
|
||||
this.NoSpaceBeforeComma = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CommaToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeComma = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CommaToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword, SyntaxKind.AwaitKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete));
|
||||
this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword, SyntaxKind.AwaitKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete));
|
||||
this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space));
|
||||
|
||||
this.NoSpaceBetweenReturnAndSemicolon = new Rule(RuleDescriptor.create1(SyntaxKind.ReturnKeyword, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenReturnAndSemicolon = new Rule(RuleDescriptor.create1(SyntaxKind.ReturnKeyword, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
|
||||
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
|
||||
this.SpaceBetweenStatements = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.DoKeyword, SyntaxKind.ElseKeyword, SyntaxKind.CaseKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), RuleAction.Space));
|
||||
this.SpaceBetweenStatements = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.DoKeyword, SyntaxKind.ElseKeyword, SyntaxKind.CaseKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotForContext), RuleAction.Space));
|
||||
|
||||
// This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.
|
||||
this.SpaceAfterTryFinally = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword]), SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterTryFinally = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword]), SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// get x() {}
|
||||
// set x(val) {}
|
||||
this.SpaceAfterGetSetInMember = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.GetKeyword, SyntaxKind.SetKeyword]), SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
|
||||
// Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.
|
||||
this.SpaceBeforeBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryKeywordOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryKeywordOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceBeforeBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryKeywordOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryKeywordOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
|
||||
// TypeScript-specific higher priority rules
|
||||
|
||||
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
|
||||
this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Use of module as a function call. e.g.: import m2 = module("m2");
|
||||
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Add a space around certain TypeScript keywords
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, 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, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword]), 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, SyntaxKind.FromKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, 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, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.FromKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 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" {
|
||||
this.SpaceAfterModuleName = new Rule(RuleDescriptor.create1(SyntaxKind.StringLiteral, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsModuleDeclContext), RuleAction.Space));
|
||||
|
||||
// Lambda expressions
|
||||
this.SpaceBeforeArrow = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsGreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterArrow = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsGreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeArrow = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsGreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterArrow = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsGreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// Optional parameters and let args
|
||||
this.NoSpaceAfterEllipsis = new Rule(RuleDescriptor.create1(SyntaxKind.DotDotDotToken, SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOptionalParameters = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterEllipsis = new Rule(RuleDescriptor.create1(SyntaxKind.DotDotDotToken, SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOptionalParameters = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
|
||||
// generics and type assertions
|
||||
this.NoSpaceBeforeOpenAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.TypeNames, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenCloseParenAndAngularBracket = new Rule(RuleDescriptor.create1(SyntaxKind.CloseParenToken, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.LessThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.GreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.FromTokens([SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.GreaterThanToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeOpenAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.TypeNames, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenCloseParenAndAngularBracket = new Rule(RuleDescriptor.create1(SyntaxKind.CloseParenToken, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.LessThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.GreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.FromTokens([SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.GreaterThanToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Delete));
|
||||
|
||||
// Remove spaces in empty interface literals. e.g.: x: {}
|
||||
this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), RuleAction.Delete));
|
||||
|
||||
// decorators
|
||||
this.SpaceBeforeAt = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.AtToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAt = new Rule(RuleDescriptor.create3(SyntaxKind.AtToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceBeforeAt = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.AtToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAt = new Rule(RuleDescriptor.create3(SyntaxKind.AtToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterDecorator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.Identifier, SyntaxKind.ExportKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.ClassKeyword, SyntaxKind.StaticKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword, SyntaxKind.OpenBracketToken, SyntaxKind.AsteriskToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), RuleAction.Space));
|
||||
|
||||
this.NoSpaceBetweenFunctionKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Delete));
|
||||
this.SpaceAfterStarInGeneratorDeclaration = new Rule(RuleDescriptor.create3(SyntaxKind.AsteriskToken, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenYieldKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Delete));
|
||||
this.SpaceBetweenYieldOrYieldStarAndOperand = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Space));
|
||||
this.NoSpaceBetweenYieldKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Delete));
|
||||
this.SpaceBetweenYieldOrYieldStarAndOperand = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Space));
|
||||
|
||||
// Async-await
|
||||
this.SpaceBetweenAsyncAndOpenParen = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBetweenAsyncAndOpenParen = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// template string
|
||||
this.NoSpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// These rules are higher in priority than user-configurable rules.
|
||||
this.HighPriorityCommonRules = [
|
||||
@@ -444,14 +444,14 @@ namespace ts.formatting {
|
||||
///
|
||||
|
||||
// Insert space after comma delimiter
|
||||
this.SpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNextTokenNotCloseBracket), RuleAction.Space));
|
||||
this.NoSpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNextTokenNotCloseBracket), RuleAction.Space));
|
||||
this.NoSpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space before and after binary operators
|
||||
this.SpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
this.SpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after keywords in control flow statements
|
||||
this.SpaceAfterKeywordInControl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Keywords, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext), RuleAction.Space));
|
||||
@@ -468,28 +468,28 @@ namespace ts.formatting {
|
||||
this.NewLineBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Insert space after semicolon in for statement
|
||||
this.SpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), RuleAction.Space));
|
||||
this.NoSpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), RuleAction.Delete));
|
||||
this.SpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Space));
|
||||
this.NoSpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty parenthesis
|
||||
this.SpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenParens = new Rule(RuleDescriptor.create1(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenParens = new Rule(RuleDescriptor.create1(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty brackets
|
||||
this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing template string braces
|
||||
this.NoSpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// Insert space after function keyword for anonymous functions
|
||||
this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
@@ -563,13 +563,13 @@ namespace ts.formatting {
|
||||
//// Ex:
|
||||
//// if (1)
|
||||
//// { ... }
|
||||
//// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format.
|
||||
//// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format.
|
||||
////
|
||||
//// Ex:
|
||||
//// if (1)
|
||||
//// { ...
|
||||
//// }
|
||||
//// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format.
|
||||
//// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format.
|
||||
|
||||
return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context);
|
||||
}
|
||||
@@ -725,8 +725,8 @@ namespace ts.formatting {
|
||||
return context.contextNode.kind === SyntaxKind.ArrowFunction;
|
||||
}
|
||||
|
||||
static IsSameLineTokenContext(context: FormattingContext): boolean {
|
||||
return context.TokensAreOnSameLine();
|
||||
static IsNonJsxSameLineTokenContext(context: FormattingContext): boolean {
|
||||
return context.TokensAreOnSameLine() && context.contextNode.kind !== SyntaxKind.JsxText;
|
||||
}
|
||||
|
||||
static IsNotBeforeBlockInFunctionDeclarationContext(context: FormattingContext): boolean {
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace ts.NavigationBar {
|
||||
return createEnumItem(<EnumDeclaration>node);
|
||||
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return createIterfaceItem(<InterfaceDeclaration>node);
|
||||
return createInterfaceItem(<InterfaceDeclaration>node);
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return createModuleItem(<ModuleDeclaration>node);
|
||||
@@ -493,7 +493,7 @@ namespace ts.NavigationBar {
|
||||
getIndent(node));
|
||||
}
|
||||
|
||||
function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem {
|
||||
function createInterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem {
|
||||
let childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem);
|
||||
return getNavigationBarItem(
|
||||
node.name.text,
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace ts.OutliningElementsCollector {
|
||||
const closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
|
||||
// Check if the block is standalone, or 'attached' to some parent statement.
|
||||
// If the latter, we want to collaps the block, but consider its hint span
|
||||
// If the latter, we want to collapse the block, but consider its hint span
|
||||
// to be the entire span of the parent.
|
||||
if (parent.kind === SyntaxKind.DoStatement ||
|
||||
parent.kind === SyntaxKind.ForInStatement ||
|
||||
|
||||
+32
-17
@@ -806,6 +806,7 @@ namespace ts {
|
||||
public identifierCount: number;
|
||||
public symbolCount: number;
|
||||
public version: string;
|
||||
public scriptKind: ScriptKind;
|
||||
public languageVersion: ScriptTarget;
|
||||
public languageVariant: LanguageVariant;
|
||||
public identifiers: Map<string>;
|
||||
@@ -1019,6 +1020,7 @@ namespace ts {
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptKind?(fileName: string): ScriptKind;
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
getLocalizedDiagnosticMessages?(): any;
|
||||
@@ -1468,7 +1470,8 @@ namespace ts {
|
||||
fileName: string,
|
||||
compilationSettings: CompilerOptions,
|
||||
scriptSnapshot: IScriptSnapshot,
|
||||
version: string): SourceFile;
|
||||
version: string,
|
||||
scriptKind?: ScriptKind): SourceFile;
|
||||
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
@@ -1486,7 +1489,8 @@ namespace ts {
|
||||
fileName: string,
|
||||
compilationSettings: CompilerOptions,
|
||||
scriptSnapshot: IScriptSnapshot,
|
||||
version: string): SourceFile;
|
||||
version: string,
|
||||
scriptKind?: ScriptKind): SourceFile;
|
||||
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
@@ -1657,6 +1661,7 @@ namespace ts {
|
||||
hostFileName: string;
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
scriptKind: ScriptKind;
|
||||
}
|
||||
|
||||
interface DocumentRegistryEntry {
|
||||
@@ -1746,12 +1751,14 @@ namespace ts {
|
||||
|
||||
private createEntry(fileName: string, path: Path) {
|
||||
let entry: HostFileInformation;
|
||||
const scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : ScriptKind.Unknown;
|
||||
const scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
if (scriptSnapshot) {
|
||||
entry = {
|
||||
hostFileName: fileName,
|
||||
version: this.host.getScriptVersion(fileName),
|
||||
scriptSnapshot: scriptSnapshot
|
||||
scriptSnapshot: scriptSnapshot,
|
||||
scriptKind: scriptKind ? scriptKind : getScriptKindFromFileName(fileName)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1817,12 +1824,13 @@ namespace ts {
|
||||
throw new Error("Could not find file: '" + fileName + "'.");
|
||||
}
|
||||
|
||||
const scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : ScriptKind.Unknown;
|
||||
const version = this.host.getScriptVersion(fileName);
|
||||
let sourceFile: SourceFile;
|
||||
|
||||
if (this.currentFileName !== fileName) {
|
||||
// This is a new file, just parse it
|
||||
sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents*/ true);
|
||||
sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents*/ true, scriptKind);
|
||||
}
|
||||
else if (this.currentFileVersion !== version) {
|
||||
// This is the same file, just a newer version. Incrementally parse the file.
|
||||
@@ -1953,9 +1961,9 @@ namespace ts {
|
||||
return output.outputText;
|
||||
}
|
||||
|
||||
export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile {
|
||||
export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile {
|
||||
const text = scriptSnapshot.getText(0, scriptSnapshot.getLength());
|
||||
const sourceFile = createSourceFile(fileName, text, scriptTarget, setNodeParents);
|
||||
const sourceFile = createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind);
|
||||
setSourceFileFields(sourceFile, scriptSnapshot, version);
|
||||
return sourceFile;
|
||||
}
|
||||
@@ -2017,7 +2025,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Otherwise, just create a new source file.
|
||||
return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true);
|
||||
return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true, sourceFile.scriptKind);
|
||||
}
|
||||
|
||||
export function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory = ""): DocumentRegistry {
|
||||
@@ -2059,12 +2067,12 @@ namespace ts {
|
||||
return JSON.stringify(bucketInfoArray, undefined, 2);
|
||||
}
|
||||
|
||||
function acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile {
|
||||
return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring*/ true);
|
||||
function acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile {
|
||||
return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring*/ true, scriptKind);
|
||||
}
|
||||
|
||||
function updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile {
|
||||
return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring*/ false);
|
||||
function updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile {
|
||||
return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring*/ false, scriptKind);
|
||||
}
|
||||
|
||||
function acquireOrUpdateDocument(
|
||||
@@ -2072,7 +2080,8 @@ namespace ts {
|
||||
compilationSettings: CompilerOptions,
|
||||
scriptSnapshot: IScriptSnapshot,
|
||||
version: string,
|
||||
acquiring: boolean): SourceFile {
|
||||
acquiring: boolean,
|
||||
scriptKind?: ScriptKind): SourceFile {
|
||||
|
||||
const bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true);
|
||||
const path = toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
@@ -2081,7 +2090,7 @@ namespace ts {
|
||||
Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
|
||||
|
||||
// Have never seen this file with these settings. Create a new source file for it.
|
||||
const sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false);
|
||||
const sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind);
|
||||
|
||||
entry = {
|
||||
sourceFile: sourceFile,
|
||||
@@ -2829,7 +2838,7 @@ namespace ts {
|
||||
if (oldSourceFile) {
|
||||
// We already had a source file for this file name. Go to the registry to
|
||||
// ensure that we get the right up to date version of it. We need this to
|
||||
// address the following 'race'. Specifically, say we have the following:
|
||||
// address the following race-condition. Specifically, say we have the following:
|
||||
//
|
||||
// LS1
|
||||
// \
|
||||
@@ -2848,14 +2857,20 @@ namespace ts {
|
||||
// it's source file any more, and instead defers to DocumentRegistry to get
|
||||
// either version 1, version 2 (or some other version) depending on what the
|
||||
// host says should be used.
|
||||
return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version);
|
||||
|
||||
// We do not support the scenario where a host can modify a registered
|
||||
// file's script kind, i.e. in one project some file is treated as ".ts"
|
||||
// and in another as ".js"
|
||||
Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + fileName);
|
||||
|
||||
return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);
|
||||
}
|
||||
|
||||
// We didn't already have the file. Fall through and acquire it from the registry.
|
||||
}
|
||||
|
||||
// Could not find this file in the old program, create a new SourceFile for it.
|
||||
return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version);
|
||||
return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);
|
||||
}
|
||||
|
||||
function sourceFileUpToDate(sourceFile: SourceFile): boolean {
|
||||
@@ -4641,7 +4656,7 @@ namespace ts {
|
||||
|
||||
// Go to the original declaration for cases:
|
||||
//
|
||||
// (1) when the aliased symbol was declared in the location(parent).
|
||||
// (1) when the aliased symbol was declared in the location(parent).
|
||||
// (2) when the aliased symbol is originating from a named import.
|
||||
//
|
||||
if (node.kind === SyntaxKind.Identifier &&
|
||||
|
||||
+11
-1
@@ -55,6 +55,7 @@ namespace ts {
|
||||
|
||||
/** Returns a JSON-encoded value of the type: string[] */
|
||||
getScriptFileNames(): string;
|
||||
getScriptKind?(fileName: string): ScriptKind;
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): ScriptSnapshotShim;
|
||||
getLocalizedDiagnosticMessages(): string;
|
||||
@@ -346,6 +347,15 @@ namespace ts {
|
||||
return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot);
|
||||
}
|
||||
|
||||
public getScriptKind(fileName: string): ScriptKind {
|
||||
if ("getScriptKind" in this.shimHost) {
|
||||
return this.shimHost.getScriptKind(fileName);
|
||||
}
|
||||
else {
|
||||
return ScriptKind.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public getScriptVersion(fileName: string): string {
|
||||
return this.shimHost.getScriptVersion(fileName);
|
||||
}
|
||||
@@ -744,7 +754,7 @@ namespace ts {
|
||||
`getDocumentHighlights('${fileName}', ${position})`,
|
||||
() => {
|
||||
const results = this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));
|
||||
// workaround for VS document higlighting issue - keep only items from the initial file
|
||||
// workaround for VS document highlighting issue - keep only items from the initial file
|
||||
const normalizedName = normalizeSlashes(fileName).toLowerCase();
|
||||
return filter(results, r => normalizeSlashes(r.fileName).toLowerCase() === normalizedName);
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace ts.SignatureHelp {
|
||||
// case TypeScript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
|
||||
// stack++;
|
||||
|
||||
// // Intentaion fall through
|
||||
// // Intentional fall through
|
||||
// case TypeScript.SyntaxKind.GreaterThanToken:
|
||||
// stack++;
|
||||
// break;
|
||||
@@ -76,7 +76,7 @@ namespace ts.SignatureHelp {
|
||||
// break;
|
||||
|
||||
// case TypeScript.SyntaxKind.EqualsGreaterThanToken:
|
||||
// // This can be a function type or a constructor type. In either case, we want to skip the function defintion
|
||||
// // This can be a function type or a constructor type. In either case, we want to skip the function definition
|
||||
// token = previousToken(token, /*includeSkippedTokens*/ true);
|
||||
|
||||
// if (token && token.kind() === TypeScript.SyntaxKind.CloseParenToken) {
|
||||
@@ -99,7 +99,7 @@ namespace ts.SignatureHelp {
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// // This is not a funtion type. exit the main loop
|
||||
// // This is not a function type. exit the main loop
|
||||
// break whileLoop;
|
||||
// }
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace ts {
|
||||
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed
|
||||
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed
|
||||
return false;
|
||||
|
||||
case SyntaxKind.ForStatement:
|
||||
@@ -271,7 +271,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
* and (position < end or (position === end && token is keyword or identifier or numeric\string litera))
|
||||
* and (position < end or (position === end && token is keyword or identifier or numeric/string literal))
|
||||
*/
|
||||
export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node {
|
||||
return getTouchingToken(sourceFile, position, n => isPropertyName(n.kind));
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [VariableDeclaration12_es6.ts]
|
||||
|
||||
let
|
||||
x
|
||||
|
||||
//// [VariableDeclaration12_es6.js]
|
||||
let x;
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts ===
|
||||
|
||||
let
|
||||
x
|
||||
>x : Symbol(x, Decl(VariableDeclaration12_es6.ts, 1, 3))
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts ===
|
||||
|
||||
let
|
||||
x
|
||||
>x : any
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,5): error TS1181: Array element destructuring pattern expected.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,6): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,8): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,10): error TS1134: Variable declaration expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts (4 errors) ====
|
||||
|
||||
// An ExpressionStatement cannot start with the two token sequence `let [` because
|
||||
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
|
||||
var let: any;
|
||||
let[0] = 100;
|
||||
~
|
||||
!!! error TS1181: Array element destructuring pattern expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~~~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [VariableDeclaration13_es6.ts]
|
||||
|
||||
// An ExpressionStatement cannot start with the two token sequence `let [` because
|
||||
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
|
||||
var let: any;
|
||||
let[0] = 100;
|
||||
|
||||
//// [VariableDeclaration13_es6.js]
|
||||
// An ExpressionStatement cannot start with the two token sequence `let [` because
|
||||
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
|
||||
var let;
|
||||
let [] = 0;
|
||||
100;
|
||||
@@ -0,0 +1,56 @@
|
||||
//// [abstractProperty.ts]
|
||||
interface A {
|
||||
prop: string;
|
||||
raw: string;
|
||||
m(): void;
|
||||
}
|
||||
abstract class B implements A {
|
||||
abstract prop: string;
|
||||
abstract raw: string;
|
||||
abstract readonly ro: string;
|
||||
abstract get readonlyProp(): string;
|
||||
abstract set readonlyProp(val: string);
|
||||
abstract m(): void;
|
||||
}
|
||||
class C extends B {
|
||||
get prop() { return "foo"; }
|
||||
set prop(v) { }
|
||||
raw = "edge";
|
||||
readonly ro = "readonly please";
|
||||
readonlyProp: string; // don't have to give a value, in fact
|
||||
m() { }
|
||||
}
|
||||
|
||||
//// [abstractProperty.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 B = (function () {
|
||||
function B() {
|
||||
}
|
||||
Object.defineProperty(B.prototype, "readonlyProp", {
|
||||
get: function () { },
|
||||
set: function (val) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return B;
|
||||
}());
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
this.raw = "edge";
|
||||
this.ro = "readonly please";
|
||||
}
|
||||
Object.defineProperty(C.prototype, "prop", {
|
||||
get: function () { return "foo"; },
|
||||
set: function (v) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
C.prototype.m = function () { };
|
||||
return C;
|
||||
}(B));
|
||||
@@ -0,0 +1,59 @@
|
||||
=== tests/cases/compiler/abstractProperty.ts ===
|
||||
interface A {
|
||||
>A : Symbol(A, Decl(abstractProperty.ts, 0, 0))
|
||||
|
||||
prop: string;
|
||||
>prop : Symbol(prop, Decl(abstractProperty.ts, 0, 13))
|
||||
|
||||
raw: string;
|
||||
>raw : Symbol(raw, Decl(abstractProperty.ts, 1, 17))
|
||||
|
||||
m(): void;
|
||||
>m : Symbol(m, Decl(abstractProperty.ts, 2, 16))
|
||||
}
|
||||
abstract class B implements A {
|
||||
>B : Symbol(B, Decl(abstractProperty.ts, 4, 1))
|
||||
>A : Symbol(A, Decl(abstractProperty.ts, 0, 0))
|
||||
|
||||
abstract prop: string;
|
||||
>prop : Symbol(prop, Decl(abstractProperty.ts, 5, 31))
|
||||
|
||||
abstract raw: string;
|
||||
>raw : Symbol(raw, Decl(abstractProperty.ts, 6, 26))
|
||||
|
||||
abstract readonly ro: string;
|
||||
>ro : Symbol(ro, Decl(abstractProperty.ts, 7, 25))
|
||||
|
||||
abstract get readonlyProp(): string;
|
||||
>readonlyProp : Symbol(readonlyProp, Decl(abstractProperty.ts, 8, 33), Decl(abstractProperty.ts, 9, 40))
|
||||
|
||||
abstract set readonlyProp(val: string);
|
||||
>readonlyProp : Symbol(readonlyProp, Decl(abstractProperty.ts, 8, 33), Decl(abstractProperty.ts, 9, 40))
|
||||
>val : Symbol(val, Decl(abstractProperty.ts, 10, 30))
|
||||
|
||||
abstract m(): void;
|
||||
>m : Symbol(m, Decl(abstractProperty.ts, 10, 43))
|
||||
}
|
||||
class C extends B {
|
||||
>C : Symbol(C, Decl(abstractProperty.ts, 12, 1))
|
||||
>B : Symbol(B, Decl(abstractProperty.ts, 4, 1))
|
||||
|
||||
get prop() { return "foo"; }
|
||||
>prop : Symbol(prop, Decl(abstractProperty.ts, 13, 19), Decl(abstractProperty.ts, 14, 32))
|
||||
|
||||
set prop(v) { }
|
||||
>prop : Symbol(prop, Decl(abstractProperty.ts, 13, 19), Decl(abstractProperty.ts, 14, 32))
|
||||
>v : Symbol(v, Decl(abstractProperty.ts, 15, 13))
|
||||
|
||||
raw = "edge";
|
||||
>raw : Symbol(raw, Decl(abstractProperty.ts, 15, 19))
|
||||
|
||||
readonly ro = "readonly please";
|
||||
>ro : Symbol(ro, Decl(abstractProperty.ts, 16, 17))
|
||||
|
||||
readonlyProp: string; // don't have to give a value, in fact
|
||||
>readonlyProp : Symbol(readonlyProp, Decl(abstractProperty.ts, 17, 36))
|
||||
|
||||
m() { }
|
||||
>m : Symbol(m, Decl(abstractProperty.ts, 18, 25))
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
=== tests/cases/compiler/abstractProperty.ts ===
|
||||
interface A {
|
||||
>A : A
|
||||
|
||||
prop: string;
|
||||
>prop : string
|
||||
|
||||
raw: string;
|
||||
>raw : string
|
||||
|
||||
m(): void;
|
||||
>m : () => void
|
||||
}
|
||||
abstract class B implements A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
abstract prop: string;
|
||||
>prop : string
|
||||
|
||||
abstract raw: string;
|
||||
>raw : string
|
||||
|
||||
abstract readonly ro: string;
|
||||
>ro : string
|
||||
|
||||
abstract get readonlyProp(): string;
|
||||
>readonlyProp : string
|
||||
|
||||
abstract set readonlyProp(val: string);
|
||||
>readonlyProp : string
|
||||
>val : string
|
||||
|
||||
abstract m(): void;
|
||||
>m : () => void
|
||||
}
|
||||
class C extends B {
|
||||
>C : C
|
||||
>B : B
|
||||
|
||||
get prop() { return "foo"; }
|
||||
>prop : string
|
||||
>"foo" : string
|
||||
|
||||
set prop(v) { }
|
||||
>prop : string
|
||||
>v : string
|
||||
|
||||
raw = "edge";
|
||||
>raw : string
|
||||
>"edge" : string
|
||||
|
||||
readonly ro = "readonly please";
|
||||
>ro : string
|
||||
>"readonly please" : string
|
||||
|
||||
readonlyProp: string; // don't have to give a value, in fact
|
||||
>readonlyProp : string
|
||||
|
||||
m() { }
|
||||
>m : () => void
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(10,18): error TS2380: 'get' and 'set' accessor must have the same type.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(11,18): error TS2380: 'get' and 'set' accessor must have the same type.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'm' from class 'B'.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'mismatch' from class 'B'.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'prop' from class 'B'.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'readonlyProp' from class 'B'.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(15,5): error TS1244: Abstract methods can only appear within an abstract class.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(16,37): error TS1005: '{' expected.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(24,7): error TS2415: Class 'WrongTypePropertyImpl' incorrectly extends base class 'WrongTypeProperty'.
|
||||
Types of property 'num' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(30,7): error TS2415: Class 'WrongTypeAccessorImpl' incorrectly extends base class 'WrongTypeAccessor'.
|
||||
Types of property 'num' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(33,7): error TS2415: Class 'WrongTypeAccessorImpl2' incorrectly extends base class 'WrongTypeAccessor'.
|
||||
Types of property 'num' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(38,18): error TS2676: Accessors must both be abstract or non-abstract.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(39,9): error TS2676: Accessors must both be abstract or non-abstract.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(40,9): error TS2676: Accessors must both be abstract or non-abstract.
|
||||
tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors must both be abstract or non-abstract.
|
||||
|
||||
|
||||
==== tests/cases/compiler/abstractPropertyNegative.ts (16 errors) ====
|
||||
interface A {
|
||||
prop: string;
|
||||
m(): string;
|
||||
}
|
||||
abstract class B implements A {
|
||||
abstract prop: string;
|
||||
public abstract readonly ro: string;
|
||||
abstract get readonlyProp(): string;
|
||||
abstract m(): string;
|
||||
abstract get mismatch(): string;
|
||||
~~~~~~~~
|
||||
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
||||
abstract set mismatch(val: number); // error, not same type
|
||||
~~~~~~~~
|
||||
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
||||
}
|
||||
class C extends B {
|
||||
~
|
||||
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'm' from class 'B'.
|
||||
~
|
||||
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'mismatch' from class 'B'.
|
||||
~
|
||||
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'prop' from class 'B'.
|
||||
~
|
||||
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'readonlyProp' from class 'B'.
|
||||
readonly ro = "readonly please";
|
||||
abstract notAllowed: string;
|
||||
~~~~~~~~
|
||||
!!! error TS1244: Abstract methods can only appear within an abstract class.
|
||||
get concreteWithNoBody(): string;
|
||||
~
|
||||
!!! error TS1005: '{' expected.
|
||||
}
|
||||
let c = new C();
|
||||
c.ro = "error: lhs of assignment can't be readonly";
|
||||
~~~~
|
||||
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
|
||||
|
||||
abstract class WrongTypeProperty {
|
||||
abstract num: number;
|
||||
}
|
||||
class WrongTypePropertyImpl extends WrongTypeProperty {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2415: Class 'WrongTypePropertyImpl' incorrectly extends base class 'WrongTypeProperty'.
|
||||
!!! error TS2415: Types of property 'num' are incompatible.
|
||||
!!! error TS2415: Type 'string' is not assignable to type 'number'.
|
||||
num = "nope, wrong";
|
||||
}
|
||||
abstract class WrongTypeAccessor {
|
||||
abstract get num(): number;
|
||||
}
|
||||
class WrongTypeAccessorImpl extends WrongTypeAccessor {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2415: Class 'WrongTypeAccessorImpl' incorrectly extends base class 'WrongTypeAccessor'.
|
||||
!!! error TS2415: Types of property 'num' are incompatible.
|
||||
!!! error TS2415: Type 'string' is not assignable to type 'number'.
|
||||
get num() { return "nope, wrong"; }
|
||||
}
|
||||
class WrongTypeAccessorImpl2 extends WrongTypeAccessor {
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2415: Class 'WrongTypeAccessorImpl2' incorrectly extends base class 'WrongTypeAccessor'.
|
||||
!!! error TS2415: Types of property 'num' are incompatible.
|
||||
!!! error TS2415: Type 'string' is not assignable to type 'number'.
|
||||
num = "nope, wrong";
|
||||
}
|
||||
|
||||
abstract class AbstractAccessorMismatch {
|
||||
abstract get p1(): string;
|
||||
~~
|
||||
!!! error TS2676: Accessors must both be abstract or non-abstract.
|
||||
set p1(val: string) { };
|
||||
~~
|
||||
!!! error TS2676: Accessors must both be abstract or non-abstract.
|
||||
get p2(): string { return "should work"; }
|
||||
~~
|
||||
!!! error TS2676: Accessors must both be abstract or non-abstract.
|
||||
abstract set p2(val: string);
|
||||
~~
|
||||
!!! error TS2676: Accessors must both be abstract or non-abstract.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
//// [abstractPropertyNegative.ts]
|
||||
interface A {
|
||||
prop: string;
|
||||
m(): string;
|
||||
}
|
||||
abstract class B implements A {
|
||||
abstract prop: string;
|
||||
public abstract readonly ro: string;
|
||||
abstract get readonlyProp(): string;
|
||||
abstract m(): string;
|
||||
abstract get mismatch(): string;
|
||||
abstract set mismatch(val: number); // error, not same type
|
||||
}
|
||||
class C extends B {
|
||||
readonly ro = "readonly please";
|
||||
abstract notAllowed: string;
|
||||
get concreteWithNoBody(): string;
|
||||
}
|
||||
let c = new C();
|
||||
c.ro = "error: lhs of assignment can't be readonly";
|
||||
|
||||
abstract class WrongTypeProperty {
|
||||
abstract num: number;
|
||||
}
|
||||
class WrongTypePropertyImpl extends WrongTypeProperty {
|
||||
num = "nope, wrong";
|
||||
}
|
||||
abstract class WrongTypeAccessor {
|
||||
abstract get num(): number;
|
||||
}
|
||||
class WrongTypeAccessorImpl extends WrongTypeAccessor {
|
||||
get num() { return "nope, wrong"; }
|
||||
}
|
||||
class WrongTypeAccessorImpl2 extends WrongTypeAccessor {
|
||||
num = "nope, wrong";
|
||||
}
|
||||
|
||||
abstract class AbstractAccessorMismatch {
|
||||
abstract get p1(): string;
|
||||
set p1(val: string) { };
|
||||
get p2(): string { return "should work"; }
|
||||
abstract set p2(val: string);
|
||||
}
|
||||
|
||||
|
||||
//// [abstractPropertyNegative.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 B = (function () {
|
||||
function B() {
|
||||
}
|
||||
Object.defineProperty(B.prototype, "readonlyProp", {
|
||||
get: function () { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(B.prototype, "mismatch", {
|
||||
get: function () { },
|
||||
set: function (val) { } // error, not same type
|
||||
,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return B;
|
||||
}());
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
this.ro = "readonly please";
|
||||
}
|
||||
Object.defineProperty(C.prototype, "concreteWithNoBody", {
|
||||
get: function () { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
}(B));
|
||||
var c = new C();
|
||||
c.ro = "error: lhs of assignment can't be readonly";
|
||||
var WrongTypeProperty = (function () {
|
||||
function WrongTypeProperty() {
|
||||
}
|
||||
return WrongTypeProperty;
|
||||
}());
|
||||
var WrongTypePropertyImpl = (function (_super) {
|
||||
__extends(WrongTypePropertyImpl, _super);
|
||||
function WrongTypePropertyImpl() {
|
||||
_super.apply(this, arguments);
|
||||
this.num = "nope, wrong";
|
||||
}
|
||||
return WrongTypePropertyImpl;
|
||||
}(WrongTypeProperty));
|
||||
var WrongTypeAccessor = (function () {
|
||||
function WrongTypeAccessor() {
|
||||
}
|
||||
Object.defineProperty(WrongTypeAccessor.prototype, "num", {
|
||||
get: function () { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return WrongTypeAccessor;
|
||||
}());
|
||||
var WrongTypeAccessorImpl = (function (_super) {
|
||||
__extends(WrongTypeAccessorImpl, _super);
|
||||
function WrongTypeAccessorImpl() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(WrongTypeAccessorImpl.prototype, "num", {
|
||||
get: function () { return "nope, wrong"; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return WrongTypeAccessorImpl;
|
||||
}(WrongTypeAccessor));
|
||||
var WrongTypeAccessorImpl2 = (function (_super) {
|
||||
__extends(WrongTypeAccessorImpl2, _super);
|
||||
function WrongTypeAccessorImpl2() {
|
||||
_super.apply(this, arguments);
|
||||
this.num = "nope, wrong";
|
||||
}
|
||||
return WrongTypeAccessorImpl2;
|
||||
}(WrongTypeAccessor));
|
||||
var AbstractAccessorMismatch = (function () {
|
||||
function AbstractAccessorMismatch() {
|
||||
}
|
||||
Object.defineProperty(AbstractAccessorMismatch.prototype, "p1", {
|
||||
get: function () { },
|
||||
set: function (val) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
;
|
||||
Object.defineProperty(AbstractAccessorMismatch.prototype, "p2", {
|
||||
get: function () { return "should work"; },
|
||||
set: function (val) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return AbstractAccessorMismatch;
|
||||
}());
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts (1 errors) ====
|
||||
abstract class A {
|
||||
abstract constructor() {}
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,28): error TS1183: An implementation cannot be declared in ambient contexts.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(11,15): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'AA'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(13,15): error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'foo' from class 'BB'.
|
||||
@@ -9,7 +9,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
declare abstract class A {
|
||||
abstract constructor() {}
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration.
|
||||
~
|
||||
!!! error TS1183: An implementation cannot be declared in ambient contexts.
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(21,1): error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(50,5): error TS1244: Abstract methods can only appear within an abstract class.
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
~~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
!!! error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
}
|
||||
|
||||
class H { // error -- not declared abstract
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(7,5): error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(10,14): error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(12,14): error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(7,5): error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(10,14): error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(12,14): error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(15,5): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(20,14): error TS2516: All declarations of an abstract method must be consecutive.
|
||||
|
||||
@@ -14,16 +14,16 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
abstract bar();
|
||||
bar();
|
||||
~~~
|
||||
!!! error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
!!! error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
abstract bar();
|
||||
|
||||
abstract baz();
|
||||
~~~
|
||||
!!! error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
!!! error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
baz();
|
||||
abstract baz();
|
||||
~~~
|
||||
!!! error TS2512: Overload signatures must all be abstract or not abstract.
|
||||
!!! error TS2512: Overload signatures must all be abstract or non-abstract.
|
||||
baz() {}
|
||||
|
||||
qux();
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(3,12): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(4,15): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(5,13): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(7,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(5,13): error TS1243: 'private' modifier cannot be used with 'abstract' modifier.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(12,13): error TS1243: 'private' modifier cannot be used with 'abstract' modifier.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts (6 errors) ====
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts (2 errors) ====
|
||||
abstract class A {
|
||||
abstract x : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
public abstract y : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
protected abstract z : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
private abstract w : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
!!! error TS1243: 'private' modifier cannot be used with 'abstract' modifier.
|
||||
|
||||
abstract m: () => void;
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
|
||||
abstract foo_x() : number;
|
||||
public abstract foo_y() : number;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts(1,1): error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts(1,1): error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts (1 errors) ====
|
||||
abstract interface I {}
|
||||
~~~~~~~~
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration.
|
||||
!!! error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of 'I' must have identical type parameters.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts (1 errors) ====
|
||||
@@ -35,7 +35,7 @@ tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSig
|
||||
|
||||
interface I<T> {
|
||||
~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I' must have identical type parameters.
|
||||
new (x: T, y?: number): C2<T>;
|
||||
new (x: T, y: number): C2<T>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes01.ts(14,5): error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'.
|
||||
Types of property 'fooProp' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorMessagesIntersectionTypes01.ts (1 errors) ====
|
||||
interface Foo {
|
||||
fooProp: boolean;
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
barProp: string;
|
||||
}
|
||||
|
||||
interface FooBar extends Foo, Bar {
|
||||
}
|
||||
|
||||
declare function mixBar<T>(obj: T): T & Bar;
|
||||
|
||||
let fooBar: FooBar = mixBar({
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'.
|
||||
!!! error TS2322: Types of property 'fooProp' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
fooProp: "frizzlebizzle"
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [errorMessagesIntersectionTypes01.ts]
|
||||
interface Foo {
|
||||
fooProp: boolean;
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
barProp: string;
|
||||
}
|
||||
|
||||
interface FooBar extends Foo, Bar {
|
||||
}
|
||||
|
||||
declare function mixBar<T>(obj: T): T & Bar;
|
||||
|
||||
let fooBar: FooBar = mixBar({
|
||||
fooProp: "frizzlebizzle"
|
||||
});
|
||||
|
||||
//// [errorMessagesIntersectionTypes01.js]
|
||||
var fooBar = mixBar({
|
||||
fooProp: "frizzlebizzle"
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes02.ts(14,5): error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'.
|
||||
Types of property 'fooProp' are incompatible.
|
||||
Type 'string' is not assignable to type '"hello" | "world"'.
|
||||
Type 'string' is not assignable to type '"world"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorMessagesIntersectionTypes02.ts (1 errors) ====
|
||||
interface Foo {
|
||||
fooProp: "hello" | "world";
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
barProp: string;
|
||||
}
|
||||
|
||||
interface FooBar extends Foo, Bar {
|
||||
}
|
||||
|
||||
declare function mixBar<T>(obj: T): T & Bar;
|
||||
|
||||
let fooBar: FooBar = mixBar({
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'.
|
||||
!!! error TS2322: Types of property 'fooProp' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"hello" | "world"'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"world"'.
|
||||
fooProp: "frizzlebizzle"
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [errorMessagesIntersectionTypes02.ts]
|
||||
interface Foo {
|
||||
fooProp: "hello" | "world";
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
barProp: string;
|
||||
}
|
||||
|
||||
interface FooBar extends Foo, Bar {
|
||||
}
|
||||
|
||||
declare function mixBar<T>(obj: T): T & Bar;
|
||||
|
||||
let fooBar: FooBar = mixBar({
|
||||
fooProp: "frizzlebizzle"
|
||||
});
|
||||
|
||||
//// [errorMessagesIntersectionTypes02.js]
|
||||
var fooBar = mixBar({
|
||||
fooProp: "frizzlebizzle"
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'T'.
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'U'.
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'V'.
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(22,5): error TS2322: Type 'T & B' is not assignable to type 'U'.
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(23,5): error TS2322: Type 'T & B' is not assignable to type 'V'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorMessagesIntersectionTypes03.ts (5 errors) ====
|
||||
interface A {
|
||||
a;
|
||||
}
|
||||
|
||||
interface B {
|
||||
b;
|
||||
}
|
||||
|
||||
function f<T, U extends A, V extends U>(): void {
|
||||
let t: T;
|
||||
let u: U;
|
||||
let v: V;
|
||||
|
||||
let a_and_b: A & B;
|
||||
let t_and_b: T & B;
|
||||
|
||||
t = a_and_b;
|
||||
~
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'T'.
|
||||
u = a_and_b;
|
||||
~
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'U'.
|
||||
v = a_and_b;
|
||||
~
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'V'.
|
||||
|
||||
t = t_and_b;
|
||||
u = t_and_b;
|
||||
~
|
||||
!!! error TS2322: Type 'T & B' is not assignable to type 'U'.
|
||||
v = t_and_b;
|
||||
~
|
||||
!!! error TS2322: Type 'T & B' is not assignable to type 'V'.
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//// [errorMessagesIntersectionTypes03.ts]
|
||||
interface A {
|
||||
a;
|
||||
}
|
||||
|
||||
interface B {
|
||||
b;
|
||||
}
|
||||
|
||||
function f<T, U extends A, V extends U>(): void {
|
||||
let t: T;
|
||||
let u: U;
|
||||
let v: V;
|
||||
|
||||
let a_and_b: A & B;
|
||||
let t_and_b: T & B;
|
||||
|
||||
t = a_and_b;
|
||||
u = a_and_b;
|
||||
v = a_and_b;
|
||||
|
||||
t = t_and_b;
|
||||
u = t_and_b;
|
||||
v = t_and_b;
|
||||
}
|
||||
|
||||
//// [errorMessagesIntersectionTypes03.js]
|
||||
function f() {
|
||||
var t;
|
||||
var u;
|
||||
var v;
|
||||
var a_and_b;
|
||||
var t_and_b;
|
||||
t = a_and_b;
|
||||
u = a_and_b;
|
||||
v = a_and_b;
|
||||
t = t_and_b;
|
||||
u = t_and_b;
|
||||
v = t_and_b;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'number'.
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'boolean'.
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'string'.
|
||||
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(21,5): error TS2322: Type 'number & boolean' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorMessagesIntersectionTypes04.ts (4 errors) ====
|
||||
interface A {
|
||||
a;
|
||||
}
|
||||
|
||||
interface B {
|
||||
b;
|
||||
}
|
||||
|
||||
function f<T, U extends A, V extends U>(): void {
|
||||
let num: number;
|
||||
let bool: boolean;
|
||||
let str: string;
|
||||
|
||||
let a_and_b: A & B;
|
||||
let num_and_bool: number & boolean;
|
||||
|
||||
num = a_and_b;
|
||||
~~~
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'number'.
|
||||
bool = a_and_b;
|
||||
~~~~
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'boolean'.
|
||||
str = a_and_b;
|
||||
~~~
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'string'.
|
||||
|
||||
str = num_and_bool;
|
||||
~~~
|
||||
!!! error TS2322: Type 'number & boolean' is not assignable to type 'string'.
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//// [errorMessagesIntersectionTypes04.ts]
|
||||
interface A {
|
||||
a;
|
||||
}
|
||||
|
||||
interface B {
|
||||
b;
|
||||
}
|
||||
|
||||
function f<T, U extends A, V extends U>(): void {
|
||||
let num: number;
|
||||
let bool: boolean;
|
||||
let str: string;
|
||||
|
||||
let a_and_b: A & B;
|
||||
let num_and_bool: number & boolean;
|
||||
|
||||
num = a_and_b;
|
||||
bool = a_and_b;
|
||||
str = a_and_b;
|
||||
|
||||
str = num_and_bool;
|
||||
}
|
||||
|
||||
//// [errorMessagesIntersectionTypes04.js]
|
||||
function f() {
|
||||
var num;
|
||||
var bool;
|
||||
var str;
|
||||
var a_and_b;
|
||||
var num_and_bool;
|
||||
num = a_and_b;
|
||||
bool = a_and_b;
|
||||
str = a_and_b;
|
||||
str = num_and_bool;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [exportEqualsAmd.ts]
|
||||
export = { ["hi"]: "there" };
|
||||
|
||||
//// [exportEqualsAmd.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
return (_a = {}, _a["hi"] = "there", _a);
|
||||
var _a;
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
=== tests/cases/compiler/exportEqualsAmd.ts ===
|
||||
export = { ["hi"]: "there" };
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/exportEqualsAmd.ts ===
|
||||
export = { ["hi"]: "there" };
|
||||
>{ ["hi"]: "there" } : { ["hi"]: string; }
|
||||
>"hi" : string
|
||||
>"there" : string
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [exportEqualsCommonJs.ts]
|
||||
export = { ["hi"]: "there" };
|
||||
|
||||
//// [exportEqualsCommonJs.js]
|
||||
"use strict";
|
||||
module.exports = (_a = {}, _a["hi"] = "there", _a);
|
||||
var _a;
|
||||
@@ -0,0 +1,3 @@
|
||||
=== tests/cases/compiler/exportEqualsCommonJs.ts ===
|
||||
export = { ["hi"]: "there" };
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/exportEqualsCommonJs.ts ===
|
||||
export = { ["hi"]: "there" };
|
||||
>{ ["hi"]: "there" } : { ["hi"]: string; }
|
||||
>"hi" : string
|
||||
>"there" : string
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [exportEqualsUmd.ts]
|
||||
export = { ["hi"]: "there" };
|
||||
|
||||
//// [exportEqualsUmd.js]
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
return (_a = {}, _a["hi"] = "there", _a);
|
||||
var _a;
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
=== tests/cases/compiler/exportEqualsUmd.ts ===
|
||||
export = { ["hi"]: "there" };
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/exportEqualsUmd.ts ===
|
||||
export = { ["hi"]: "there" };
|
||||
>{ ["hi"]: "there" } : { ["hi"]: string; }
|
||||
>"hi" : string
|
||||
>"there" : string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(1,42): error TS2300: Duplicate identifier 'A'.
|
||||
tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters.
|
||||
tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): error TS2300: Duplicate identifier 'C'.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): err
|
||||
|
||||
interface InterfaceWithSomeTypars<C, C> { // should error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters.
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'C'.
|
||||
bar2(): void;
|
||||
|
||||
@@ -4,8 +4,8 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(50,25): error TS2304
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(51,32): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(65,13): error TS2385: Overload signatures must all be public, private or protected.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(68,13): error TS2385: Overload signatures must all be public, private or protected.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383: Overload signatures must all be exported or not exported.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or not exported.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383: Overload signatures must all be exported or non-exported.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or non-exported.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(85,18): error TS2384: Overload signatures must all be ambient or non-ambient.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(90,18): error TS2384: Overload signatures must all be ambient or non-ambient.
|
||||
tests/cases/conformance/functions/functionOverloadErrors.ts(94,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
@@ -103,13 +103,13 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS237
|
||||
module M {
|
||||
export function fn1();
|
||||
~~~
|
||||
!!! error TS2383: Overload signatures must all be exported or not exported.
|
||||
!!! error TS2383: Overload signatures must all be exported or non-exported.
|
||||
function fn1(n: string);
|
||||
function fn1() { }
|
||||
|
||||
function fn2(n: string);
|
||||
~~~
|
||||
!!! error TS2383: Overload signatures must all be exported or not exported.
|
||||
!!! error TS2383: Overload signatures must all be exported or non-exported.
|
||||
export function fn2();
|
||||
export function fn2() { }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of 'A' must have identical type parameters.
|
||||
tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of 'A' must have identical type parameters.
|
||||
tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of 'A' must have identical type parameters.
|
||||
|
||||
|
||||
==== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts (3 errors) ====
|
||||
@@ -12,7 +12,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf
|
||||
|
||||
interface A<T> { // error
|
||||
~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'A' must have identical type parameters.
|
||||
bar: T;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf
|
||||
|
||||
interface A { // error
|
||||
~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'A' must have identical type parameters.
|
||||
foo: string;
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf
|
||||
module M3 {
|
||||
export interface A<T> { // error
|
||||
~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'A' must have identical type parameters.
|
||||
bar: T;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of 'I3' must have identical type parameters.
|
||||
|
||||
|
||||
==== tests/cases/compiler/interfaceWithMultipleDeclarations.ts (11 errors) ====
|
||||
@@ -16,53 +16,53 @@ tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428:
|
||||
}
|
||||
interface I1<S> { // Name mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
}
|
||||
interface I1<T, U extends T> { // Length mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
}
|
||||
interface I1<V extends string> { // constraint present
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
}
|
||||
interface I1<V, X extends V> { // Length mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
}
|
||||
interface I1 { // Length mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I1' must have identical type parameters.
|
||||
}
|
||||
|
||||
interface I2<T extends string> {
|
||||
}
|
||||
interface I2<T extends () => string> { // constraint mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
}
|
||||
interface I2<T> { // constraint absent
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
}
|
||||
interface I2<U> { // name mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
}
|
||||
interface I2<X, Y> { // length mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
}
|
||||
interface I2 { // length mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I2' must have identical type parameters.
|
||||
}
|
||||
|
||||
interface I3 {
|
||||
}
|
||||
interface I3<T> { // length mismatch
|
||||
~~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I3' must have identical type parameters.
|
||||
}
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
@@ -17,27 +17,22 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(25,1): e
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(26,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'.
|
||||
Type 'C & D' is not assignable to type 'A & B'.
|
||||
Type 'C & D' is not assignable to type 'A'.
|
||||
Type 'D' is not assignable to type 'A'.
|
||||
Property 'a' is missing in type 'D'.
|
||||
Property 'a' is missing in type 'C & D'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(27,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'.
|
||||
Type 'C & D' is not assignable to type 'A | B'.
|
||||
Type 'C & D' is not assignable to type 'B'.
|
||||
Type 'D' is not assignable to type 'B'.
|
||||
Property 'b' is missing in type 'D'.
|
||||
Property 'b' is missing in type 'C & D'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(28,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'.
|
||||
Type 'A & B' is not assignable to type 'C & D'.
|
||||
Type 'A & B' is not assignable to type 'C'.
|
||||
Type 'B' is not assignable to type 'C'.
|
||||
Property 'c' is missing in type 'B'.
|
||||
Property 'c' is missing in type 'A & B'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(29,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'.
|
||||
Type 'A & B' is not assignable to type 'C | D'.
|
||||
Type 'A & B' is not assignable to type 'D'.
|
||||
Type 'B' is not assignable to type 'D'.
|
||||
Property 'd' is missing in type 'B'.
|
||||
Property 'd' is missing in type 'A & B'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(31,1): error TS2322: Type 'A & B' is not assignable to type '(A | B) & (C | D)'.
|
||||
Type 'A & B' is not assignable to type 'C | D'.
|
||||
Type 'A & B' is not assignable to type 'D'.
|
||||
Type 'B' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(32,1): error TS2322: Type 'A | B' is not assignable to type '(A | B) & (C | D)'.
|
||||
Type 'A' is not assignable to type '(A | B) & (C | D)'.
|
||||
Type 'A' is not assignable to type 'C | D'.
|
||||
@@ -46,7 +41,6 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(32,1): e
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(33,1): error TS2322: Type 'C & D' is not assignable to type '(A | B) & (C | D)'.
|
||||
Type 'C & D' is not assignable to type 'A | B'.
|
||||
Type 'C & D' is not assignable to type 'B'.
|
||||
Type 'D' is not assignable to type 'B'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(34,1): error TS2322: Type 'C | D' is not assignable to type '(A | B) & (C | D)'.
|
||||
Type 'C' is not assignable to type '(A | B) & (C | D)'.
|
||||
Type 'C' is not assignable to type 'A | B'.
|
||||
@@ -54,14 +48,10 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(34,1): e
|
||||
Property 'b' is missing in type 'C'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(35,1): error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A & B'.
|
||||
Type '(A | B) & (C | D)' is not assignable to type 'A'.
|
||||
Type 'C | D' is not assignable to type 'A'.
|
||||
Type 'C' is not assignable to type 'A'.
|
||||
Property 'a' is missing in type 'C'.
|
||||
Property 'a' is missing in type '(A | B) & (C | D)'.
|
||||
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C & D'.
|
||||
Type '(A | B) & (C | D)' is not assignable to type 'C'.
|
||||
Type 'C | D' is not assignable to type 'C'.
|
||||
Type 'D' is not assignable to type 'C'.
|
||||
Property 'c' is missing in type 'D'.
|
||||
Property 'c' is missing in type '(A | B) & (C | D)'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts (14 errors) ====
|
||||
@@ -115,36 +105,31 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e
|
||||
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'.
|
||||
!!! error TS2322: Type 'C & D' is not assignable to type 'A & B'.
|
||||
!!! error TS2322: Type 'C & D' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'D' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'a' is missing in type 'D'.
|
||||
!!! error TS2322: Property 'a' is missing in type 'C & D'.
|
||||
aob = x;
|
||||
~~~
|
||||
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'.
|
||||
!!! error TS2322: Type 'C & D' is not assignable to type 'A | B'.
|
||||
!!! error TS2322: Type 'C & D' is not assignable to type 'B'.
|
||||
!!! error TS2322: Type 'D' is not assignable to type 'B'.
|
||||
!!! error TS2322: Property 'b' is missing in type 'D'.
|
||||
!!! error TS2322: Property 'b' is missing in type 'C & D'.
|
||||
cnd = x;
|
||||
~~~
|
||||
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'.
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'C & D'.
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'C'.
|
||||
!!! error TS2322: Type 'B' is not assignable to type 'C'.
|
||||
!!! error TS2322: Property 'c' is missing in type 'B'.
|
||||
!!! error TS2322: Property 'c' is missing in type 'A & B'.
|
||||
cod = x;
|
||||
~~~
|
||||
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'.
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'C | D'.
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'D'.
|
||||
!!! error TS2322: Type 'B' is not assignable to type 'D'.
|
||||
!!! error TS2322: Property 'd' is missing in type 'B'.
|
||||
!!! error TS2322: Property 'd' is missing in type 'A & B'.
|
||||
|
||||
y = anb;
|
||||
~
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type '(A | B) & (C | D)'.
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'C | D'.
|
||||
!!! error TS2322: Type 'A & B' is not assignable to type 'D'.
|
||||
!!! error TS2322: Type 'B' is not assignable to type 'D'.
|
||||
y = aob;
|
||||
~
|
||||
!!! error TS2322: Type 'A | B' is not assignable to type '(A | B) & (C | D)'.
|
||||
@@ -157,7 +142,6 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e
|
||||
!!! error TS2322: Type 'C & D' is not assignable to type '(A | B) & (C | D)'.
|
||||
!!! error TS2322: Type 'C & D' is not assignable to type 'A | B'.
|
||||
!!! error TS2322: Type 'C & D' is not assignable to type 'B'.
|
||||
!!! error TS2322: Type 'D' is not assignable to type 'B'.
|
||||
y = cod;
|
||||
~
|
||||
!!! error TS2322: Type 'C | D' is not assignable to type '(A | B) & (C | D)'.
|
||||
@@ -169,16 +153,12 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e
|
||||
~~~
|
||||
!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A & B'.
|
||||
!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'C | D' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'a' is missing in type 'C'.
|
||||
!!! error TS2322: Property 'a' is missing in type '(A | B) & (C | D)'.
|
||||
aob = y; // Ok
|
||||
cnd = y;
|
||||
~~~
|
||||
!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C & D'.
|
||||
!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C'.
|
||||
!!! error TS2322: Type 'C | D' is not assignable to type 'C'.
|
||||
!!! error TS2322: Type 'D' is not assignable to type 'C'.
|
||||
!!! error TS2322: Property 'c' is missing in type 'D'.
|
||||
!!! error TS2322: Property 'c' is missing in type '(A | B) & (C | D)'.
|
||||
cod = y; // Ok
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [invalidThisEmitInContextualObjectLiteral.ts]
|
||||
interface IDef {
|
||||
p1: (e:string) => void;
|
||||
p2: () => (n: number) => any;
|
||||
}
|
||||
|
||||
class TestController {
|
||||
public m(def: IDef) { }
|
||||
public p = this.m({
|
||||
p1: e => { },
|
||||
p2: () => { return vvvvvvvvv => this; },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//// [invalidThisEmitInContextualObjectLiteral.js]
|
||||
var TestController = (function () {
|
||||
function TestController() {
|
||||
var _this = this;
|
||||
this.p = this.m({
|
||||
p1: function (e) { },
|
||||
p2: function () { return function (vvvvvvvvv) { return _this; }; }
|
||||
});
|
||||
}
|
||||
TestController.prototype.m = function (def) { };
|
||||
return TestController;
|
||||
}());
|
||||
@@ -0,0 +1,39 @@
|
||||
=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts ===
|
||||
interface IDef {
|
||||
>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0))
|
||||
|
||||
p1: (e:string) => void;
|
||||
>p1 : Symbol(p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 16))
|
||||
>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 6))
|
||||
|
||||
p2: () => (n: number) => any;
|
||||
>p2 : Symbol(p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 24))
|
||||
>n : Symbol(n, Decl(invalidThisEmitInContextualObjectLiteral.ts, 2, 12))
|
||||
}
|
||||
|
||||
class TestController {
|
||||
>TestController : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))
|
||||
|
||||
public m(def: IDef) { }
|
||||
>m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
|
||||
>def : Symbol(def, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 10))
|
||||
>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0))
|
||||
|
||||
public p = this.m({
|
||||
>p : Symbol(p, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 24))
|
||||
>this.m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
|
||||
>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))
|
||||
>m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
|
||||
|
||||
p1: e => { },
|
||||
>p1 : Symbol(p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 7, 20))
|
||||
>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 5))
|
||||
|
||||
p2: () => { return vvvvvvvvv => this; },
|
||||
>p2 : Symbol(p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 15))
|
||||
>vvvvvvvvv : Symbol(vvvvvvvvv, Decl(invalidThisEmitInContextualObjectLiteral.ts, 9, 20))
|
||||
>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts ===
|
||||
interface IDef {
|
||||
>IDef : IDef
|
||||
|
||||
p1: (e:string) => void;
|
||||
>p1 : (e: string) => void
|
||||
>e : string
|
||||
|
||||
p2: () => (n: number) => any;
|
||||
>p2 : () => (n: number) => any
|
||||
>n : number
|
||||
}
|
||||
|
||||
class TestController {
|
||||
>TestController : TestController
|
||||
|
||||
public m(def: IDef) { }
|
||||
>m : (def: IDef) => void
|
||||
>def : IDef
|
||||
>IDef : IDef
|
||||
|
||||
public p = this.m({
|
||||
>p : void
|
||||
>this.m({ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, }) : void
|
||||
>this.m : (def: IDef) => void
|
||||
>this : this
|
||||
>m : (def: IDef) => void
|
||||
>{ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, } : { p1: (e: string) => void; p2: () => {}; }
|
||||
|
||||
p1: e => { },
|
||||
>p1 : (e: string) => void
|
||||
>e => { } : (e: string) => void
|
||||
>e : string
|
||||
|
||||
p2: () => { return vvvvvvvvv => this; },
|
||||
>p2 : () => {}
|
||||
>() => { return vvvvvvvvv => this; } : () => {}
|
||||
>vvvvvvvvv => this : (vvvvvvvvv: number) => this
|
||||
>vvvvvvvvv : number
|
||||
>this : this
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [letIdentifierInElementAccess01.ts]
|
||||
var let: any = {};
|
||||
(let[0] = 100);
|
||||
|
||||
//// [letIdentifierInElementAccess01.js]
|
||||
var let = {};
|
||||
(let[0] = 100);
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts ===
|
||||
var let: any = {};
|
||||
>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3))
|
||||
|
||||
(let[0] = 100);
|
||||
>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts ===
|
||||
var let: any = {};
|
||||
>let : any
|
||||
>{} : {}
|
||||
|
||||
(let[0] = 100);
|
||||
>(let[0] = 100) : number
|
||||
>let[0] = 100 : number
|
||||
>let[0] : any
|
||||
>let : any
|
||||
>0 : number
|
||||
>100 : number
|
||||
|
||||
@@ -3,7 +3,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(15,5): error TS2375: Duplicate number index signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(20,5): error TS2375: Duplicate number index signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(25,5): error TS2375: Duplicate number index signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations of an interface must have identical type parameters.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations of 'I' must have identical type parameters.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(29,5): error TS2375: Duplicate number index signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(30,5): error TS2375: Duplicate number index signature.
|
||||
|
||||
@@ -48,7 +48,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI
|
||||
|
||||
interface I<T> {
|
||||
~
|
||||
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
||||
!!! error TS2428: All declarations of 'I' must have identical type parameters.
|
||||
[x: number]: string;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2375: Duplicate number index signature.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [noImplicitReturnsWithProtectedBlocks1.ts]
|
||||
declare function log(s: string): void;
|
||||
declare function get(): number;
|
||||
|
||||
function main1() : number {
|
||||
try {
|
||||
return get();
|
||||
}
|
||||
finally {
|
||||
log("in finally");
|
||||
}
|
||||
}
|
||||
|
||||
//// [noImplicitReturnsWithProtectedBlocks1.js]
|
||||
function main1() {
|
||||
try {
|
||||
return get();
|
||||
}
|
||||
finally {
|
||||
log("in finally");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/noImplicitReturnsWithProtectedBlocks1.ts ===
|
||||
declare function log(s: string): void;
|
||||
>log : Symbol(log, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 0))
|
||||
>s : Symbol(s, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 21))
|
||||
|
||||
declare function get(): number;
|
||||
>get : Symbol(get, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 38))
|
||||
|
||||
function main1() : number {
|
||||
>main1 : Symbol(main1, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 1, 31))
|
||||
|
||||
try {
|
||||
return get();
|
||||
>get : Symbol(get, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 38))
|
||||
}
|
||||
finally {
|
||||
log("in finally");
|
||||
>log : Symbol(log, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/noImplicitReturnsWithProtectedBlocks1.ts ===
|
||||
declare function log(s: string): void;
|
||||
>log : (s: string) => void
|
||||
>s : string
|
||||
|
||||
declare function get(): number;
|
||||
>get : () => number
|
||||
|
||||
function main1() : number {
|
||||
>main1 : () => number
|
||||
|
||||
try {
|
||||
return get();
|
||||
>get() : number
|
||||
>get : () => number
|
||||
}
|
||||
finally {
|
||||
log("in finally");
|
||||
>log("in finally") : void
|
||||
>log : (s: string) => void
|
||||
>"in finally" : string
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/compiler/noImplicitReturnsWithProtectedBlocks2.ts(4,20): error TS7030: Not all code paths return a value.
|
||||
|
||||
|
||||
==== tests/cases/compiler/noImplicitReturnsWithProtectedBlocks2.ts (1 errors) ====
|
||||
declare function log(s: string): void;
|
||||
declare function get(): number;
|
||||
|
||||
function main1() : number {
|
||||
~~~~~~
|
||||
!!! error TS7030: Not all code paths return a value.
|
||||
try {
|
||||
return get();
|
||||
}
|
||||
catch(e) {
|
||||
log("in catch");
|
||||
}
|
||||
finally {
|
||||
log("in finally");
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user