Update LKG

This commit is contained in:
Mohamed Hegazy 2017-01-05 11:01:12 -08:00
parent 58ad85a274
commit 4086bd13c7
13 changed files with 19912 additions and 14659 deletions

3
lib/lib.d.ts vendored
View File

@ -1191,8 +1191,9 @@ interface Array<T> {
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
*/
splice(start: number): T[];
splice(start: number, deleteCount?: number): T[];
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.

3
lib/lib.es5.d.ts vendored
View File

@ -1191,8 +1191,9 @@ interface Array<T> {
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
*/
splice(start: number): T[];
splice(start: number, deleteCount?: number): T[];
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.

3
lib/lib.es6.d.ts vendored
View File

@ -1191,8 +1191,9 @@ interface Array<T> {
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
*/
splice(start: number): T[];
splice(start: number, deleteCount?: number): T[];
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.

2
lib/protocol.d.ts vendored
View File

@ -1722,12 +1722,14 @@ declare namespace ts.server.protocol {
insertSpaceAfterCommaDelimiter?: boolean;
insertSpaceAfterSemicolonInForStatements?: boolean;
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
insertSpaceAfterConstructor?: boolean;
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
insertSpaceBeforeFunctionParenthesis?: boolean;
placeOpenBraceOnNewLineForFunctions?: boolean;
placeOpenBraceOnNewLineForControlBlocks?: boolean;
}

4848
lib/tsc.js

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

255
lib/typescript.d.ts vendored
View File

@ -239,102 +239,102 @@ declare namespace ts {
ExpressionWithTypeArguments = 199,
AsExpression = 200,
NonNullExpression = 201,
TemplateSpan = 202,
SemicolonClassElement = 203,
Block = 204,
VariableStatement = 205,
EmptyStatement = 206,
ExpressionStatement = 207,
IfStatement = 208,
DoStatement = 209,
WhileStatement = 210,
ForStatement = 211,
ForInStatement = 212,
ForOfStatement = 213,
ContinueStatement = 214,
BreakStatement = 215,
ReturnStatement = 216,
WithStatement = 217,
SwitchStatement = 218,
LabeledStatement = 219,
ThrowStatement = 220,
TryStatement = 221,
DebuggerStatement = 222,
VariableDeclaration = 223,
VariableDeclarationList = 224,
FunctionDeclaration = 225,
ClassDeclaration = 226,
InterfaceDeclaration = 227,
TypeAliasDeclaration = 228,
EnumDeclaration = 229,
ModuleDeclaration = 230,
ModuleBlock = 231,
CaseBlock = 232,
NamespaceExportDeclaration = 233,
ImportEqualsDeclaration = 234,
ImportDeclaration = 235,
ImportClause = 236,
NamespaceImport = 237,
NamedImports = 238,
ImportSpecifier = 239,
ExportAssignment = 240,
ExportDeclaration = 241,
NamedExports = 242,
ExportSpecifier = 243,
MissingDeclaration = 244,
ExternalModuleReference = 245,
JsxElement = 246,
JsxSelfClosingElement = 247,
JsxOpeningElement = 248,
JsxClosingElement = 249,
JsxAttribute = 250,
JsxSpreadAttribute = 251,
JsxExpression = 252,
CaseClause = 253,
DefaultClause = 254,
HeritageClause = 255,
CatchClause = 256,
PropertyAssignment = 257,
ShorthandPropertyAssignment = 258,
SpreadAssignment = 259,
EnumMember = 260,
SourceFile = 261,
JSDocTypeExpression = 262,
JSDocAllType = 263,
JSDocUnknownType = 264,
JSDocArrayType = 265,
JSDocUnionType = 266,
JSDocTupleType = 267,
JSDocNullableType = 268,
JSDocNonNullableType = 269,
JSDocRecordType = 270,
JSDocRecordMember = 271,
JSDocTypeReference = 272,
JSDocOptionalType = 273,
JSDocFunctionType = 274,
JSDocVariadicType = 275,
JSDocConstructorType = 276,
JSDocThisType = 277,
JSDocComment = 278,
JSDocTag = 279,
JSDocAugmentsTag = 280,
JSDocParameterTag = 281,
JSDocReturnTag = 282,
JSDocTypeTag = 283,
JSDocTemplateTag = 284,
JSDocTypedefTag = 285,
JSDocPropertyTag = 286,
JSDocTypeLiteral = 287,
JSDocLiteralType = 288,
JSDocNullKeyword = 289,
JSDocUndefinedKeyword = 290,
JSDocNeverKeyword = 291,
SyntaxList = 292,
NotEmittedStatement = 293,
PartiallyEmittedExpression = 294,
MergeDeclarationMarker = 295,
EndOfDeclarationMarker = 296,
RawExpression = 297,
MetaProperty = 202,
TemplateSpan = 203,
SemicolonClassElement = 204,
Block = 205,
VariableStatement = 206,
EmptyStatement = 207,
ExpressionStatement = 208,
IfStatement = 209,
DoStatement = 210,
WhileStatement = 211,
ForStatement = 212,
ForInStatement = 213,
ForOfStatement = 214,
ContinueStatement = 215,
BreakStatement = 216,
ReturnStatement = 217,
WithStatement = 218,
SwitchStatement = 219,
LabeledStatement = 220,
ThrowStatement = 221,
TryStatement = 222,
DebuggerStatement = 223,
VariableDeclaration = 224,
VariableDeclarationList = 225,
FunctionDeclaration = 226,
ClassDeclaration = 227,
InterfaceDeclaration = 228,
TypeAliasDeclaration = 229,
EnumDeclaration = 230,
ModuleDeclaration = 231,
ModuleBlock = 232,
CaseBlock = 233,
NamespaceExportDeclaration = 234,
ImportEqualsDeclaration = 235,
ImportDeclaration = 236,
ImportClause = 237,
NamespaceImport = 238,
NamedImports = 239,
ImportSpecifier = 240,
ExportAssignment = 241,
ExportDeclaration = 242,
NamedExports = 243,
ExportSpecifier = 244,
MissingDeclaration = 245,
ExternalModuleReference = 246,
JsxElement = 247,
JsxSelfClosingElement = 248,
JsxOpeningElement = 249,
JsxClosingElement = 250,
JsxAttribute = 251,
JsxSpreadAttribute = 252,
JsxExpression = 253,
CaseClause = 254,
DefaultClause = 255,
HeritageClause = 256,
CatchClause = 257,
PropertyAssignment = 258,
ShorthandPropertyAssignment = 259,
SpreadAssignment = 260,
EnumMember = 261,
SourceFile = 262,
JSDocTypeExpression = 263,
JSDocAllType = 264,
JSDocUnknownType = 265,
JSDocArrayType = 266,
JSDocUnionType = 267,
JSDocTupleType = 268,
JSDocNullableType = 269,
JSDocNonNullableType = 270,
JSDocRecordType = 271,
JSDocRecordMember = 272,
JSDocTypeReference = 273,
JSDocOptionalType = 274,
JSDocFunctionType = 275,
JSDocVariadicType = 276,
JSDocConstructorType = 277,
JSDocThisType = 278,
JSDocComment = 279,
JSDocTag = 280,
JSDocAugmentsTag = 281,
JSDocParameterTag = 282,
JSDocReturnTag = 283,
JSDocTypeTag = 284,
JSDocTemplateTag = 285,
JSDocTypedefTag = 286,
JSDocPropertyTag = 287,
JSDocTypeLiteral = 288,
JSDocLiteralType = 289,
JSDocNullKeyword = 290,
JSDocUndefinedKeyword = 291,
JSDocNeverKeyword = 292,
SyntaxList = 293,
NotEmittedStatement = 294,
PartiallyEmittedExpression = 295,
MergeDeclarationMarker = 296,
EndOfDeclarationMarker = 297,
Count = 298,
FirstAssignment = 57,
LastAssignment = 69,
@ -361,10 +361,10 @@ declare namespace ts {
FirstBinaryOperator = 26,
LastBinaryOperator = 69,
FirstNode = 141,
FirstJSDocNode = 262,
LastJSDocNode = 288,
FirstJSDocTagNode = 278,
LastJSDocTagNode = 291,
FirstJSDocNode = 263,
LastJSDocNode = 289,
FirstJSDocTagNode = 279,
LastJSDocTagNode = 292,
}
enum NodeFlags {
None = 0,
@ -969,6 +969,11 @@ declare namespace ts {
kind: SyntaxKind.NonNullExpression;
expression: Expression;
}
interface MetaProperty extends PrimaryExpression {
kind: SyntaxKind.MetaProperty;
keywordToken: SyntaxKind;
name: Identifier;
}
interface JsxElement extends PrimaryExpression {
kind: SyntaxKind.JsxElement;
openingElement: JsxOpeningElement;
@ -1003,6 +1008,7 @@ declare namespace ts {
}
interface JsxExpression extends Expression {
kind: SyntaxKind.JsxExpression;
dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>;
expression?: Expression;
}
interface JsxText extends Node {
@ -1022,7 +1028,7 @@ declare namespace ts {
kind: SyntaxKind.MissingDeclaration;
name?: Identifier;
}
type BlockLike = SourceFile | Block | ModuleBlock | CaseClause;
type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause;
interface Block extends Statement {
kind: SyntaxKind.Block;
statements: NodeArray<Statement>;
@ -1569,6 +1575,7 @@ declare namespace ts {
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
getPropertiesOfType(type: Type): Symbol[];
getPropertyOfType(type: Type, propertyName: string): Symbol;
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo;
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
getBaseTypes(type: InterfaceType): ObjectType[];
@ -1581,6 +1588,8 @@ declare namespace ts {
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
getSymbolDisplayBuilder(): SymbolDisplayBuilder;
@ -1603,11 +1612,13 @@ declare namespace ts {
isOptionalParameter(node: ParameterDeclaration): boolean;
getAmbientModules(): Symbol[];
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
getApparentType(type: Type): Type;
}
interface SymbolDisplayBuilder {
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void;
buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
@ -1645,6 +1656,7 @@ declare namespace ts {
InFirstTypeArgument = 256,
InTypeAlias = 512,
UseTypeAliasValue = 1024,
SuppressAnyReturnType = 2048,
}
enum SymbolFormatFlags {
None = 0,
@ -1815,6 +1827,7 @@ declare namespace ts {
interface ObjectType extends Type {
objectFlags: ObjectFlags;
}
/** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */
interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
@ -1828,6 +1841,16 @@ declare namespace ts {
declaredStringIndexInfo: IndexInfo;
declaredNumberIndexInfo: IndexInfo;
}
/**
* Type references (TypeFlags.Reference). When a class or interface has type parameters or
* a "this" type, references to the class or interface are made using type references. The
* typeArguments property specifies the types to substitute for the type parameters of the
* class or interface and optionally includes an extra element that specifies the type to
* substitute for "this" in the resulting instantiation. When no extra argument is present,
* the type reference itself is substituted for "this". The typeArguments property is undefined
* if the class or interface has no type parameters and the reference isn't specifying an
* explicit "this" argument.
*/
interface TypeReference extends ObjectType {
target: GenericType;
typeArguments: Type[];
@ -2106,7 +2129,6 @@ declare namespace ts {
}
interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModuleFull | undefined;
failedLookupLocations: string[];
}
interface ResolvedTypeReferenceDirective {
primary: boolean;
@ -2325,9 +2347,28 @@ declare namespace ts {
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
/**
* Cached module resolutions per containing directory.
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
*/
interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
getOrCreateCacheForDirectory(directoryName: string): Map<ResolvedModuleWithFailedLookupLocations>;
}
/**
* Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
* We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
*/
interface NonRelativeModuleNameResolutionCache {
getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache;
}
interface PerModuleNameCache {
get(directory: string): ResolvedModuleWithFailedLookupLocations;
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
}
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations;
}
declare namespace ts {
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
@ -2674,6 +2715,7 @@ declare namespace ts {
InsertSpaceAfterCommaDelimiter: boolean;
InsertSpaceAfterSemicolonInForStatements: boolean;
InsertSpaceBeforeAndAfterBinaryOperators: boolean;
InsertSpaceAfterConstructor?: boolean;
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
@ -2682,6 +2724,7 @@ declare namespace ts {
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
InsertSpaceAfterTypeAssertion?: boolean;
InsertSpaceBeforeFunctionParenthesis?: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
}
@ -2689,6 +2732,7 @@ declare namespace ts {
insertSpaceAfterCommaDelimiter?: boolean;
insertSpaceAfterSemicolonInForStatements?: boolean;
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
insertSpaceAfterConstructor?: boolean;
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
@ -2697,6 +2741,7 @@ declare namespace ts {
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
insertSpaceAfterTypeAssertion?: boolean;
insertSpaceBeforeFunctionParenthesis?: boolean;
placeOpenBraceOnNewLineForFunctions?: boolean;
placeOpenBraceOnNewLineForControlBlocks?: boolean;
}

File diff suppressed because it is too large Load Diff

View File

@ -239,102 +239,102 @@ declare namespace ts {
ExpressionWithTypeArguments = 199,
AsExpression = 200,
NonNullExpression = 201,
TemplateSpan = 202,
SemicolonClassElement = 203,
Block = 204,
VariableStatement = 205,
EmptyStatement = 206,
ExpressionStatement = 207,
IfStatement = 208,
DoStatement = 209,
WhileStatement = 210,
ForStatement = 211,
ForInStatement = 212,
ForOfStatement = 213,
ContinueStatement = 214,
BreakStatement = 215,
ReturnStatement = 216,
WithStatement = 217,
SwitchStatement = 218,
LabeledStatement = 219,
ThrowStatement = 220,
TryStatement = 221,
DebuggerStatement = 222,
VariableDeclaration = 223,
VariableDeclarationList = 224,
FunctionDeclaration = 225,
ClassDeclaration = 226,
InterfaceDeclaration = 227,
TypeAliasDeclaration = 228,
EnumDeclaration = 229,
ModuleDeclaration = 230,
ModuleBlock = 231,
CaseBlock = 232,
NamespaceExportDeclaration = 233,
ImportEqualsDeclaration = 234,
ImportDeclaration = 235,
ImportClause = 236,
NamespaceImport = 237,
NamedImports = 238,
ImportSpecifier = 239,
ExportAssignment = 240,
ExportDeclaration = 241,
NamedExports = 242,
ExportSpecifier = 243,
MissingDeclaration = 244,
ExternalModuleReference = 245,
JsxElement = 246,
JsxSelfClosingElement = 247,
JsxOpeningElement = 248,
JsxClosingElement = 249,
JsxAttribute = 250,
JsxSpreadAttribute = 251,
JsxExpression = 252,
CaseClause = 253,
DefaultClause = 254,
HeritageClause = 255,
CatchClause = 256,
PropertyAssignment = 257,
ShorthandPropertyAssignment = 258,
SpreadAssignment = 259,
EnumMember = 260,
SourceFile = 261,
JSDocTypeExpression = 262,
JSDocAllType = 263,
JSDocUnknownType = 264,
JSDocArrayType = 265,
JSDocUnionType = 266,
JSDocTupleType = 267,
JSDocNullableType = 268,
JSDocNonNullableType = 269,
JSDocRecordType = 270,
JSDocRecordMember = 271,
JSDocTypeReference = 272,
JSDocOptionalType = 273,
JSDocFunctionType = 274,
JSDocVariadicType = 275,
JSDocConstructorType = 276,
JSDocThisType = 277,
JSDocComment = 278,
JSDocTag = 279,
JSDocAugmentsTag = 280,
JSDocParameterTag = 281,
JSDocReturnTag = 282,
JSDocTypeTag = 283,
JSDocTemplateTag = 284,
JSDocTypedefTag = 285,
JSDocPropertyTag = 286,
JSDocTypeLiteral = 287,
JSDocLiteralType = 288,
JSDocNullKeyword = 289,
JSDocUndefinedKeyword = 290,
JSDocNeverKeyword = 291,
SyntaxList = 292,
NotEmittedStatement = 293,
PartiallyEmittedExpression = 294,
MergeDeclarationMarker = 295,
EndOfDeclarationMarker = 296,
RawExpression = 297,
MetaProperty = 202,
TemplateSpan = 203,
SemicolonClassElement = 204,
Block = 205,
VariableStatement = 206,
EmptyStatement = 207,
ExpressionStatement = 208,
IfStatement = 209,
DoStatement = 210,
WhileStatement = 211,
ForStatement = 212,
ForInStatement = 213,
ForOfStatement = 214,
ContinueStatement = 215,
BreakStatement = 216,
ReturnStatement = 217,
WithStatement = 218,
SwitchStatement = 219,
LabeledStatement = 220,
ThrowStatement = 221,
TryStatement = 222,
DebuggerStatement = 223,
VariableDeclaration = 224,
VariableDeclarationList = 225,
FunctionDeclaration = 226,
ClassDeclaration = 227,
InterfaceDeclaration = 228,
TypeAliasDeclaration = 229,
EnumDeclaration = 230,
ModuleDeclaration = 231,
ModuleBlock = 232,
CaseBlock = 233,
NamespaceExportDeclaration = 234,
ImportEqualsDeclaration = 235,
ImportDeclaration = 236,
ImportClause = 237,
NamespaceImport = 238,
NamedImports = 239,
ImportSpecifier = 240,
ExportAssignment = 241,
ExportDeclaration = 242,
NamedExports = 243,
ExportSpecifier = 244,
MissingDeclaration = 245,
ExternalModuleReference = 246,
JsxElement = 247,
JsxSelfClosingElement = 248,
JsxOpeningElement = 249,
JsxClosingElement = 250,
JsxAttribute = 251,
JsxSpreadAttribute = 252,
JsxExpression = 253,
CaseClause = 254,
DefaultClause = 255,
HeritageClause = 256,
CatchClause = 257,
PropertyAssignment = 258,
ShorthandPropertyAssignment = 259,
SpreadAssignment = 260,
EnumMember = 261,
SourceFile = 262,
JSDocTypeExpression = 263,
JSDocAllType = 264,
JSDocUnknownType = 265,
JSDocArrayType = 266,
JSDocUnionType = 267,
JSDocTupleType = 268,
JSDocNullableType = 269,
JSDocNonNullableType = 270,
JSDocRecordType = 271,
JSDocRecordMember = 272,
JSDocTypeReference = 273,
JSDocOptionalType = 274,
JSDocFunctionType = 275,
JSDocVariadicType = 276,
JSDocConstructorType = 277,
JSDocThisType = 278,
JSDocComment = 279,
JSDocTag = 280,
JSDocAugmentsTag = 281,
JSDocParameterTag = 282,
JSDocReturnTag = 283,
JSDocTypeTag = 284,
JSDocTemplateTag = 285,
JSDocTypedefTag = 286,
JSDocPropertyTag = 287,
JSDocTypeLiteral = 288,
JSDocLiteralType = 289,
JSDocNullKeyword = 290,
JSDocUndefinedKeyword = 291,
JSDocNeverKeyword = 292,
SyntaxList = 293,
NotEmittedStatement = 294,
PartiallyEmittedExpression = 295,
MergeDeclarationMarker = 296,
EndOfDeclarationMarker = 297,
Count = 298,
FirstAssignment = 57,
LastAssignment = 69,
@ -361,10 +361,10 @@ declare namespace ts {
FirstBinaryOperator = 26,
LastBinaryOperator = 69,
FirstNode = 141,
FirstJSDocNode = 262,
LastJSDocNode = 288,
FirstJSDocTagNode = 278,
LastJSDocTagNode = 291,
FirstJSDocNode = 263,
LastJSDocNode = 289,
FirstJSDocTagNode = 279,
LastJSDocTagNode = 292,
}
enum NodeFlags {
None = 0,
@ -969,6 +969,11 @@ declare namespace ts {
kind: SyntaxKind.NonNullExpression;
expression: Expression;
}
interface MetaProperty extends PrimaryExpression {
kind: SyntaxKind.MetaProperty;
keywordToken: SyntaxKind;
name: Identifier;
}
interface JsxElement extends PrimaryExpression {
kind: SyntaxKind.JsxElement;
openingElement: JsxOpeningElement;
@ -1003,6 +1008,7 @@ declare namespace ts {
}
interface JsxExpression extends Expression {
kind: SyntaxKind.JsxExpression;
dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>;
expression?: Expression;
}
interface JsxText extends Node {
@ -1022,7 +1028,7 @@ declare namespace ts {
kind: SyntaxKind.MissingDeclaration;
name?: Identifier;
}
type BlockLike = SourceFile | Block | ModuleBlock | CaseClause;
type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause;
interface Block extends Statement {
kind: SyntaxKind.Block;
statements: NodeArray<Statement>;
@ -1569,6 +1575,7 @@ declare namespace ts {
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
getPropertiesOfType(type: Type): Symbol[];
getPropertyOfType(type: Type, propertyName: string): Symbol;
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo;
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
getBaseTypes(type: InterfaceType): ObjectType[];
@ -1581,6 +1588,8 @@ declare namespace ts {
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
getSymbolDisplayBuilder(): SymbolDisplayBuilder;
@ -1603,11 +1612,13 @@ declare namespace ts {
isOptionalParameter(node: ParameterDeclaration): boolean;
getAmbientModules(): Symbol[];
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
getApparentType(type: Type): Type;
}
interface SymbolDisplayBuilder {
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void;
buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
@ -1645,6 +1656,7 @@ declare namespace ts {
InFirstTypeArgument = 256,
InTypeAlias = 512,
UseTypeAliasValue = 1024,
SuppressAnyReturnType = 2048,
}
enum SymbolFormatFlags {
None = 0,
@ -1815,6 +1827,7 @@ declare namespace ts {
interface ObjectType extends Type {
objectFlags: ObjectFlags;
}
/** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */
interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
@ -1828,6 +1841,16 @@ declare namespace ts {
declaredStringIndexInfo: IndexInfo;
declaredNumberIndexInfo: IndexInfo;
}
/**
* Type references (TypeFlags.Reference). When a class or interface has type parameters or
* a "this" type, references to the class or interface are made using type references. The
* typeArguments property specifies the types to substitute for the type parameters of the
* class or interface and optionally includes an extra element that specifies the type to
* substitute for "this" in the resulting instantiation. When no extra argument is present,
* the type reference itself is substituted for "this". The typeArguments property is undefined
* if the class or interface has no type parameters and the reference isn't specifying an
* explicit "this" argument.
*/
interface TypeReference extends ObjectType {
target: GenericType;
typeArguments: Type[];
@ -2106,7 +2129,6 @@ declare namespace ts {
}
interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModuleFull | undefined;
failedLookupLocations: string[];
}
interface ResolvedTypeReferenceDirective {
primary: boolean;
@ -2325,9 +2347,28 @@ declare namespace ts {
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
/**
* Cached module resolutions per containing directory.
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
*/
interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
getOrCreateCacheForDirectory(directoryName: string): Map<ResolvedModuleWithFailedLookupLocations>;
}
/**
* Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
* We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
*/
interface NonRelativeModuleNameResolutionCache {
getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache;
}
interface PerModuleNameCache {
get(directory: string): ResolvedModuleWithFailedLookupLocations;
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
}
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations;
}
declare namespace ts {
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
@ -2674,6 +2715,7 @@ declare namespace ts {
InsertSpaceAfterCommaDelimiter: boolean;
InsertSpaceAfterSemicolonInForStatements: boolean;
InsertSpaceBeforeAndAfterBinaryOperators: boolean;
InsertSpaceAfterConstructor?: boolean;
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
@ -2682,6 +2724,7 @@ declare namespace ts {
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
InsertSpaceAfterTypeAssertion?: boolean;
InsertSpaceBeforeFunctionParenthesis?: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
}
@ -2689,6 +2732,7 @@ declare namespace ts {
insertSpaceAfterCommaDelimiter?: boolean;
insertSpaceAfterSemicolonInForStatements?: boolean;
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
insertSpaceAfterConstructor?: boolean;
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
@ -2697,6 +2741,7 @@ declare namespace ts {
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
insertSpaceAfterTypeAssertion?: boolean;
insertSpaceBeforeFunctionParenthesis?: boolean;
placeOpenBraceOnNewLineForFunctions?: boolean;
placeOpenBraceOnNewLineForControlBlocks?: boolean;
}

File diff suppressed because it is too large Load Diff

View File

@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
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 __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ts;
(function (ts) {
var OperationCanceledException = (function () {
@ -206,7 +211,7 @@ var ts;
ts.toPath = toPath;
function forEach(array, callback) {
if (array) {
for (var i = 0, len = array.length; i < len; i++) {
for (var i = 0; i < array.length; i++) {
var result = callback(array[i], i);
if (result) {
return result;
@ -225,7 +230,7 @@ var ts;
ts.zipWith = zipWith;
function every(array, callback) {
if (array) {
for (var i = 0, len = array.length; i < len; i++) {
for (var i = 0; i < array.length; i++) {
if (!callback(array[i], i)) {
return false;
}
@ -235,7 +240,7 @@ var ts;
}
ts.every = every;
function find(array, predicate) {
for (var i = 0, len = array.length; i < len; i++) {
for (var i = 0; i < array.length; i++) {
var value = array[i];
if (predicate(value, i)) {
return value;
@ -245,7 +250,7 @@ var ts;
}
ts.find = find;
function findMap(array, callback) {
for (var i = 0, len = array.length; i < len; i++) {
for (var i = 0; i < array.length; i++) {
var result = callback(array[i], i);
if (result) {
return result;
@ -268,7 +273,7 @@ var ts;
ts.contains = contains;
function indexOf(array, value) {
if (array) {
for (var i = 0, len = array.length; i < len; i++) {
for (var i = 0; i < array.length; i++) {
if (array[i] === value) {
return i;
}
@ -278,7 +283,7 @@ var ts;
}
ts.indexOf = indexOf;
function indexOfAnyCharCode(text, charCodes, start) {
for (var i = start || 0, len = text.length; i < len; i++) {
for (var i = start || 0; i < text.length; i++) {
if (contains(charCodes, text.charCodeAt(i))) {
return i;
}
@ -981,6 +986,7 @@ var ts;
baseIndex = baseIndex || 0;
return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; });
}
ts.formatStringFromArgs = formatStringFromArgs;
ts.localizedDiagnosticMessages = undefined;
function getLocaleSpecificMessage(message) {
return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message;
@ -2475,7 +2481,7 @@ var ts;
_0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." },
A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." },
Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." },
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." },
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." },
An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." },
_0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." },
_0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." },
@ -2632,6 +2638,7 @@ var ts;
Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." },
A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." },
An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." },
A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." },
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." },
@ -2861,6 +2868,8 @@ var ts;
Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." },
The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." },
Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." },
Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." },
Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." },
JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." },
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." },
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." },
@ -2870,6 +2879,7 @@ var ts;
Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." },
JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" },
The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" },
JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." },
Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" },
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." },
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
@ -2921,6 +2931,8 @@ var ts;
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" },
The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@ -3089,6 +3101,7 @@ var ts;
Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." },
Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " },
Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" },
File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." },
Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." },
Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." },
Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" },
@ -3102,10 +3115,10 @@ var ts;
Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." },
Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." },
Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." },
Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." },
Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." },
File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." },
File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." },
Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." },
Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." },
Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." },
package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." },
package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." },
@ -3154,6 +3167,8 @@ var ts;
Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." },
Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." },
Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." },
Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." },
Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." },
@ -3210,22 +3225,25 @@ var ts;
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." },
_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?" },
Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." },
Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" },
Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" },
Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" },
Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" },
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." },
Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." },
Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." },
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." },
Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." },
};
})(ts || (ts = {}));
var ts;
@ -3606,7 +3624,7 @@ var ts;
if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {
var ch = text.charCodeAt(pos);
if ((pos + mergeConflictMarkerLength) < text.length) {
for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) {
for (var i = 0; i < mergeConflictMarkerLength; i++) {
if (text.charCodeAt(pos + i) !== ch) {
return false;
}
@ -3792,7 +3810,7 @@ var ts;
if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
return false;
}
for (var i = 1, n = name.length; i < n; i++) {
for (var i = 1; i < name.length; i++) {
if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
return false;
}
@ -5539,6 +5557,7 @@ var ts;
if (resolutionStack === void 0) { resolutionStack = []; }
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
var errors = [];
basePath = ts.normalizeSlashes(basePath);
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
@ -6102,6 +6121,12 @@ var ts;
return compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
var Extensions;
(function (Extensions) {
Extensions[Extensions["TypeScript"] = 0] = "TypeScript";
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly";
})(Extensions || (Extensions = {}));
function resolvedTypeScriptOnly(resolved) {
if (!resolved) {
return undefined;
@ -6109,9 +6134,6 @@ var ts;
ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension));
return resolved.path;
}
function resolvedFromAnyFile(path) {
return { path: path, extension: ts.extensionFromPath(path) };
}
function resolvedModuleFromResolved(_a, isExternalLibraryImport) {
var path = _a.path, extension = _a.extension;
return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport };
@ -6123,13 +6145,13 @@ var ts;
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
case 2:
case 0:
case Extensions.DtsOnly:
case Extensions.TypeScript:
return tryReadFromField("typings") || tryReadFromField("types");
case 1:
case Extensions.JavaScript:
if (typeof jsonContent.main === "string") {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
@ -6191,6 +6213,7 @@ var ts;
if (host.directoryExists(atTypes)) {
(typeRoots || (typeRoots = [])).push(atTypes);
}
return undefined;
});
return typeRoots;
}
@ -6245,7 +6268,11 @@ var ts;
return ts.forEach(typeRoots, function (typeRoot) {
var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);
var candidateDirectory = ts.getDirectoryPath(candidate);
return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState));
var directoryExists = directoryProbablyExists(candidateDirectory, host);
if (!directoryExists && traceEnabled) {
trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory);
}
return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState));
});
}
else {
@ -6261,7 +6288,8 @@ var ts;
if (traceEnabled) {
trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
}
resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState));
var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined);
resolvedFile = resolvedTypeScriptOnly(result && result.value);
if (!resolvedFile && traceEnabled) {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
}
@ -6302,31 +6330,115 @@ var ts;
return result;
}
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
function resolveModuleName(moduleName, containingFile, compilerOptions, host) {
function createModuleResolutionCache(currentDirectory, getCanonicalFileName) {
var directoryToModuleNameMap = ts.createFileMap();
var moduleNameToDirectoryMap = ts.createMap();
return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName };
function getOrCreateCacheForDirectory(directoryName) {
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
var perFolderCache = directoryToModuleNameMap.get(path);
if (!perFolderCache) {
perFolderCache = ts.createMap();
directoryToModuleNameMap.set(path, perFolderCache);
}
return perFolderCache;
}
function getOrCreateCacheForModuleName(nonRelativeModuleName) {
if (!moduleHasNonRelativeName(nonRelativeModuleName)) {
return undefined;
}
var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName];
if (!perModuleNameCache) {
moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache();
}
return perModuleNameCache;
}
function createPerModuleNameCache() {
var directoryPathMap = ts.createFileMap();
return { get: get, set: set };
function get(directory) {
return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName));
}
function set(directory, result) {
var path = ts.toPath(directory, currentDirectory, getCanonicalFileName);
if (directoryPathMap.contains(path)) {
return;
}
directoryPathMap.set(path, result);
var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName;
var commonPrefix = getCommonPrefix(path, resolvedFileName);
var current = path;
while (true) {
var parent_1 = ts.getDirectoryPath(current);
if (parent_1 === current || directoryPathMap.contains(parent_1)) {
break;
}
directoryPathMap.set(parent_1, result);
current = parent_1;
if (current == commonPrefix) {
break;
}
}
}
function getCommonPrefix(directory, resolution) {
if (resolution === undefined) {
return undefined;
}
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
var i = 0;
while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
i++;
}
var sep = directory.lastIndexOf(ts.directorySeparator, i);
if (sep < 0) {
return undefined;
}
return directory.substr(0, sep);
}
}
}
ts.createModuleResolutionCache = createModuleResolutionCache;
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) {
var traceEnabled = isTraceEnabled(compilerOptions, host);
if (traceEnabled) {
trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);
}
var moduleResolution = compilerOptions.moduleResolution;
if (moduleResolution === undefined) {
moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
var containingDirectory = ts.getDirectoryPath(containingFile);
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
var result = perFolderCache && perFolderCache[moduleName];
if (result) {
if (traceEnabled) {
trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName);
}
}
else {
if (traceEnabled) {
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
var moduleResolution = compilerOptions.moduleResolution;
if (moduleResolution === undefined) {
moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
if (traceEnabled) {
trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
else {
if (traceEnabled) {
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache);
break;
case ts.ModuleResolutionKind.Classic:
result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache);
break;
}
if (perFolderCache) {
perFolderCache[moduleName] = result;
var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName);
if (perModuleNameCache) {
perModuleNameCache.set(containingDirectory, result);
}
}
}
var result;
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host);
break;
case ts.ModuleResolutionKind.Classic:
result = classicNameResolver(moduleName, containingFile, compilerOptions, host);
break;
}
if (traceEnabled) {
if (result.resolvedModule) {
@ -6451,33 +6563,33 @@ var ts;
return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
}
}
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) {
var containingDirectory = ts.getDirectoryPath(containingFile);
var traceEnabled = isTraceEnabled(compilerOptions, host);
var failedLookupLocations = [];
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
var result = tryResolve(0) || tryResolve(1);
if (result) {
var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport;
var result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
if (result && result.value) {
var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport;
return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations);
}
return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
function tryResolve(extensions) {
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);
if (resolved) {
return { resolved: resolved, isExternalLibraryImport: false };
return toSearchResult({ resolved: resolved, isExternalLibraryImport: false });
}
if (moduleHasNonRelativeName(moduleName)) {
if (traceEnabled) {
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
}
var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state);
return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true };
var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache);
return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } };
}
else {
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state);
return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false };
return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false });
}
}
}
@ -6494,10 +6606,33 @@ var ts;
}
function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);
trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]);
}
var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
if (!ts.pathEndsWithDirectorySeparator(candidate)) {
if (!onlyRecordFailures) {
var parentOfCandidate = ts.getDirectoryPath(candidate);
if (!directoryProbablyExists(parentOfCandidate, state.host)) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate);
}
onlyRecordFailures = true;
}
}
var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
if (resolvedFromFile) {
return resolvedFromFile;
}
}
if (!onlyRecordFailures) {
var candidateExists = directoryProbablyExists(candidate, state.host);
if (!candidateExists) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate);
}
onlyRecordFailures = true;
}
}
return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
}
function directoryProbablyExists(directoryName, host) {
return !host.directoryExists || host.directoryExists(directoryName);
@ -6525,11 +6660,11 @@ var ts;
}
}
switch (extensions) {
case 2:
case Extensions.DtsOnly:
return tryExtension(".d.ts", ts.Extension.Dts);
case 0:
case Extensions.TypeScript:
return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts);
case 1:
case Extensions.JavaScript:
return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx);
}
function tryExtension(ext, extension) {
@ -6538,19 +6673,21 @@ var ts;
}
}
function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) {
if (!onlyRecordFailures && state.host.fileExists(fileName)) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
if (!onlyRecordFailures) {
if (state.host.fileExists(fileName)) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
}
return fileName;
}
return fileName;
}
else {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);
else {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);
}
}
failedLookupLocations.push(fileName);
return undefined;
}
failedLookupLocations.push(fileName);
return undefined;
}
function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
var packageJsonPath = pathToPackageJson(candidate);
@ -6559,16 +6696,22 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state);
if (typesFile) {
var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);
var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state);
if (fromFile) {
return resolvedFromAnyFile(fromFile);
var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state);
if (mainOrTypesFile) {
var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host);
var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state);
if (fromExactFile) {
var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile);
if (resolved_3) {
return resolved_3;
}
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
}
}
var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state);
if (x) {
return x;
var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state);
if (resolved) {
return resolved;
}
}
else {
@ -6578,73 +6721,117 @@ var ts;
}
}
else {
if (state.traceEnabled) {
if (directoryExists && state.traceEnabled) {
trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);
}
failedLookupLocations.push(packageJsonPath);
}
return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state);
}
function resolvedIfExtensionMatches(extensions, path) {
var extension = ts.tryGetExtensionFromPath(path);
return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined;
}
function extensionIsOk(extensions, extension) {
switch (extensions) {
case Extensions.JavaScript:
return extension === ts.Extension.Js || extension === ts.Extension.Jsx;
case Extensions.TypeScript:
return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts;
case Extensions.DtsOnly:
return extension === ts.Extension.Dts;
}
}
function pathToPackageJson(directory) {
return ts.combinePaths(directory, "package.json");
}
function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) {
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) {
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) ||
loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
}
function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) {
return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false);
function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) {
return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache);
}
function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {
return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true);
return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined);
}
function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {
function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) {
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly);
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host);
if (resolutionFromCache) {
return resolutionFromCache;
}
return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly));
}
});
}
function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {
if (typesOnly === void 0) { typesOnly = false; }
var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state);
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
if (!nodeModulesFolderExists && state.traceEnabled) {
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
}
var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state);
if (packageResult) {
return packageResult;
}
if (extensions !== 1) {
return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state);
if (extensions !== Extensions.JavaScript) {
var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types");
var nodeModulesAtTypesExists = nodeModulesFolderExists;
if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1);
}
nodeModulesAtTypesExists = false;
}
return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state);
}
}
function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) {
var result = cache && cache.get(containingDirectory);
if (result) {
if (traceEnabled) {
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName);
}
return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } };
}
}
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) {
var traceEnabled = isTraceEnabled(compilerOptions, host);
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
var failedLookupLocations = [];
var containingDirectory = ts.getDirectoryPath(containingFile);
var resolved = tryResolve(0) || tryResolve(1);
return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations);
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations);
function tryResolve(extensions) {
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state);
if (resolvedUsingSettings) {
return resolvedUsingSettings;
return { value: resolvedUsingSettings };
}
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
if (moduleHasNonRelativeName(moduleName)) {
var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) {
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
if (resolutionFromCache) {
return resolutionFromCache;
}
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state);
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state));
});
if (resolved_3) {
return resolved_3;
if (resolved_4) {
return resolved_4;
}
if (extensions === 0) {
if (extensions === Extensions.TypeScript) {
return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
}
}
else {
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state);
return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state));
}
}
}
@ -6656,10 +6843,13 @@ var ts;
}
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
var failedLookupLocations = [];
var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state);
var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state);
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations);
}
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
function toSearchResult(value) {
return value !== undefined ? { value: value } : undefined;
}
function forEachAncestorDirectory(directory, callback) {
while (true) {
var result = callback(directory);