.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / tsutils / util / util.d.ts
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/tsutils/util/util.d.ts b/.config/coc/extensions/node_modules/coc-prettier/node_modules/tsutils/util/util.d.ts
new file mode 100644 (file)
index 0000000..97cedda
--- /dev/null
@@ -0,0 +1,265 @@
+import * as ts from 'typescript';\r
+import { NodeWrap } from './convert-ast';\r
+export declare function getChildOfKind<T extends ts.SyntaxKind>(node: ts.Node, kind: T, sourceFile?: ts.SourceFile): ts.Token<T> | undefined;\r
+export declare function isTokenKind(kind: ts.SyntaxKind): boolean;\r
+export declare function isNodeKind(kind: ts.SyntaxKind): boolean;\r
+export declare function isAssignmentKind(kind: ts.SyntaxKind): boolean;\r
+export declare function isTypeNodeKind(kind: ts.SyntaxKind): boolean;\r
+export declare function isJsDocKind(kind: ts.SyntaxKind): boolean;\r
+export declare function isKeywordKind(kind: ts.SyntaxKind): boolean;\r
+export declare function isThisParameter(parameter: ts.ParameterDeclaration): boolean;\r
+export declare function getModifier(node: ts.Node, kind: ts.Modifier['kind']): ts.Modifier | undefined;\r
+export declare function hasModifier(modifiers: ts.ModifiersArray | undefined, ...kinds: Array<ts.Modifier['kind']>): boolean;\r
+export declare function isParameterProperty(node: ts.ParameterDeclaration): boolean;\r
+export declare function hasAccessModifier(node: ts.ClassElement | ts.ParameterDeclaration): boolean;\r
+export declare const isNodeFlagSet: (node: ts.Node, flag: ts.NodeFlags) => boolean;\r
+export declare const isTypeFlagSet: (type: ts.Type, flag: ts.TypeFlags) => boolean;\r
+export declare const isSymbolFlagSet: (symbol: ts.Symbol, flag: ts.SymbolFlags) => boolean;\r
+export declare function isObjectFlagSet(objectType: ts.ObjectType, flag: ts.ObjectFlags): boolean;\r
+export declare function isModifierFlagSet(node: ts.Node, flag: ts.ModifierFlags): boolean;\r
+export declare function getPreviousStatement(statement: ts.Statement): ts.Statement | undefined;\r
+export declare function getNextStatement(statement: ts.Statement): ts.Statement | undefined;\r
+/** Returns the token before the start of `node` or `undefined` if there is none. */\r
+export declare function getPreviousToken(node: ts.Node, sourceFile?: ts.SourceFile): ts.Node | undefined;\r
+/** Returns the next token that begins after the end of `node`. Returns `undefined` for SourceFile and EndOfFileToken */\r
+export declare function getNextToken(node: ts.Node, sourceFile?: ts.SourceFile): ts.Node | undefined;\r
+/** Returns the token at or following the specified position or undefined if none is found inside `parent`. */\r
+export declare function getTokenAtPosition(parent: ts.Node, pos: number, sourceFile?: ts.SourceFile, allowJsDoc?: boolean): ts.Node | undefined;\r
+/**\r
+ * Return the comment at the specified position.\r
+ * You can pass an optional `parent` to avoid some work finding the corresponding token starting at `sourceFile`.\r
+ * If the `parent` parameter is passed, `pos` must be between `parent.pos` and `parent.end`.\r
+*/\r
+export declare function getCommentAtPosition(sourceFile: ts.SourceFile, pos: number, parent?: ts.Node): ts.CommentRange | undefined;\r
+/**\r
+ * Returns whether the specified position is inside a comment.\r
+ * You can pass an optional `parent` to avoid some work finding the corresponding token starting at `sourceFile`.\r
+ * If the `parent` parameter is passed, `pos` must be between `parent.pos` and `parent.end`.\r
+ */\r
+export declare function isPositionInComment(sourceFile: ts.SourceFile, pos: number, parent?: ts.Node): boolean;\r
+export declare function commentText(sourceText: string, comment: ts.CommentRange): string;\r
+/** Returns the deepest AST Node at `pos`. Returns undefined if `pos` is outside of the range of `node` */\r
+export declare function getAstNodeAtPosition(node: ts.Node, pos: number): ts.Node | undefined;\r
+/**\r
+ * Returns the NodeWrap of deepest AST node that contains `pos` between its `pos` and `end`.\r
+ * Only returns undefined if pos is outside of `wrap`\r
+ */\r
+export declare function getWrappedNodeAtPosition(wrap: NodeWrap, pos: number): NodeWrap | undefined;\r
+export declare function getPropertyName(propertyName: ts.PropertyName): string | undefined;\r
+export declare function forEachDestructuringIdentifier<T>(pattern: ts.BindingPattern, fn: (element: ts.BindingElement & {\r
+    name: ts.Identifier;\r
+}) => T): T | undefined;\r
+export declare function forEachDeclaredVariable<T>(declarationList: ts.VariableDeclarationList, cb: (element: (ts.VariableDeclaration | ts.BindingElement) & {\r
+    name: ts.Identifier;\r
+}) => T): T | undefined;\r
+export declare enum VariableDeclarationKind {\r
+    Var = 0,\r
+    Let = 1,\r
+    Const = 2\r
+}\r
+export declare function getVariableDeclarationKind(declarationList: ts.VariableDeclarationList): VariableDeclarationKind;\r
+export declare function isBlockScopedVariableDeclarationList(declarationList: ts.VariableDeclarationList): boolean;\r
+export declare function isBlockScopedVariableDeclaration(declaration: ts.VariableDeclaration): boolean;\r
+export declare function isBlockScopedDeclarationStatement(statement: ts.Statement): statement is ts.DeclarationStatement;\r
+export declare function isInSingleStatementContext(statement: ts.Statement): boolean;\r
+export declare enum ScopeBoundary {\r
+    None = 0,\r
+    Function = 1,\r
+    Block = 2,\r
+    Type = 4,\r
+    ConditionalType = 8\r
+}\r
+export declare enum ScopeBoundarySelector {\r
+    Function = 1,\r
+    Block = 3,\r
+    Type = 7,\r
+    InferType = 8\r
+}\r
+export declare function isScopeBoundary(node: ts.Node): ScopeBoundary;\r
+export declare function isTypeScopeBoundary(node: ts.Node): ScopeBoundary;\r
+export declare function isFunctionScopeBoundary(node: ts.Node): ScopeBoundary;\r
+export declare function isBlockScopeBoundary(node: ts.Node): ScopeBoundary;\r
+/** Returns true for scope boundaries that have their own `this` reference instead of inheriting it from the containing scope */\r
+export declare function hasOwnThisReference(node: ts.Node): boolean;\r
+export declare function isFunctionWithBody(node: ts.Node): node is ts.FunctionLikeDeclaration & {\r
+    body: {};\r
+};\r
+/**\r
+ * Iterate over all tokens of `node`\r
+ *\r
+ * @param node The node whose tokens should be visited\r
+ * @param cb Is called for every token contained in `node`\r
+ */\r
+export declare function forEachToken(node: ts.Node, cb: (node: ts.Node) => void, sourceFile?: ts.SourceFile): void;\r
+export declare type ForEachTokenCallback = (fullText: string, kind: ts.SyntaxKind, range: ts.TextRange, parent: ts.Node) => void;\r
+/**\r
+ * Iterate over all tokens and trivia of `node`\r
+ *\r
+ * @description JsDoc comments are treated like regular comments\r
+ *\r
+ * @param node The node whose tokens should be visited\r
+ * @param cb Is called for every token contained in `node` and trivia before the token\r
+ */\r
+export declare function forEachTokenWithTrivia(node: ts.Node, cb: ForEachTokenCallback, sourceFile?: ts.SourceFile): void;\r
+export declare type ForEachCommentCallback = (fullText: string, comment: ts.CommentRange) => void;\r
+/** Iterate over all comments owned by `node` or its children */\r
+export declare function forEachComment(node: ts.Node, cb: ForEachCommentCallback, sourceFile?: ts.SourceFile): void;\r
+export interface LineRange extends ts.TextRange {\r
+    contentLength: number;\r
+}\r
+export declare function getLineRanges(sourceFile: ts.SourceFile): LineRange[];\r
+/** Get the line break style used in sourceFile. This function only looks at the first line break. If there is none, \n is assumed. */\r
+export declare function getLineBreakStyle(sourceFile: ts.SourceFile): "\n" | "\r\n";\r
+/**\r
+ * Determines whether the given text parses as a standalone identifier.\r
+ * This is not a guarantee that it works in every context. The property name in PropertyAccessExpressions for example allows reserved words.\r
+ * Depending on the context it could be parsed as contextual keyword or TypeScript keyword.\r
+ */\r
+export declare function isValidIdentifier(text: string, languageVersion?: ts.ScriptTarget): boolean;\r
+/**\r
+ * Determines whether the given text can be used to access a property with a PropertyAccessExpression while preserving the property's name.\r
+ */\r
+export declare function isValidPropertyAccess(text: string, languageVersion?: ts.ScriptTarget): boolean;\r
+/**\r
+ * Determines whether the given text can be used as unquoted name of a property declaration while preserving the property's name.\r
+ */\r
+export declare function isValidPropertyName(text: string, languageVersion?: ts.ScriptTarget): boolean;\r
+/**\r
+ * Determines whether the given text can be parsed as a numeric literal.\r
+ */\r
+export declare function isValidNumericLiteral(text: string, languageVersion?: ts.ScriptTarget): boolean;\r
+/**\r
+ * Determines whether the given text can be used as JSX tag or attribute name while preserving the exact name.\r
+ */\r
+export declare function isValidJsxIdentifier(text: string, languageVersion?: ts.ScriptTarget): boolean;\r
+export declare function isNumericPropertyName(name: string | ts.__String): boolean;\r
+export declare function isSameLine(sourceFile: ts.SourceFile, pos1: number, pos2: number): boolean;\r
+export declare enum SideEffectOptions {\r
+    None = 0,\r
+    TaggedTemplate = 1,\r
+    Constructor = 2,\r
+    JsxElement = 4\r
+}\r
+export declare function hasSideEffects(node: ts.Expression, options?: SideEffectOptions): boolean;\r
+/** Returns the VariableDeclaration or ParameterDeclaration that contains the BindingElement */\r
+export declare function getDeclarationOfBindingElement(node: ts.BindingElement): ts.VariableDeclaration | ts.ParameterDeclaration;\r
+export declare function isExpressionValueUsed(node: ts.Expression): boolean;\r
+export declare enum AccessKind {\r
+    None = 0,\r
+    Read = 1,\r
+    Write = 2,\r
+    Delete = 4,\r
+    ReadWrite = 3,\r
+    Modification = 6\r
+}\r
+export declare function getAccessKind(node: ts.Node): AccessKind;\r
+export declare function isReassignmentTarget(node: ts.Expression): boolean;\r
+export declare function canHaveJsDoc(node: ts.Node): node is ts.HasJSDoc;\r
+/** Gets the JSDoc of a node. For performance reasons this function should only be called when `canHaveJsDoc` returns true. */\r
+export declare function getJsDoc(node: ts.Node, sourceFile?: ts.SourceFile): ts.JSDoc[];\r
+/**\r
+ * Parses the JsDoc of any node. This function is made for nodes that don't get their JsDoc parsed by the TypeScript parser.\r
+ *\r
+ * @param considerTrailingComments When set to `true` this function uses the trailing comments if the node starts on the same line\r
+ *                                 as the previous node ends.\r
+ */\r
+export declare function parseJsDocOfNode(node: ts.Node, considerTrailingComments?: boolean, sourceFile?: ts.SourceFile): ts.JSDoc[];\r
+export declare enum ImportKind {\r
+    ImportDeclaration = 1,\r
+    ImportEquals = 2,\r
+    ExportFrom = 4,\r
+    DynamicImport = 8,\r
+    Require = 16,\r
+    ImportType = 32,\r
+    All = 63,\r
+    AllImports = 59,\r
+    AllStaticImports = 3,\r
+    AllImportExpressions = 24,\r
+    AllRequireLike = 18\r
+}\r
+export declare function findImports(sourceFile: ts.SourceFile, kinds: ImportKind, ignoreFileName?: boolean): (ts.StringLiteral | ts.NoSubstitutionTemplateLiteral)[];\r
+export declare type ImportLike = ts.ImportDeclaration | ts.ImportEqualsDeclaration & {\r
+    moduleReference: ts.ExternalModuleReference;\r
+} | ts.ExportDeclaration & {\r
+    moduleSpecifier: {};\r
+} | ts.CallExpression & {\r
+    expression: ts.Token<ts.SyntaxKind.ImportKeyword> | ts.Identifier & {\r
+        text: 'require';\r
+    };\r
+    arguments: [ts.Expression, ...ts.Expression[]];\r
+} | ts.ImportTypeNode;\r
+export declare function findImportLikeNodes(sourceFile: ts.SourceFile, kinds: ImportKind, ignoreFileName?: boolean): ImportLike[];\r
+/**\r
+ * Ambient context means the statement itself has the `declare` keyword\r
+ * or is inside a `declare namespace`,  `delcare module` or `declare global`.\r
+ */\r
+export declare function isStatementInAmbientContext(node: ts.Statement): boolean;\r
+/** Includes `declare namespace`, `declare module` and `declare global` and namespace nested in one of the aforementioned. */\r
+export declare function isAmbientModuleBlock(node: ts.Node): node is ts.ModuleBlock;\r
+export declare function getIIFE(func: ts.FunctionExpression | ts.ArrowFunction): ts.CallExpression | undefined;\r
+export declare type StrictCompilerOption = 'noImplicitAny' | 'noImplicitThis' | 'strictNullChecks' | 'strictFunctionTypes' | 'strictPropertyInitialization' | 'alwaysStrict' | 'strictBindCallApply';\r
+export declare function isStrictCompilerOptionEnabled(options: ts.CompilerOptions, option: StrictCompilerOption): boolean;\r
+export declare type BooleanCompilerOptions = {\r
+    [K in keyof ts.CompilerOptions]: NonNullable<ts.CompilerOptions[K]> extends boolean ? K : never;\r
+} extends {\r
+    [_ in keyof ts.CompilerOptions]: infer U;\r
+} ? U : never;\r
+/**\r
+ * Checks if a given compiler option is enabled.\r
+ * It handles dependencies of options, e.g. `declaration` is implicitly enabled by `composite` or `strictNullChecks` is enabled by `strict`.\r
+ * However, it does not check dependencies that are already checked and reported as errors, e.g. `checkJs` without `allowJs`.\r
+ * This function only handles boolean flags.\r
+ */\r
+export declare function isCompilerOptionEnabled(options: ts.CompilerOptions, option: BooleanCompilerOptions | 'stripInternal'): boolean;\r
+/**\r
+ * Has nothing to do with `isAmbientModuleBlock`.\r
+ *\r
+ * @returns `true` if it's a global augmentation or has a string name.\r
+ */\r
+export declare function isAmbientModule(node: ts.ModuleDeclaration): boolean;\r
+/**\r
+ * @deprecated use `getTsCheckDirective` instead since `// @ts-nocheck` is no longer restricted to JS files.\r
+ * @returns the last `// @ts-check` or `// @ts-nocheck` directive in the given file.\r
+ */\r
+export declare function getCheckJsDirective(source: string): ts.CheckJsDirective | undefined;\r
+/** @returns the last `// @ts-check` or `// @ts-nocheck` directive in the given file. */\r
+export declare function getTsCheckDirective(source: string): ts.CheckJsDirective | undefined;\r
+export declare function isConstAssertion(node: ts.AssertionExpression): boolean;\r
+/** Detects whether an expression is affected by an enclosing 'as const' assertion and therefore treated literally. */\r
+export declare function isInConstContext(node: ts.Expression): boolean;\r
+/** Returns true for `Object.defineProperty(o, 'prop', {value, writable: false})` and  `Object.defineProperty(o, 'prop', {get: () => 1})`*/\r
+export declare function isReadonlyAssignmentDeclaration(node: ts.CallExpression, checker: ts.TypeChecker): boolean;\r
+/** Determines whether a call to `Object.defineProperty` is statically analyzable. */\r
+export declare function isBindableObjectDefinePropertyCall(node: ts.CallExpression): boolean;\r
+export interface WellKnownSymbolLiteral extends ts.PropertyAccessExpression {\r
+    expression: ts.Identifier & {\r
+        text: 'Symbol';\r
+        escapedText: 'symbol';\r
+    };\r
+}\r
+export declare function isWellKnownSymbolLiterally(node: ts.Expression): node is WellKnownSymbolLiteral;\r
+export interface PropertyName {\r
+    displayName: string;\r
+    symbolName: ts.__String;\r
+}\r
+/** @deprecated typescript 4.3 removed the concept of literal well known symbols. Use `getPropertyNameFromType` instead. */\r
+export declare function getPropertyNameOfWellKnownSymbol(node: WellKnownSymbolLiteral): PropertyName;\r
+export interface LateBoundPropertyNames {\r
+    /** Whether all constituents are literal names. */\r
+    known: boolean;\r
+    names: PropertyName[];\r
+}\r
+export declare function getLateBoundPropertyNames(node: ts.Expression, checker: ts.TypeChecker): LateBoundPropertyNames;\r
+export declare function getLateBoundPropertyNamesOfPropertyName(node: ts.PropertyName, checker: ts.TypeChecker): LateBoundPropertyNames;\r
+/** Most declarations demand there to be only one statically known name, e.g. class members with computed name. */\r
+export declare function getSingleLateBoundPropertyNameOfPropertyName(node: ts.PropertyName, checker: ts.TypeChecker): PropertyName | undefined;\r
+export declare function unwrapParentheses(node: ts.Expression): ts.Expression;\r
+export declare function formatPseudoBigInt(v: ts.PseudoBigInt): `${string}n` | `-${string}n`;\r
+/**\r
+ * Determines whether the given `SwitchStatement`'s `case` clauses cover every possible value of the switched expression.\r
+ * The logic is the same as TypeScript's control flow analysis.\r
+ * This does **not** check whether all `case` clauses do a certain action like assign a variable or return a value.\r
+ * This function ignores the `default` clause if present.\r
+ */\r
+export declare function hasExhaustiveCaseClauses(node: ts.SwitchStatement, checker: ts.TypeChecker): boolean;\r
+export declare function getBaseOfClassLikeExpression(node: ts.ClassLikeDeclaration): ts.ExpressionWithTypeArguments | undefined;\r