mirror of
				https://github.com/fooflington/selfdefined.git
				synced 2025-10-31 06:08:33 +00:00 
			
		
		
		
	update
This commit is contained in:
		
							
								
								
									
										8
									
								
								node_modules/tsutils/util/control-flow.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								node_modules/tsutils/util/control-flow.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| import * as ts from 'typescript'; | ||||
| export declare function endsControlFlow(statement: ts.Statement | ts.BlockLike): boolean; | ||||
| export declare type ControlFlowStatement = ts.BreakStatement | ts.ContinueStatement | ts.ReturnStatement | ts.ThrowStatement; | ||||
| export interface ControlFlowEnd { | ||||
|     readonly statements: ReadonlyArray<ControlFlowStatement>; | ||||
|     readonly end: boolean; | ||||
| } | ||||
| export declare function getControlFlowEnd(statement: ts.Statement | ts.BlockLike): ControlFlowEnd; | ||||
							
								
								
									
										171
									
								
								node_modules/tsutils/util/control-flow.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										171
									
								
								node_modules/tsutils/util/control-flow.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,171 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const ts = require("typescript"); | ||||
| const node_1 = require("../typeguard/node"); | ||||
| function endsControlFlow(statement) { | ||||
|     return getControlFlowEnd(statement).end; | ||||
| } | ||||
| exports.endsControlFlow = endsControlFlow; | ||||
| const defaultControlFlowEnd = { statements: [], end: false }; | ||||
| function getControlFlowEnd(statement) { | ||||
|     return node_1.isBlockLike(statement) ? handleBlock(statement) : getControlFlowEndWorker(statement); | ||||
| } | ||||
| exports.getControlFlowEnd = getControlFlowEnd; | ||||
| function getControlFlowEndWorker(statement) { | ||||
|     switch (statement.kind) { | ||||
|         case ts.SyntaxKind.ReturnStatement: | ||||
|         case ts.SyntaxKind.ThrowStatement: | ||||
|         case ts.SyntaxKind.ContinueStatement: | ||||
|         case ts.SyntaxKind.BreakStatement: | ||||
|             return { statements: [statement], end: true }; | ||||
|         case ts.SyntaxKind.Block: | ||||
|             return handleBlock(statement); | ||||
|         case ts.SyntaxKind.ForStatement: | ||||
|         case ts.SyntaxKind.WhileStatement: | ||||
|             return handleForAndWhileStatement(statement); | ||||
|         case ts.SyntaxKind.ForOfStatement: | ||||
|         case ts.SyntaxKind.ForInStatement: | ||||
|             return handleForInOrOfStatement(statement); | ||||
|         case ts.SyntaxKind.DoStatement: | ||||
|             return matchBreakOrContinue(getControlFlowEndWorker(statement.statement), node_1.isBreakOrContinueStatement); | ||||
|         case ts.SyntaxKind.IfStatement: | ||||
|             return handleIfStatement(statement); | ||||
|         case ts.SyntaxKind.SwitchStatement: | ||||
|             return matchBreakOrContinue(handleSwitchStatement(statement), node_1.isBreakStatement); | ||||
|         case ts.SyntaxKind.TryStatement: | ||||
|             return handleTryStatement(statement); | ||||
|         case ts.SyntaxKind.LabeledStatement: | ||||
|             return matchLabel(getControlFlowEndWorker(statement.statement), statement.label); | ||||
|         case ts.SyntaxKind.WithStatement: | ||||
|             return getControlFlowEndWorker(statement.statement); | ||||
|         default: | ||||
|             return defaultControlFlowEnd; | ||||
|     } | ||||
| } | ||||
| function handleBlock(statement) { | ||||
|     const result = { statements: [], end: false }; | ||||
|     for (const s of statement.statements) { | ||||
|         const current = getControlFlowEndWorker(s); | ||||
|         result.statements.push(...current.statements); | ||||
|         if (current.end) { | ||||
|             result.end = true; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
| function handleForInOrOfStatement(statement) { | ||||
|     const end = matchBreakOrContinue(getControlFlowEndWorker(statement.statement), node_1.isBreakOrContinueStatement); | ||||
|     end.end = false; | ||||
|     return end; | ||||
| } | ||||
| function handleForAndWhileStatement(statement) { | ||||
|     const constantCondition = statement.kind === ts.SyntaxKind.WhileStatement | ||||
|         ? getConstantCondition(statement.expression) | ||||
|         : statement.condition === undefined || getConstantCondition(statement.condition); | ||||
|     if (constantCondition === false) | ||||
|         return defaultControlFlowEnd; | ||||
|     const end = matchBreakOrContinue(getControlFlowEndWorker(statement.statement), node_1.isBreakOrContinueStatement); | ||||
|     if (constantCondition === undefined) | ||||
|         end.end = false; | ||||
|     return end; | ||||
| } | ||||
| function getConstantCondition(node) { | ||||
|     switch (node.kind) { | ||||
|         case ts.SyntaxKind.TrueKeyword: | ||||
|             return true; | ||||
|         case ts.SyntaxKind.FalseKeyword: | ||||
|             return false; | ||||
|         default: | ||||
|             return; | ||||
|     } | ||||
| } | ||||
| function handleIfStatement(node) { | ||||
|     switch (getConstantCondition(node.expression)) { | ||||
|         case true: | ||||
|             return getControlFlowEndWorker(node.thenStatement); | ||||
|         case false: | ||||
|             return node.elseStatement === undefined | ||||
|                 ? defaultControlFlowEnd | ||||
|                 : getControlFlowEndWorker(node.elseStatement); | ||||
|     } | ||||
|     const then = getControlFlowEndWorker(node.thenStatement); | ||||
|     if (node.elseStatement === undefined) | ||||
|         return { | ||||
|             statements: then.statements, | ||||
|             end: false, | ||||
|         }; | ||||
|     const elze = getControlFlowEndWorker(node.elseStatement); | ||||
|     return { | ||||
|         statements: [...then.statements, ...elze.statements], | ||||
|         end: then.end && elze.end, | ||||
|     }; | ||||
| } | ||||
| function handleSwitchStatement(node) { | ||||
|     let hasDefault = false; | ||||
|     const result = { | ||||
|         statements: [], | ||||
|         end: false, | ||||
|     }; | ||||
|     for (const clause of node.caseBlock.clauses) { | ||||
|         if (clause.kind === ts.SyntaxKind.DefaultClause) | ||||
|             hasDefault = true; | ||||
|         const current = handleBlock(clause); | ||||
|         result.end = current.end; | ||||
|         result.statements.push(...current.statements); | ||||
|     } | ||||
|     if (!hasDefault) | ||||
|         result.end = false; | ||||
|     return result; | ||||
| } | ||||
| function handleTryStatement(node) { | ||||
|     let finallyResult; | ||||
|     if (node.finallyBlock !== undefined) { | ||||
|         finallyResult = handleBlock(node.finallyBlock); | ||||
|         if (finallyResult.end) | ||||
|             return finallyResult; | ||||
|     } | ||||
|     const tryResult = handleBlock(node.tryBlock); | ||||
|     if (node.catchClause === undefined) | ||||
|         return { statements: finallyResult.statements.concat(tryResult.statements), end: tryResult.end }; | ||||
|     const catchResult = handleBlock(node.catchClause.block); | ||||
|     return { | ||||
|         statements: tryResult.statements | ||||
|             .filter((s) => s.kind !== ts.SyntaxKind.ThrowStatement) | ||||
|             .concat(catchResult.statements, finallyResult === undefined ? [] : finallyResult.statements), | ||||
|         end: tryResult.end && catchResult.end, | ||||
|     }; | ||||
| } | ||||
| function matchBreakOrContinue(current, pred) { | ||||
|     const result = { | ||||
|         statements: [], | ||||
|         end: current.end, | ||||
|     }; | ||||
|     for (const statement of current.statements) { | ||||
|         if (pred(statement) && statement.label === undefined) { | ||||
|             result.end = false; | ||||
|             continue; | ||||
|         } | ||||
|         result.statements.push(statement); | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
| function matchLabel(current, label) { | ||||
|     const result = { | ||||
|         statements: [], | ||||
|         end: current.end, | ||||
|     }; | ||||
|     const labelText = label.text; | ||||
|     for (const statement of current.statements) { | ||||
|         switch (statement.kind) { | ||||
|             case ts.SyntaxKind.BreakStatement: | ||||
|             case ts.SyntaxKind.ContinueStatement: | ||||
|                 if (statement.label !== undefined && statement.label.text === labelText) { | ||||
|                     result.end = false; | ||||
|                     continue; | ||||
|                 } | ||||
|         } | ||||
|         result.statements.push(statement); | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
							
								
								
									
										20
									
								
								node_modules/tsutils/util/convert-ast.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								node_modules/tsutils/util/convert-ast.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| import * as ts from 'typescript'; | ||||
| export interface NodeWrap { | ||||
|     node: ts.Node; | ||||
|     kind: ts.SyntaxKind; | ||||
|     children: NodeWrap[]; | ||||
|     next?: NodeWrap; | ||||
|     skip?: NodeWrap; | ||||
|     parent?: NodeWrap; | ||||
| } | ||||
| export interface WrappedAst extends NodeWrap { | ||||
|     node: ts.SourceFile; | ||||
|     next: NodeWrap; | ||||
|     skip: undefined; | ||||
|     parent: undefined; | ||||
| } | ||||
| export interface ConvertedAst { | ||||
|     wrapped: WrappedAst; | ||||
|     flat: ReadonlyArray<ts.Node>; | ||||
| } | ||||
| export declare function convertAst(sourceFile: ts.SourceFile): ConvertedAst; | ||||
							
								
								
									
										47
									
								
								node_modules/tsutils/util/convert-ast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								node_modules/tsutils/util/convert-ast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const ts = require("typescript"); | ||||
| const util_1 = require("./util"); | ||||
| function convertAst(sourceFile) { | ||||
|     const wrapped = { | ||||
|         node: sourceFile, | ||||
|         parent: undefined, | ||||
|         kind: ts.SyntaxKind.SourceFile, | ||||
|         children: [], | ||||
|         next: undefined, | ||||
|         skip: undefined, | ||||
|     }; | ||||
|     const flat = []; | ||||
|     let current = wrapped; | ||||
|     let previous = current; | ||||
|     ts.forEachChild(sourceFile, function wrap(node) { | ||||
|         flat.push(node); | ||||
|         const parent = current; | ||||
|         previous.next = current = { | ||||
|             node, | ||||
|             parent, | ||||
|             kind: node.kind, | ||||
|             children: [], | ||||
|             next: undefined, | ||||
|             skip: undefined, | ||||
|         }; | ||||
|         if (previous !== parent) | ||||
|             setSkip(previous, current); | ||||
|         previous = current; | ||||
|         parent.children.push(current); | ||||
|         if (util_1.isNodeKind(node.kind)) | ||||
|             ts.forEachChild(node, wrap); | ||||
|         current = parent; | ||||
|     }); | ||||
|     return { | ||||
|         wrapped, | ||||
|         flat, | ||||
|     }; | ||||
| } | ||||
| exports.convertAst = convertAst; | ||||
| function setSkip(node, skip) { | ||||
|     do { | ||||
|         node.skip = skip; | ||||
|         node = node.parent; | ||||
|     } while (node !== skip.parent); | ||||
| } | ||||
							
								
								
									
										5
									
								
								node_modules/tsutils/util/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/tsutils/util/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| export * from './util'; | ||||
| export * from './usage'; | ||||
| export * from './control-flow'; | ||||
| export * from './type'; | ||||
| export * from './convert-ast'; | ||||
							
								
								
									
										8
									
								
								node_modules/tsutils/util/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								node_modules/tsutils/util/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const tslib_1 = require("tslib"); | ||||
| tslib_1.__exportStar(require("./util"), exports); | ||||
| tslib_1.__exportStar(require("./usage"), exports); | ||||
| tslib_1.__exportStar(require("./control-flow"), exports); | ||||
| tslib_1.__exportStar(require("./type"), exports); | ||||
| tslib_1.__exportStar(require("./convert-ast"), exports); | ||||
							
								
								
									
										21
									
								
								node_modules/tsutils/util/type.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/tsutils/util/type.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| import * as ts from 'typescript'; | ||||
| import { PropertyName } from './util'; | ||||
| export declare function isEmptyObjectType(type: ts.Type): type is ts.ObjectType; | ||||
| export declare function removeOptionalityFromType(checker: ts.TypeChecker, type: ts.Type): ts.Type; | ||||
| export declare function isTypeAssignableToNumber(checker: ts.TypeChecker, type: ts.Type): boolean; | ||||
| export declare function isTypeAssignableToString(checker: ts.TypeChecker, type: ts.Type): boolean; | ||||
| export declare function getCallSignaturesOfType(type: ts.Type): ReadonlyArray<ts.Signature>; | ||||
| export declare function unionTypeParts(type: ts.Type): ts.Type[]; | ||||
| export declare function intersectionTypeParts(type: ts.Type): ts.Type[]; | ||||
| export declare function someTypePart(type: ts.Type, predicate: (t: ts.Type) => t is ts.UnionOrIntersectionType, cb: (t: ts.Type) => boolean): boolean; | ||||
| export declare function isThenableType(checker: ts.TypeChecker, node: ts.Node, type: ts.Type): boolean; | ||||
| export declare function isThenableType(checker: ts.TypeChecker, node: ts.Expression, type?: ts.Type): boolean; | ||||
| export declare function isFalsyType(type: ts.Type): boolean; | ||||
| export declare function isBooleanLiteralType(type: ts.Type, literal: boolean): boolean; | ||||
| export declare function getPropertyOfType(type: ts.Type, name: ts.__String): ts.Symbol | undefined; | ||||
| export declare function isPropertyReadonlyInType(type: ts.Type, name: ts.__String, checker: ts.TypeChecker): boolean; | ||||
| export declare function symbolHasReadonlyDeclaration(symbol: ts.Symbol, checker: ts.TypeChecker): boolean; | ||||
| export declare function getPropertyNameFromType(type: ts.Type): PropertyName | undefined; | ||||
| export declare function getConstructorTypeOfClassLikeDeclaration(node: ts.ClassLikeDeclaration, checker: ts.TypeChecker): ts.Type; | ||||
| export declare function getInstanceTypeOfClassLikeDeclaration(node: ts.ClassLikeDeclaration, checker: ts.TypeChecker): ts.Type; | ||||
| export declare function getIteratorYieldResultFromIteratorResult(type: ts.Type, node: ts.Node, checker: ts.TypeChecker): ts.Type; | ||||
							
								
								
									
										238
									
								
								node_modules/tsutils/util/type.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										238
									
								
								node_modules/tsutils/util/type.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,238 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const ts = require("typescript"); | ||||
| const type_1 = require("../typeguard/type"); | ||||
| const util_1 = require("./util"); | ||||
| const node_1 = require("../typeguard/node"); | ||||
| function isEmptyObjectType(type) { | ||||
|     if (type_1.isObjectType(type) && | ||||
|         type.objectFlags & ts.ObjectFlags.Anonymous && | ||||
|         type.getProperties().length === 0 && | ||||
|         type.getCallSignatures().length === 0 && | ||||
|         type.getConstructSignatures().length === 0 && | ||||
|         type.getStringIndexType() === undefined && | ||||
|         type.getNumberIndexType() === undefined) { | ||||
|         const baseTypes = type.getBaseTypes(); | ||||
|         return baseTypes === undefined || baseTypes.every(isEmptyObjectType); | ||||
|     } | ||||
|     return false; | ||||
| } | ||||
| exports.isEmptyObjectType = isEmptyObjectType; | ||||
| function removeOptionalityFromType(checker, type) { | ||||
|     if (!containsTypeWithFlag(type, ts.TypeFlags.Undefined)) | ||||
|         return type; | ||||
|     const allowsNull = containsTypeWithFlag(type, ts.TypeFlags.Null); | ||||
|     type = checker.getNonNullableType(type); | ||||
|     return allowsNull ? checker.getNullableType(type, ts.TypeFlags.Null) : type; | ||||
| } | ||||
| exports.removeOptionalityFromType = removeOptionalityFromType; | ||||
| function containsTypeWithFlag(type, flag) { | ||||
|     for (const t of unionTypeParts(type)) | ||||
|         if (util_1.isTypeFlagSet(t, flag)) | ||||
|             return true; | ||||
|     return false; | ||||
| } | ||||
| function isTypeAssignableToNumber(checker, type) { | ||||
|     return isTypeAssignableTo(checker, type, ts.TypeFlags.NumberLike); | ||||
| } | ||||
| exports.isTypeAssignableToNumber = isTypeAssignableToNumber; | ||||
| function isTypeAssignableToString(checker, type) { | ||||
|     return isTypeAssignableTo(checker, type, ts.TypeFlags.StringLike); | ||||
| } | ||||
| exports.isTypeAssignableToString = isTypeAssignableToString; | ||||
| function isTypeAssignableTo(checker, type, flags) { | ||||
|     flags |= ts.TypeFlags.Any; | ||||
|     let typeParametersSeen; | ||||
|     return (function check(t) { | ||||
|         if (type_1.isTypeParameter(t) && t.symbol !== undefined && t.symbol.declarations !== undefined) { | ||||
|             if (typeParametersSeen === undefined) { | ||||
|                 typeParametersSeen = new Set([t]); | ||||
|             } | ||||
|             else if (!typeParametersSeen.has(t)) { | ||||
|                 typeParametersSeen.add(t); | ||||
|             } | ||||
|             else { | ||||
|                 return false; | ||||
|             } | ||||
|             const declaration = t.symbol.declarations[0]; | ||||
|             if (declaration.constraint === undefined) | ||||
|                 return true; | ||||
|             return check(checker.getTypeFromTypeNode(declaration.constraint)); | ||||
|         } | ||||
|         if (type_1.isUnionType(t)) | ||||
|             return t.types.every(check); | ||||
|         if (type_1.isIntersectionType(t)) | ||||
|             return t.types.some(check); | ||||
|         return util_1.isTypeFlagSet(t, flags); | ||||
|     })(type); | ||||
| } | ||||
| function getCallSignaturesOfType(type) { | ||||
|     if (type_1.isUnionType(type)) { | ||||
|         const signatures = []; | ||||
|         for (const t of type.types) | ||||
|             signatures.push(...getCallSignaturesOfType(t)); | ||||
|         return signatures; | ||||
|     } | ||||
|     if (type_1.isIntersectionType(type)) { | ||||
|         let signatures; | ||||
|         for (const t of type.types) { | ||||
|             const sig = getCallSignaturesOfType(t); | ||||
|             if (sig.length !== 0) { | ||||
|                 if (signatures !== undefined) | ||||
|                     return []; | ||||
|                 signatures = sig; | ||||
|             } | ||||
|         } | ||||
|         return signatures === undefined ? [] : signatures; | ||||
|     } | ||||
|     return type.getCallSignatures(); | ||||
| } | ||||
| exports.getCallSignaturesOfType = getCallSignaturesOfType; | ||||
| function unionTypeParts(type) { | ||||
|     return type_1.isUnionType(type) ? type.types : [type]; | ||||
| } | ||||
| exports.unionTypeParts = unionTypeParts; | ||||
| function intersectionTypeParts(type) { | ||||
|     return type_1.isIntersectionType(type) ? type.types : [type]; | ||||
| } | ||||
| exports.intersectionTypeParts = intersectionTypeParts; | ||||
| function someTypePart(type, predicate, cb) { | ||||
|     return predicate(type) ? type.types.some(cb) : cb(type); | ||||
| } | ||||
| exports.someTypePart = someTypePart; | ||||
| function isThenableType(checker, node, type = checker.getTypeAtLocation(node)) { | ||||
|     for (const ty of unionTypeParts(checker.getApparentType(type))) { | ||||
|         const then = ty.getProperty('then'); | ||||
|         if (then === undefined) | ||||
|             continue; | ||||
|         const thenType = checker.getTypeOfSymbolAtLocation(then, node); | ||||
|         for (const t of unionTypeParts(thenType)) | ||||
|             for (const signature of t.getCallSignatures()) | ||||
|                 if (signature.parameters.length !== 0 && isCallback(checker, signature.parameters[0], node)) | ||||
|                     return true; | ||||
|     } | ||||
|     return false; | ||||
| } | ||||
| exports.isThenableType = isThenableType; | ||||
| function isCallback(checker, param, node) { | ||||
|     let type = checker.getApparentType(checker.getTypeOfSymbolAtLocation(param, node)); | ||||
|     if (param.valueDeclaration.dotDotDotToken) { | ||||
|         type = type.getNumberIndexType(); | ||||
|         if (type === undefined) | ||||
|             return false; | ||||
|     } | ||||
|     for (const t of unionTypeParts(type)) | ||||
|         if (t.getCallSignatures().length !== 0) | ||||
|             return true; | ||||
|     return false; | ||||
| } | ||||
| function isFalsyType(type) { | ||||
|     if (type.flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Null | ts.TypeFlags.Void)) | ||||
|         return true; | ||||
|     if (type_1.isLiteralType(type)) | ||||
|         return !type.value; | ||||
|     return isBooleanLiteralType(type, false); | ||||
| } | ||||
| exports.isFalsyType = isFalsyType; | ||||
| function isBooleanLiteralType(type, literal) { | ||||
|     return util_1.isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral) && | ||||
|         type.intrinsicName === (literal ? 'true' : 'false'); | ||||
| } | ||||
| exports.isBooleanLiteralType = isBooleanLiteralType; | ||||
| function getPropertyOfType(type, name) { | ||||
|     if (!name.startsWith('__')) | ||||
|         return type.getProperty(name); | ||||
|     return type.getProperties().find((s) => s.escapedName === name); | ||||
| } | ||||
| exports.getPropertyOfType = getPropertyOfType; | ||||
| function isPropertyReadonlyInType(type, name, checker) { | ||||
|     let seenProperty = false; | ||||
|     let seenReadonlySignature = false; | ||||
|     for (const t of unionTypeParts(type)) { | ||||
|         if (getPropertyOfType(t, name) === undefined) { | ||||
|             const index = (util_1.isNumericPropertyName(name) ? checker.getIndexInfoOfType(t, ts.IndexKind.Number) : undefined) || | ||||
|                 checker.getIndexInfoOfType(t, ts.IndexKind.String); | ||||
|             if (index !== undefined && index.isReadonly) { | ||||
|                 if (seenProperty) | ||||
|                     return true; | ||||
|                 seenReadonlySignature = true; | ||||
|             } | ||||
|         } | ||||
|         else if (seenReadonlySignature || isReadonlyPropertyIntersection(t, name, checker)) { | ||||
|             return true; | ||||
|         } | ||||
|         else { | ||||
|             seenProperty = true; | ||||
|         } | ||||
|     } | ||||
|     return false; | ||||
| } | ||||
| exports.isPropertyReadonlyInType = isPropertyReadonlyInType; | ||||
| function isReadonlyPropertyIntersection(type, name, checker) { | ||||
|     return someTypePart(type, type_1.isIntersectionType, (t) => { | ||||
|         const prop = getPropertyOfType(t, name); | ||||
|         if (prop === undefined) | ||||
|             return false; | ||||
|         if (prop.flags & ts.SymbolFlags.Transient) { | ||||
|             if (/^(?:[1-9]\d*|0)$/.test(name) && type_1.isTupleTypeReference(t)) | ||||
|                 return t.target.readonly; | ||||
|             switch (isReadonlyPropertyFromMappedType(t, name, checker)) { | ||||
|                 case true: | ||||
|                     return true; | ||||
|                 case false: | ||||
|                     return false; | ||||
|                 default: | ||||
|             } | ||||
|         } | ||||
|         return (util_1.isSymbolFlagSet(prop, ts.SymbolFlags.ValueModule) || | ||||
|             symbolHasReadonlyDeclaration(prop, checker)); | ||||
|     }); | ||||
| } | ||||
| function isReadonlyPropertyFromMappedType(type, name, checker) { | ||||
|     if (!type_1.isObjectType(type) || !util_1.isObjectFlagSet(type, ts.ObjectFlags.Mapped)) | ||||
|         return; | ||||
|     const declaration = type.symbol.declarations[0]; | ||||
|     if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) | ||||
|         return declaration.readonlyToken.kind !== ts.SyntaxKind.MinusToken; | ||||
|     return isPropertyReadonlyInType(type.modifiersType, name, checker); | ||||
| } | ||||
| function symbolHasReadonlyDeclaration(symbol, checker) { | ||||
|     return (symbol.flags & ts.SymbolFlags.Accessor) === ts.SymbolFlags.GetAccessor || | ||||
|         symbol.declarations !== undefined && | ||||
|             symbol.declarations.some((node) => util_1.isModifierFlagSet(node, ts.ModifierFlags.Readonly) || | ||||
|                 node_1.isVariableDeclaration(node) && util_1.isNodeFlagSet(node.parent, ts.NodeFlags.Const) || | ||||
|                 node_1.isCallExpression(node) && util_1.isReadonlyAssignmentDeclaration(node, checker) || | ||||
|                 node_1.isEnumMember(node) || | ||||
|                 (node_1.isPropertyAssignment(node) || node_1.isShorthandPropertyAssignment(node)) && util_1.isInConstContext(node.parent)); | ||||
| } | ||||
| exports.symbolHasReadonlyDeclaration = symbolHasReadonlyDeclaration; | ||||
| function getPropertyNameFromType(type) { | ||||
|     if (type.flags & (ts.TypeFlags.StringLiteral | ts.TypeFlags.NumberLiteral)) { | ||||
|         const value = String(type.value); | ||||
|         return { displayName: value, symbolName: ts.escapeLeadingUnderscores(value) }; | ||||
|     } | ||||
|     if (type_1.isUniqueESSymbolType(type)) | ||||
|         return { | ||||
|             displayName: `[${type.symbol ? type.symbol.name : type.escapedName.replace(/^__@|@\d+$/g, '')}]`, | ||||
|             symbolName: type.escapedName, | ||||
|         }; | ||||
| } | ||||
| exports.getPropertyNameFromType = getPropertyNameFromType; | ||||
| function getConstructorTypeOfClassLikeDeclaration(node, checker) { | ||||
|     return checker.getDeclaredTypeOfSymbol(node.name !== undefined ? checker.getSymbolAtLocation(node.name) : checker.getTypeAtLocation(node).symbol); | ||||
| } | ||||
| exports.getConstructorTypeOfClassLikeDeclaration = getConstructorTypeOfClassLikeDeclaration; | ||||
| function getInstanceTypeOfClassLikeDeclaration(node, checker) { | ||||
|     return node.kind === ts.SyntaxKind.ClassDeclaration | ||||
|         ? checker.getTypeAtLocation(node) | ||||
|         : checker.getTypeOfSymbolAtLocation(checker.getTypeAtLocation(node).getProperty('prototype'), node); | ||||
| } | ||||
| exports.getInstanceTypeOfClassLikeDeclaration = getInstanceTypeOfClassLikeDeclaration; | ||||
| function getIteratorYieldResultFromIteratorResult(type, node, checker) { | ||||
|     return type_1.isUnionType(type) && type.types.find((t) => { | ||||
|         const done = t.getProperty('done'); | ||||
|         return done !== undefined && | ||||
|             isBooleanLiteralType(removeOptionalityFromType(checker, checker.getTypeOfSymbolAtLocation(done, node)), false); | ||||
|     }) || type; | ||||
| } | ||||
| exports.getIteratorYieldResultFromIteratorResult = getIteratorYieldResultFromIteratorResult; | ||||
							
								
								
									
										30
									
								
								node_modules/tsutils/util/usage.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/tsutils/util/usage.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| import * as ts from 'typescript'; | ||||
| export interface VariableInfo { | ||||
|     domain: DeclarationDomain; | ||||
|     exported: boolean; | ||||
|     uses: VariableUse[]; | ||||
|     inGlobalScope: boolean; | ||||
|     declarations: ts.Identifier[]; | ||||
| } | ||||
| export interface VariableUse { | ||||
|     domain: UsageDomain; | ||||
|     location: ts.Identifier; | ||||
| } | ||||
| export declare enum DeclarationDomain { | ||||
|     Namespace = 1, | ||||
|     Type = 2, | ||||
|     Value = 4, | ||||
|     Import = 8, | ||||
|     Any = 7 | ||||
| } | ||||
| export declare enum UsageDomain { | ||||
|     Namespace = 1, | ||||
|     Type = 2, | ||||
|     Value = 4, | ||||
|     ValueOrNamespace = 5, | ||||
|     Any = 7, | ||||
|     TypeQuery = 8 | ||||
| } | ||||
| export declare function getUsageDomain(node: ts.Identifier): UsageDomain | undefined; | ||||
| export declare function getDeclarationDomain(node: ts.Identifier): DeclarationDomain | undefined; | ||||
| export declare function collectVariableUsage(sourceFile: ts.SourceFile): Map<ts.Identifier, VariableInfo>; | ||||
							
								
								
									
										645
									
								
								node_modules/tsutils/util/usage.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										645
									
								
								node_modules/tsutils/util/usage.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,645 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const util_1 = require("./util"); | ||||
| const ts = require("typescript"); | ||||
| var DeclarationDomain; | ||||
| (function (DeclarationDomain) { | ||||
|     DeclarationDomain[DeclarationDomain["Namespace"] = 1] = "Namespace"; | ||||
|     DeclarationDomain[DeclarationDomain["Type"] = 2] = "Type"; | ||||
|     DeclarationDomain[DeclarationDomain["Value"] = 4] = "Value"; | ||||
|     DeclarationDomain[DeclarationDomain["Import"] = 8] = "Import"; | ||||
|     DeclarationDomain[DeclarationDomain["Any"] = 7] = "Any"; | ||||
| })(DeclarationDomain = exports.DeclarationDomain || (exports.DeclarationDomain = {})); | ||||
| var UsageDomain; | ||||
| (function (UsageDomain) { | ||||
|     UsageDomain[UsageDomain["Namespace"] = 1] = "Namespace"; | ||||
|     UsageDomain[UsageDomain["Type"] = 2] = "Type"; | ||||
|     UsageDomain[UsageDomain["Value"] = 4] = "Value"; | ||||
|     UsageDomain[UsageDomain["ValueOrNamespace"] = 5] = "ValueOrNamespace"; | ||||
|     UsageDomain[UsageDomain["Any"] = 7] = "Any"; | ||||
|     UsageDomain[UsageDomain["TypeQuery"] = 8] = "TypeQuery"; | ||||
| })(UsageDomain = exports.UsageDomain || (exports.UsageDomain = {})); | ||||
| function getUsageDomain(node) { | ||||
|     const parent = node.parent; | ||||
|     switch (parent.kind) { | ||||
|         case ts.SyntaxKind.TypeReference: | ||||
|             return node.originalKeywordKind !== ts.SyntaxKind.ConstKeyword ? 2 : undefined; | ||||
|         case ts.SyntaxKind.ExpressionWithTypeArguments: | ||||
|             return parent.parent.token === ts.SyntaxKind.ImplementsKeyword || | ||||
|                 parent.parent.parent.kind === ts.SyntaxKind.InterfaceDeclaration | ||||
|                 ? 2 | ||||
|                 : 4; | ||||
|         case ts.SyntaxKind.TypeQuery: | ||||
|             return 5 | 8; | ||||
|         case ts.SyntaxKind.QualifiedName: | ||||
|             if (parent.left === node) { | ||||
|                 if (getEntityNameParent(parent).kind === ts.SyntaxKind.TypeQuery) | ||||
|                     return 1 | 8; | ||||
|                 return 1; | ||||
|             } | ||||
|             break; | ||||
|         case ts.SyntaxKind.ExportSpecifier: | ||||
|             if (parent.propertyName === undefined || | ||||
|                 parent.propertyName === node) | ||||
|                 return 7; | ||||
|             break; | ||||
|         case ts.SyntaxKind.ExportAssignment: | ||||
|             return 7; | ||||
|         case ts.SyntaxKind.BindingElement: | ||||
|             if (parent.initializer === node) | ||||
|                 return 5; | ||||
|             break; | ||||
|         case ts.SyntaxKind.Parameter: | ||||
|         case ts.SyntaxKind.EnumMember: | ||||
|         case ts.SyntaxKind.PropertyDeclaration: | ||||
|         case ts.SyntaxKind.VariableDeclaration: | ||||
|         case ts.SyntaxKind.PropertyAssignment: | ||||
|         case ts.SyntaxKind.PropertyAccessExpression: | ||||
|         case ts.SyntaxKind.ImportEqualsDeclaration: | ||||
|             if (parent.name !== node) | ||||
|                 return 5; | ||||
|             break; | ||||
|         case ts.SyntaxKind.JsxAttribute: | ||||
|         case ts.SyntaxKind.FunctionDeclaration: | ||||
|         case ts.SyntaxKind.FunctionExpression: | ||||
|         case ts.SyntaxKind.NamespaceImport: | ||||
|         case ts.SyntaxKind.ClassDeclaration: | ||||
|         case ts.SyntaxKind.ClassExpression: | ||||
|         case ts.SyntaxKind.ModuleDeclaration: | ||||
|         case ts.SyntaxKind.MethodDeclaration: | ||||
|         case ts.SyntaxKind.EnumDeclaration: | ||||
|         case ts.SyntaxKind.GetAccessor: | ||||
|         case ts.SyntaxKind.SetAccessor: | ||||
|         case ts.SyntaxKind.LabeledStatement: | ||||
|         case ts.SyntaxKind.BreakStatement: | ||||
|         case ts.SyntaxKind.ContinueStatement: | ||||
|         case ts.SyntaxKind.ImportClause: | ||||
|         case ts.SyntaxKind.ImportSpecifier: | ||||
|         case ts.SyntaxKind.TypePredicate: | ||||
|         case ts.SyntaxKind.MethodSignature: | ||||
|         case ts.SyntaxKind.PropertySignature: | ||||
|         case ts.SyntaxKind.NamespaceExportDeclaration: | ||||
|         case ts.SyntaxKind.InterfaceDeclaration: | ||||
|         case ts.SyntaxKind.TypeAliasDeclaration: | ||||
|         case ts.SyntaxKind.TypeParameter: | ||||
|             break; | ||||
|         default: | ||||
|             return 5; | ||||
|     } | ||||
| } | ||||
| exports.getUsageDomain = getUsageDomain; | ||||
| function getDeclarationDomain(node) { | ||||
|     switch (node.parent.kind) { | ||||
|         case ts.SyntaxKind.TypeParameter: | ||||
|         case ts.SyntaxKind.InterfaceDeclaration: | ||||
|         case ts.SyntaxKind.TypeAliasDeclaration: | ||||
|             return 2; | ||||
|         case ts.SyntaxKind.ClassDeclaration: | ||||
|         case ts.SyntaxKind.ClassExpression: | ||||
|             return 2 | 4; | ||||
|         case ts.SyntaxKind.EnumDeclaration: | ||||
|             return 7; | ||||
|         case ts.SyntaxKind.NamespaceImport: | ||||
|         case ts.SyntaxKind.ImportClause: | ||||
|             return 7 | 8; | ||||
|         case ts.SyntaxKind.ImportEqualsDeclaration: | ||||
|         case ts.SyntaxKind.ImportSpecifier: | ||||
|             return node.parent.name === node | ||||
|                 ? 7 | 8 | ||||
|                 : undefined; | ||||
|         case ts.SyntaxKind.ModuleDeclaration: | ||||
|             return 1; | ||||
|         case ts.SyntaxKind.Parameter: | ||||
|             if (node.parent.parent.kind === ts.SyntaxKind.IndexSignature || node.originalKeywordKind === ts.SyntaxKind.ThisKeyword) | ||||
|                 return; | ||||
|         case ts.SyntaxKind.BindingElement: | ||||
|         case ts.SyntaxKind.VariableDeclaration: | ||||
|             return node.parent.name === node ? 4 : undefined; | ||||
|         case ts.SyntaxKind.FunctionDeclaration: | ||||
|         case ts.SyntaxKind.FunctionExpression: | ||||
|             return 4; | ||||
|     } | ||||
| } | ||||
| exports.getDeclarationDomain = getDeclarationDomain; | ||||
| function collectVariableUsage(sourceFile) { | ||||
|     return new UsageWalker().getUsage(sourceFile); | ||||
| } | ||||
| exports.collectVariableUsage = collectVariableUsage; | ||||
| class AbstractScope { | ||||
|     constructor(_global) { | ||||
|         this._global = _global; | ||||
|         this._variables = new Map(); | ||||
|         this._uses = []; | ||||
|         this._namespaceScopes = undefined; | ||||
|         this._enumScopes = undefined; | ||||
|     } | ||||
|     addVariable(identifier, name, selector, exported, domain) { | ||||
|         const variables = this.getDestinationScope(selector).getVariables(); | ||||
|         const declaration = { | ||||
|             domain, | ||||
|             exported, | ||||
|             declaration: name, | ||||
|         }; | ||||
|         const variable = variables.get(identifier); | ||||
|         if (variable === undefined) { | ||||
|             variables.set(identifier, { | ||||
|                 domain, | ||||
|                 declarations: [declaration], | ||||
|                 uses: [], | ||||
|             }); | ||||
|         } | ||||
|         else { | ||||
|             variable.domain |= domain; | ||||
|             variable.declarations.push(declaration); | ||||
|         } | ||||
|     } | ||||
|     addUse(use) { | ||||
|         this._uses.push(use); | ||||
|     } | ||||
|     getVariables() { | ||||
|         return this._variables; | ||||
|     } | ||||
|     getFunctionScope() { | ||||
|         return this; | ||||
|     } | ||||
|     end(cb) { | ||||
|         if (this._namespaceScopes !== undefined) | ||||
|             this._namespaceScopes.forEach((value) => value.finish(cb)); | ||||
|         this._namespaceScopes = this._enumScopes = undefined; | ||||
|         this._applyUses(); | ||||
|         this._variables.forEach((variable) => { | ||||
|             for (const declaration of variable.declarations) { | ||||
|                 const result = { | ||||
|                     declarations: [], | ||||
|                     domain: declaration.domain, | ||||
|                     exported: declaration.exported, | ||||
|                     inGlobalScope: this._global, | ||||
|                     uses: [], | ||||
|                 }; | ||||
|                 for (const other of variable.declarations) | ||||
|                     if (other.domain & declaration.domain) | ||||
|                         result.declarations.push(other.declaration); | ||||
|                 for (const use of variable.uses) | ||||
|                     if (use.domain & declaration.domain) | ||||
|                         result.uses.push(use); | ||||
|                 cb(result, declaration.declaration, this); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|     markExported(_name) { } | ||||
|     createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) { | ||||
|         let scope; | ||||
|         if (this._namespaceScopes === undefined) { | ||||
|             this._namespaceScopes = new Map(); | ||||
|         } | ||||
|         else { | ||||
|             scope = this._namespaceScopes.get(name); | ||||
|         } | ||||
|         if (scope === undefined) { | ||||
|             scope = new NamespaceScope(ambient, hasExportStatement, this); | ||||
|             this._namespaceScopes.set(name, scope); | ||||
|         } | ||||
|         else { | ||||
|             scope.refresh(ambient, hasExportStatement); | ||||
|         } | ||||
|         return scope; | ||||
|     } | ||||
|     createOrReuseEnumScope(name, _exported) { | ||||
|         let scope; | ||||
|         if (this._enumScopes === undefined) { | ||||
|             this._enumScopes = new Map(); | ||||
|         } | ||||
|         else { | ||||
|             scope = this._enumScopes.get(name); | ||||
|         } | ||||
|         if (scope === undefined) { | ||||
|             scope = new EnumScope(this); | ||||
|             this._enumScopes.set(name, scope); | ||||
|         } | ||||
|         return scope; | ||||
|     } | ||||
|     _applyUses() { | ||||
|         for (const use of this._uses) | ||||
|             if (!this._applyUse(use)) | ||||
|                 this._addUseToParent(use); | ||||
|         this._uses = []; | ||||
|     } | ||||
|     _applyUse(use, variables = this._variables) { | ||||
|         const variable = variables.get(use.location.text); | ||||
|         if (variable === undefined || (variable.domain & use.domain) === 0) | ||||
|             return false; | ||||
|         variable.uses.push(use); | ||||
|         return true; | ||||
|     } | ||||
|     _addUseToParent(_use) { } | ||||
| } | ||||
| class RootScope extends AbstractScope { | ||||
|     constructor(_exportAll, global) { | ||||
|         super(global); | ||||
|         this._exportAll = _exportAll; | ||||
|         this._exports = undefined; | ||||
|         this._innerScope = new NonRootScope(this, 1); | ||||
|     } | ||||
|     addVariable(identifier, name, selector, exported, domain) { | ||||
|         if (domain & 8) | ||||
|             return super.addVariable(identifier, name, selector, exported, domain); | ||||
|         return this._innerScope.addVariable(identifier, name, selector, exported, domain); | ||||
|     } | ||||
|     addUse(use, origin) { | ||||
|         if (origin === this._innerScope) | ||||
|             return super.addUse(use); | ||||
|         return this._innerScope.addUse(use); | ||||
|     } | ||||
|     markExported(id) { | ||||
|         if (this._exports === undefined) { | ||||
|             this._exports = [id.text]; | ||||
|         } | ||||
|         else { | ||||
|             this._exports.push(id.text); | ||||
|         } | ||||
|     } | ||||
|     end(cb) { | ||||
|         this._innerScope.end((value, key) => { | ||||
|             value.exported = value.exported || this._exportAll | ||||
|                 || this._exports !== undefined && this._exports.includes(key.text); | ||||
|             value.inGlobalScope = this._global; | ||||
|             return cb(value, key, this); | ||||
|         }); | ||||
|         return super.end((value, key, scope) => { | ||||
|             value.exported = value.exported || scope === this | ||||
|                 && this._exports !== undefined && this._exports.includes(key.text); | ||||
|             return cb(value, key, scope); | ||||
|         }); | ||||
|     } | ||||
|     getDestinationScope() { | ||||
|         return this; | ||||
|     } | ||||
| } | ||||
| class NonRootScope extends AbstractScope { | ||||
|     constructor(_parent, _boundary) { | ||||
|         super(false); | ||||
|         this._parent = _parent; | ||||
|         this._boundary = _boundary; | ||||
|     } | ||||
|     _addUseToParent(use) { | ||||
|         return this._parent.addUse(use, this); | ||||
|     } | ||||
|     getDestinationScope(selector) { | ||||
|         return this._boundary & selector | ||||
|             ? this | ||||
|             : this._parent.getDestinationScope(selector); | ||||
|     } | ||||
| } | ||||
| class EnumScope extends NonRootScope { | ||||
|     constructor(parent) { | ||||
|         super(parent, 1); | ||||
|     } | ||||
|     end() { | ||||
|         this._applyUses(); | ||||
|     } | ||||
| } | ||||
| class ConditionalTypeScope extends NonRootScope { | ||||
|     constructor(parent) { | ||||
|         super(parent, 8); | ||||
|         this._state = 0; | ||||
|     } | ||||
|     updateState(newState) { | ||||
|         this._state = newState; | ||||
|     } | ||||
|     addUse(use) { | ||||
|         if (this._state === 2) | ||||
|             return void this._uses.push(use); | ||||
|         return this._parent.addUse(use, this); | ||||
|     } | ||||
| } | ||||
| class FunctionScope extends NonRootScope { | ||||
|     constructor(parent) { | ||||
|         super(parent, 1); | ||||
|     } | ||||
|     beginBody() { | ||||
|         this._applyUses(); | ||||
|     } | ||||
| } | ||||
| class AbstractNamedExpressionScope extends NonRootScope { | ||||
|     constructor(_name, _domain, parent) { | ||||
|         super(parent, 1); | ||||
|         this._name = _name; | ||||
|         this._domain = _domain; | ||||
|     } | ||||
|     end(cb) { | ||||
|         this._innerScope.end(cb); | ||||
|         return cb({ | ||||
|             declarations: [this._name], | ||||
|             domain: this._domain, | ||||
|             exported: false, | ||||
|             uses: this._uses, | ||||
|             inGlobalScope: false, | ||||
|         }, this._name, this); | ||||
|     } | ||||
|     addUse(use, source) { | ||||
|         if (source !== this._innerScope) | ||||
|             return this._innerScope.addUse(use); | ||||
|         if (use.domain & this._domain && use.location.text === this._name.text) { | ||||
|             this._uses.push(use); | ||||
|         } | ||||
|         else { | ||||
|             return this._parent.addUse(use, this); | ||||
|         } | ||||
|     } | ||||
|     getFunctionScope() { | ||||
|         return this._innerScope; | ||||
|     } | ||||
|     getDestinationScope() { | ||||
|         return this._innerScope; | ||||
|     } | ||||
| } | ||||
| class FunctionExpressionScope extends AbstractNamedExpressionScope { | ||||
|     constructor(name, parent) { | ||||
|         super(name, 4, parent); | ||||
|         this._innerScope = new FunctionScope(this); | ||||
|     } | ||||
|     beginBody() { | ||||
|         return this._innerScope.beginBody(); | ||||
|     } | ||||
| } | ||||
| class ClassExpressionScope extends AbstractNamedExpressionScope { | ||||
|     constructor(name, parent) { | ||||
|         super(name, 4 | 2, parent); | ||||
|         this._innerScope = new NonRootScope(this, 1); | ||||
|     } | ||||
| } | ||||
| class BlockScope extends NonRootScope { | ||||
|     constructor(_functionScope, parent) { | ||||
|         super(parent, 2); | ||||
|         this._functionScope = _functionScope; | ||||
|     } | ||||
|     getFunctionScope() { | ||||
|         return this._functionScope; | ||||
|     } | ||||
| } | ||||
| function mapDeclaration(declaration) { | ||||
|     return { | ||||
|         declaration, | ||||
|         exported: true, | ||||
|         domain: getDeclarationDomain(declaration), | ||||
|     }; | ||||
| } | ||||
| class NamespaceScope extends NonRootScope { | ||||
|     constructor(_ambient, _hasExport, parent) { | ||||
|         super(parent, 1); | ||||
|         this._ambient = _ambient; | ||||
|         this._hasExport = _hasExport; | ||||
|         this._innerScope = new NonRootScope(this, 1); | ||||
|         this._exports = undefined; | ||||
|     } | ||||
|     finish(cb) { | ||||
|         return super.end(cb); | ||||
|     } | ||||
|     end(cb) { | ||||
|         this._innerScope.end((variable, key, scope) => { | ||||
|             if (scope !== this._innerScope || | ||||
|                 !variable.exported && (!this._ambient || this._exports !== undefined && !this._exports.has(key.text))) | ||||
|                 return cb(variable, key, scope); | ||||
|             const namespaceVar = this._variables.get(key.text); | ||||
|             if (namespaceVar === undefined) { | ||||
|                 this._variables.set(key.text, { | ||||
|                     declarations: variable.declarations.map(mapDeclaration), | ||||
|                     domain: variable.domain, | ||||
|                     uses: [...variable.uses], | ||||
|                 }); | ||||
|             } | ||||
|             else { | ||||
|                 outer: for (const declaration of variable.declarations) { | ||||
|                     for (const existing of namespaceVar.declarations) | ||||
|                         if (existing.declaration === declaration) | ||||
|                             continue outer; | ||||
|                     namespaceVar.declarations.push(mapDeclaration(declaration)); | ||||
|                 } | ||||
|                 namespaceVar.domain |= variable.domain; | ||||
|                 for (const use of variable.uses) { | ||||
|                     if (namespaceVar.uses.includes(use)) | ||||
|                         continue; | ||||
|                     namespaceVar.uses.push(use); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|         this._applyUses(); | ||||
|         this._innerScope = new NonRootScope(this, 1); | ||||
|     } | ||||
|     createOrReuseNamespaceScope(name, exported, ambient, hasExportStatement) { | ||||
|         if (!exported && (!this._ambient || this._hasExport)) | ||||
|             return this._innerScope.createOrReuseNamespaceScope(name, exported, ambient || this._ambient, hasExportStatement); | ||||
|         return super.createOrReuseNamespaceScope(name, exported, ambient || this._ambient, hasExportStatement); | ||||
|     } | ||||
|     createOrReuseEnumScope(name, exported) { | ||||
|         if (!exported && (!this._ambient || this._hasExport)) | ||||
|             return this._innerScope.createOrReuseEnumScope(name, exported); | ||||
|         return super.createOrReuseEnumScope(name, exported); | ||||
|     } | ||||
|     addUse(use, source) { | ||||
|         if (source !== this._innerScope) | ||||
|             return this._innerScope.addUse(use); | ||||
|         this._uses.push(use); | ||||
|     } | ||||
|     refresh(ambient, hasExport) { | ||||
|         this._ambient = ambient; | ||||
|         this._hasExport = hasExport; | ||||
|     } | ||||
|     markExported(name, _as) { | ||||
|         if (this._exports === undefined) | ||||
|             this._exports = new Set(); | ||||
|         this._exports.add(name.text); | ||||
|     } | ||||
|     getDestinationScope() { | ||||
|         return this._innerScope; | ||||
|     } | ||||
| } | ||||
| function getEntityNameParent(name) { | ||||
|     let parent = name.parent; | ||||
|     while (parent.kind === ts.SyntaxKind.QualifiedName) | ||||
|         parent = parent.parent; | ||||
|     return parent; | ||||
| } | ||||
| class UsageWalker { | ||||
|     constructor() { | ||||
|         this._result = new Map(); | ||||
|     } | ||||
|     getUsage(sourceFile) { | ||||
|         const variableCallback = (variable, key) => { | ||||
|             this._result.set(key, variable); | ||||
|         }; | ||||
|         const isModule = ts.isExternalModule(sourceFile); | ||||
|         this._scope = new RootScope(sourceFile.isDeclarationFile && isModule && !containsExportStatement(sourceFile), !isModule); | ||||
|         const cb = (node) => { | ||||
|             if (util_1.isBlockScopeBoundary(node)) | ||||
|                 return continueWithScope(node, new BlockScope(this._scope.getFunctionScope(), this._scope), handleBlockScope); | ||||
|             switch (node.kind) { | ||||
|                 case ts.SyntaxKind.ClassExpression: | ||||
|                     return continueWithScope(node, node.name !== undefined | ||||
|                         ? new ClassExpressionScope(node.name, this._scope) | ||||
|                         : new NonRootScope(this._scope, 1)); | ||||
|                 case ts.SyntaxKind.ClassDeclaration: | ||||
|                     this._handleDeclaration(node, true, 4 | 2); | ||||
|                     return continueWithScope(node, new NonRootScope(this._scope, 1)); | ||||
|                 case ts.SyntaxKind.InterfaceDeclaration: | ||||
|                 case ts.SyntaxKind.TypeAliasDeclaration: | ||||
|                     this._handleDeclaration(node, true, 2); | ||||
|                     return continueWithScope(node, new NonRootScope(this._scope, 4)); | ||||
|                 case ts.SyntaxKind.EnumDeclaration: | ||||
|                     this._handleDeclaration(node, true, 7); | ||||
|                     return continueWithScope(node, this._scope.createOrReuseEnumScope(node.name.text, util_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword))); | ||||
|                 case ts.SyntaxKind.ModuleDeclaration: | ||||
|                     return this._handleModule(node, continueWithScope); | ||||
|                 case ts.SyntaxKind.MappedType: | ||||
|                     return continueWithScope(node, new NonRootScope(this._scope, 4)); | ||||
|                 case ts.SyntaxKind.FunctionExpression: | ||||
|                 case ts.SyntaxKind.ArrowFunction: | ||||
|                 case ts.SyntaxKind.Constructor: | ||||
|                 case ts.SyntaxKind.MethodDeclaration: | ||||
|                 case ts.SyntaxKind.FunctionDeclaration: | ||||
|                 case ts.SyntaxKind.GetAccessor: | ||||
|                 case ts.SyntaxKind.SetAccessor: | ||||
|                 case ts.SyntaxKind.MethodSignature: | ||||
|                 case ts.SyntaxKind.CallSignature: | ||||
|                 case ts.SyntaxKind.ConstructSignature: | ||||
|                 case ts.SyntaxKind.ConstructorType: | ||||
|                 case ts.SyntaxKind.FunctionType: | ||||
|                     return this._handleFunctionLikeDeclaration(node, cb, variableCallback); | ||||
|                 case ts.SyntaxKind.ConditionalType: | ||||
|                     return this._handleConditionalType(node, cb, variableCallback); | ||||
|                 case ts.SyntaxKind.VariableDeclarationList: | ||||
|                     this._handleVariableDeclaration(node); | ||||
|                     break; | ||||
|                 case ts.SyntaxKind.Parameter: | ||||
|                     if (node.parent.kind !== ts.SyntaxKind.IndexSignature && | ||||
|                         (node.name.kind !== ts.SyntaxKind.Identifier || | ||||
|                             node.name.originalKeywordKind !== ts.SyntaxKind.ThisKeyword)) | ||||
|                         this._handleBindingName(node.name, false, false); | ||||
|                     break; | ||||
|                 case ts.SyntaxKind.EnumMember: | ||||
|                     this._scope.addVariable(util_1.getPropertyName(node.name), node.name, 1, true, 4); | ||||
|                     break; | ||||
|                 case ts.SyntaxKind.ImportClause: | ||||
|                 case ts.SyntaxKind.ImportSpecifier: | ||||
|                 case ts.SyntaxKind.NamespaceImport: | ||||
|                 case ts.SyntaxKind.ImportEqualsDeclaration: | ||||
|                     this._handleDeclaration(node, false, 7 | 8); | ||||
|                     break; | ||||
|                 case ts.SyntaxKind.TypeParameter: | ||||
|                     this._scope.addVariable(node.name.text, node.name, node.parent.kind === ts.SyntaxKind.InferType ? 8 : 7, false, 2); | ||||
|                     break; | ||||
|                 case ts.SyntaxKind.ExportSpecifier: | ||||
|                     if (node.propertyName !== undefined) | ||||
|                         return this._scope.markExported(node.propertyName, node.name); | ||||
|                     return this._scope.markExported(node.name); | ||||
|                 case ts.SyntaxKind.ExportAssignment: | ||||
|                     if (node.expression.kind === ts.SyntaxKind.Identifier) | ||||
|                         return this._scope.markExported(node.expression); | ||||
|                     break; | ||||
|                 case ts.SyntaxKind.Identifier: | ||||
|                     const domain = getUsageDomain(node); | ||||
|                     if (domain !== undefined) | ||||
|                         this._scope.addUse({ domain, location: node }); | ||||
|                     return; | ||||
|             } | ||||
|             return ts.forEachChild(node, cb); | ||||
|         }; | ||||
|         const continueWithScope = (node, scope, next = forEachChild) => { | ||||
|             const savedScope = this._scope; | ||||
|             this._scope = scope; | ||||
|             next(node); | ||||
|             this._scope.end(variableCallback); | ||||
|             this._scope = savedScope; | ||||
|         }; | ||||
|         const handleBlockScope = (node) => { | ||||
|             if (node.kind === ts.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) | ||||
|                 this._handleBindingName(node.variableDeclaration.name, true, false); | ||||
|             return ts.forEachChild(node, cb); | ||||
|         }; | ||||
|         ts.forEachChild(sourceFile, cb); | ||||
|         this._scope.end(variableCallback); | ||||
|         return this._result; | ||||
|         function forEachChild(node) { | ||||
|             return ts.forEachChild(node, cb); | ||||
|         } | ||||
|     } | ||||
|     _handleConditionalType(node, cb, varCb) { | ||||
|         const savedScope = this._scope; | ||||
|         const scope = this._scope = new ConditionalTypeScope(savedScope); | ||||
|         cb(node.checkType); | ||||
|         scope.updateState(1); | ||||
|         cb(node.extendsType); | ||||
|         scope.updateState(2); | ||||
|         cb(node.trueType); | ||||
|         scope.updateState(3); | ||||
|         cb(node.falseType); | ||||
|         scope.end(varCb); | ||||
|         this._scope = savedScope; | ||||
|     } | ||||
|     _handleFunctionLikeDeclaration(node, cb, varCb) { | ||||
|         if (node.decorators !== undefined) | ||||
|             node.decorators.forEach(cb); | ||||
|         const savedScope = this._scope; | ||||
|         if (node.kind === ts.SyntaxKind.FunctionDeclaration) | ||||
|             this._handleDeclaration(node, false, 4); | ||||
|         const scope = this._scope = node.kind === ts.SyntaxKind.FunctionExpression && node.name !== undefined | ||||
|             ? new FunctionExpressionScope(node.name, savedScope) | ||||
|             : new FunctionScope(savedScope); | ||||
|         if (node.name !== undefined) | ||||
|             cb(node.name); | ||||
|         if (node.typeParameters !== undefined) | ||||
|             node.typeParameters.forEach(cb); | ||||
|         node.parameters.forEach(cb); | ||||
|         if (node.type !== undefined) | ||||
|             cb(node.type); | ||||
|         if (node.body !== undefined) { | ||||
|             scope.beginBody(); | ||||
|             cb(node.body); | ||||
|         } | ||||
|         scope.end(varCb); | ||||
|         this._scope = savedScope; | ||||
|     } | ||||
|     _handleModule(node, next) { | ||||
|         if (node.flags & ts.NodeFlags.GlobalAugmentation) | ||||
|             return next(node, this._scope.createOrReuseNamespaceScope('-global', false, true, false)); | ||||
|         if (node.name.kind === ts.SyntaxKind.Identifier) { | ||||
|             const exported = isNamespaceExported(node); | ||||
|             this._scope.addVariable(node.name.text, node.name, 1, exported, 1 | 4); | ||||
|             const ambient = util_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword); | ||||
|             return next(node, this._scope.createOrReuseNamespaceScope(node.name.text, exported, ambient, ambient && namespaceHasExportStatement(node))); | ||||
|         } | ||||
|         return next(node, this._scope.createOrReuseNamespaceScope(`"${node.name.text}"`, false, true, namespaceHasExportStatement(node))); | ||||
|     } | ||||
|     _handleDeclaration(node, blockScoped, domain) { | ||||
|         if (node.name !== undefined) | ||||
|             this._scope.addVariable(node.name.text, node.name, blockScoped ? 3 : 1, util_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword), domain); | ||||
|     } | ||||
|     _handleBindingName(name, blockScoped, exported) { | ||||
|         if (name.kind === ts.SyntaxKind.Identifier) | ||||
|             return this._scope.addVariable(name.text, name, blockScoped ? 3 : 1, exported, 4); | ||||
|         util_1.forEachDestructuringIdentifier(name, (declaration) => { | ||||
|             this._scope.addVariable(declaration.name.text, declaration.name, blockScoped ? 3 : 1, exported, 4); | ||||
|         }); | ||||
|     } | ||||
|     _handleVariableDeclaration(declarationList) { | ||||
|         const blockScoped = util_1.isBlockScopedVariableDeclarationList(declarationList); | ||||
|         const exported = declarationList.parent.kind === ts.SyntaxKind.VariableStatement && | ||||
|             util_1.hasModifier(declarationList.parent.modifiers, ts.SyntaxKind.ExportKeyword); | ||||
|         for (const declaration of declarationList.declarations) | ||||
|             this._handleBindingName(declaration.name, blockScoped, exported); | ||||
|     } | ||||
| } | ||||
| function isNamespaceExported(node) { | ||||
|     return node.parent.kind === ts.SyntaxKind.ModuleDeclaration || util_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword); | ||||
| } | ||||
| function namespaceHasExportStatement(ns) { | ||||
|     if (ns.body === undefined || ns.body.kind !== ts.SyntaxKind.ModuleBlock) | ||||
|         return false; | ||||
|     return containsExportStatement(ns.body); | ||||
| } | ||||
| function containsExportStatement(block) { | ||||
|     for (const statement of block.statements) | ||||
|         if (statement.kind === ts.SyntaxKind.ExportDeclaration || statement.kind === ts.SyntaxKind.ExportAssignment) | ||||
|             return true; | ||||
|     return false; | ||||
| } | ||||
							
								
								
									
										167
									
								
								node_modules/tsutils/util/util.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								node_modules/tsutils/util/util.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,167 @@ | ||||
| import * as ts from 'typescript'; | ||||
| import { NodeWrap } from './convert-ast'; | ||||
| export declare function getChildOfKind<T extends ts.SyntaxKind>(node: ts.Node, kind: T, sourceFile?: ts.SourceFile): ts.Token<T> | undefined; | ||||
| export declare function isTokenKind(kind: ts.SyntaxKind): boolean; | ||||
| export declare function isNodeKind(kind: ts.SyntaxKind): boolean; | ||||
| export declare function isAssignmentKind(kind: ts.SyntaxKind): boolean; | ||||
| export declare function isTypeNodeKind(kind: ts.SyntaxKind): boolean; | ||||
| export declare function isJsDocKind(kind: ts.SyntaxKind): boolean; | ||||
| export declare function isKeywordKind(kind: ts.SyntaxKind): boolean; | ||||
| export declare function isThisParameter(parameter: ts.ParameterDeclaration): boolean; | ||||
| export declare function getModifier(node: ts.Node, kind: ts.Modifier['kind']): ts.Modifier | undefined; | ||||
| export declare function hasModifier(modifiers: ts.ModifiersArray | undefined, ...kinds: Array<ts.Modifier['kind']>): boolean; | ||||
| export declare function isParameterProperty(node: ts.ParameterDeclaration): boolean; | ||||
| export declare function hasAccessModifier(node: ts.ClassElement | ts.ParameterDeclaration): boolean; | ||||
| export declare const isNodeFlagSet: (node: ts.Node, flag: ts.NodeFlags) => boolean; | ||||
| export declare const isTypeFlagSet: (type: ts.Type, flag: ts.TypeFlags) => boolean; | ||||
| export declare const isSymbolFlagSet: (symbol: ts.Symbol, flag: ts.SymbolFlags) => boolean; | ||||
| export declare function isObjectFlagSet(objectType: ts.ObjectType, flag: ts.ObjectFlags): boolean; | ||||
| export declare function isModifierFlagSet(node: ts.Node, flag: ts.ModifierFlags): boolean; | ||||
| export declare function getPreviousStatement(statement: ts.Statement): ts.Statement | undefined; | ||||
| export declare function getNextStatement(statement: ts.Statement): ts.Statement | undefined; | ||||
| export declare function getPreviousToken(node: ts.Node, sourceFile?: ts.SourceFile): ts.Node | undefined; | ||||
| export declare function getNextToken(node: ts.Node, sourceFile?: ts.SourceFile): ts.Node | undefined; | ||||
| export declare function getTokenAtPosition(parent: ts.Node, pos: number, sourceFile?: ts.SourceFile, allowJsDoc?: boolean): ts.Node | undefined; | ||||
| export declare function getCommentAtPosition(sourceFile: ts.SourceFile, pos: number, parent?: ts.Node): ts.CommentRange | undefined; | ||||
| export declare function isPositionInComment(sourceFile: ts.SourceFile, pos: number, parent?: ts.Node): boolean; | ||||
| export declare function commentText(sourceText: string, comment: ts.CommentRange): string; | ||||
| export declare function getWrappedNodeAtPosition(wrap: NodeWrap, pos: number): NodeWrap | undefined; | ||||
| export declare function getPropertyName(propertyName: ts.PropertyName): string | undefined; | ||||
| export declare function forEachDestructuringIdentifier<T>(pattern: ts.BindingPattern, fn: (element: ts.BindingElement & { | ||||
|     name: ts.Identifier; | ||||
| }) => T): T | undefined; | ||||
| export declare function forEachDeclaredVariable<T>(declarationList: ts.VariableDeclarationList, cb: (element: (ts.VariableDeclaration | ts.BindingElement) & { | ||||
|     name: ts.Identifier; | ||||
| }) => T): T | undefined; | ||||
| export declare enum VariableDeclarationKind { | ||||
|     Var = 0, | ||||
|     Let = 1, | ||||
|     Const = 2 | ||||
| } | ||||
| export declare function getVariableDeclarationKind(declarationList: ts.VariableDeclarationList): VariableDeclarationKind; | ||||
| export declare function isBlockScopedVariableDeclarationList(declarationList: ts.VariableDeclarationList): boolean; | ||||
| export declare function isBlockScopedVariableDeclaration(declaration: ts.VariableDeclaration): boolean; | ||||
| export declare function isBlockScopedDeclarationStatement(statement: ts.Statement): statement is ts.DeclarationStatement; | ||||
| export declare function isInSingleStatementContext(statement: ts.Statement): boolean; | ||||
| export declare enum ScopeBoundary { | ||||
|     None = 0, | ||||
|     Function = 1, | ||||
|     Block = 2, | ||||
|     Type = 4, | ||||
|     ConditionalType = 8 | ||||
| } | ||||
| export declare enum ScopeBoundarySelector { | ||||
|     Function = 1, | ||||
|     Block = 3, | ||||
|     Type = 7, | ||||
|     InferType = 8 | ||||
| } | ||||
| export declare function isScopeBoundary(node: ts.Node): ScopeBoundary; | ||||
| export declare function isTypeScopeBoundary(node: ts.Node): ScopeBoundary; | ||||
| export declare function isFunctionScopeBoundary(node: ts.Node): ScopeBoundary; | ||||
| export declare function isBlockScopeBoundary(node: ts.Node): ScopeBoundary; | ||||
| export declare function hasOwnThisReference(node: ts.Node): boolean; | ||||
| export declare function isFunctionWithBody(node: ts.Node): node is ts.FunctionLikeDeclaration & { | ||||
|     body: {}; | ||||
| }; | ||||
| export declare function forEachToken(node: ts.Node, cb: (node: ts.Node) => void, sourceFile?: ts.SourceFile): void; | ||||
| export declare type ForEachTokenCallback = (fullText: string, kind: ts.SyntaxKind, range: ts.TextRange, parent: ts.Node) => void; | ||||
| export declare function forEachTokenWithTrivia(node: ts.Node, cb: ForEachTokenCallback, sourceFile?: ts.SourceFile): void; | ||||
| export declare type ForEachCommentCallback = (fullText: string, comment: ts.CommentRange) => void; | ||||
| export declare function forEachComment(node: ts.Node, cb: ForEachCommentCallback, sourceFile?: ts.SourceFile): void; | ||||
| export interface LineRange extends ts.TextRange { | ||||
|     contentLength: number; | ||||
| } | ||||
| export declare function getLineRanges(sourceFile: ts.SourceFile): LineRange[]; | ||||
| export declare function getLineBreakStyle(sourceFile: ts.SourceFile): "\n" | "\r\n"; | ||||
| export declare function isValidIdentifier(text: string, languageVersion?: ts.ScriptTarget): boolean; | ||||
| export declare function isValidPropertyAccess(text: string, languageVersion?: ts.ScriptTarget): boolean; | ||||
| export declare function isValidPropertyName(text: string, languageVersion?: ts.ScriptTarget): boolean; | ||||
| export declare function isValidNumericLiteral(text: string, languageVersion?: ts.ScriptTarget): boolean; | ||||
| export declare function isValidJsxIdentifier(text: string, languageVersion?: ts.ScriptTarget): boolean; | ||||
| export declare function isNumericPropertyName(name: string | ts.__String): boolean; | ||||
| export declare function isSameLine(sourceFile: ts.SourceFile, pos1: number, pos2: number): boolean; | ||||
| export declare enum SideEffectOptions { | ||||
|     None = 0, | ||||
|     TaggedTemplate = 1, | ||||
|     Constructor = 2, | ||||
|     JsxElement = 4 | ||||
| } | ||||
| export declare function hasSideEffects(node: ts.Expression, options?: SideEffectOptions): boolean; | ||||
| export declare function getDeclarationOfBindingElement(node: ts.BindingElement): ts.VariableDeclaration | ts.ParameterDeclaration; | ||||
| export declare function isExpressionValueUsed(node: ts.Expression): boolean; | ||||
| export declare enum AccessKind { | ||||
|     None = 0, | ||||
|     Read = 1, | ||||
|     Write = 2, | ||||
|     Delete = 4, | ||||
|     ReadWrite = 3, | ||||
|     Modification = 6 | ||||
| } | ||||
| export declare function getAccessKind(node: ts.Node): AccessKind; | ||||
| export declare function isReassignmentTarget(node: ts.Expression): boolean; | ||||
| export declare function canHaveJsDoc(node: ts.Node): node is ts.HasJSDoc; | ||||
| export declare function getJsDoc(node: ts.Node, sourceFile?: ts.SourceFile): ts.JSDoc[]; | ||||
| export declare function parseJsDocOfNode(node: ts.Node, considerTrailingComments?: boolean, sourceFile?: ts.SourceFile): ts.JSDoc[]; | ||||
| export declare enum ImportKind { | ||||
|     ImportDeclaration = 1, | ||||
|     ImportEquals = 2, | ||||
|     ExportFrom = 4, | ||||
|     DynamicImport = 8, | ||||
|     Require = 16, | ||||
|     ImportType = 32, | ||||
|     All = 63, | ||||
|     AllImports = 59, | ||||
|     AllStaticImports = 3, | ||||
|     AllImportExpressions = 24, | ||||
|     AllRequireLike = 18 | ||||
| } | ||||
| export declare function findImports(sourceFile: ts.SourceFile, kinds: ImportKind): (ts.StringLiteral | ts.NoSubstitutionTemplateLiteral)[]; | ||||
| export declare type ImportLike = ts.ImportDeclaration | (ts.ImportEqualsDeclaration & { | ||||
|     moduleReference: ts.ExternalModuleReference; | ||||
| }) | (ts.ExportDeclaration & { | ||||
|     moduleSpecifier: {}; | ||||
| }) | (ts.CallExpression & { | ||||
|     expression: ts.Token<ts.SyntaxKind.ImportKeyword> | (ts.Identifier & { | ||||
|         text: 'require'; | ||||
|     }); | ||||
|     arguments: [ts.Expression]; | ||||
| }) | ts.ImportTypeNode; | ||||
| export declare function findImportLikeNodes(sourceFile: ts.SourceFile, kinds: ImportKind): ImportLike[]; | ||||
| export declare function isStatementInAmbientContext(node: ts.Statement): boolean; | ||||
| export declare function isAmbientModuleBlock(node: ts.Node): node is ts.ModuleBlock; | ||||
| export declare function getIIFE(func: ts.FunctionExpression | ts.ArrowFunction): ts.CallExpression | undefined; | ||||
| export declare type StrictCompilerOption = 'noImplicitAny' | 'noImplicitThis' | 'strictNullChecks' | 'strictFunctionTypes' | 'strictPropertyInitialization' | 'alwaysStrict' | 'strictBindCallApply'; | ||||
| export declare function isStrictCompilerOptionEnabled(options: ts.CompilerOptions, option: StrictCompilerOption): boolean; | ||||
| export declare type BooleanCompilerOptions = { | ||||
|     [K in keyof ts.CompilerOptions]: NonNullable<ts.CompilerOptions[K]> extends boolean ? K : never; | ||||
| } extends { | ||||
|     [_ in keyof ts.CompilerOptions]: infer U; | ||||
| } ? U : never; | ||||
| export declare function isCompilerOptionEnabled(options: ts.CompilerOptions, option: BooleanCompilerOptions | 'stripInternal'): boolean; | ||||
| export declare function isAmbientModule(node: ts.ModuleDeclaration): boolean; | ||||
| export declare function getCheckJsDirective(source: string): ts.CheckJsDirective | undefined; | ||||
| export declare function isConstAssertion(node: ts.AssertionExpression): boolean; | ||||
| export declare function isInConstContext(node: ts.Expression): boolean; | ||||
| export declare function isReadonlyAssignmentDeclaration(node: ts.CallExpression, checker: ts.TypeChecker): boolean; | ||||
| export declare function isBindableObjectDefinePropertyCall(node: ts.CallExpression): boolean; | ||||
| export interface WellKnownSymbolLiteral extends ts.PropertyAccessExpression { | ||||
|     expression: ts.Identifier & { | ||||
|         text: 'Symbol'; | ||||
|         escapedText: 'symbol'; | ||||
|     }; | ||||
| } | ||||
| export declare function isWellKnownSymbolLiterally(node: ts.Expression): node is WellKnownSymbolLiteral; | ||||
| export interface PropertyName { | ||||
|     displayName: string; | ||||
|     symbolName: ts.__String; | ||||
| } | ||||
| export declare function getPropertyNameOfWellKnownSymbol(node: WellKnownSymbolLiteral): PropertyName; | ||||
| export interface LateBoundPropertyNames { | ||||
|     known: boolean; | ||||
|     names: PropertyName[]; | ||||
| } | ||||
| export declare function getLateBoundPropertyNames(node: ts.Expression, checker: ts.TypeChecker): LateBoundPropertyNames; | ||||
| export declare function getLateBoundPropertyNamesOfPropertyName(node: ts.PropertyName, checker: ts.TypeChecker): LateBoundPropertyNames; | ||||
| export declare function getSingleLateBoundPropertyNameOfPropertyName(node: ts.PropertyName, checker: ts.TypeChecker): PropertyName | undefined; | ||||
| export declare function unwrapParentheses(node: ts.Expression): ts.Expression; | ||||
							
								
								
									
										1422
									
								
								node_modules/tsutils/util/util.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1422
									
								
								node_modules/tsutils/util/util.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user
	 tatianamac
					tatianamac