usage.d.ts 847 B

123456789101112131415161718192021222324252627282930
  1. import * as ts from 'typescript';
  2. export interface VariableInfo {
  3. domain: DeclarationDomain;
  4. exported: boolean;
  5. uses: VariableUse[];
  6. inGlobalScope: boolean;
  7. declarations: ts.Identifier[];
  8. }
  9. export interface VariableUse {
  10. domain: UsageDomain;
  11. location: ts.Identifier;
  12. }
  13. export declare enum DeclarationDomain {
  14. Namespace = 1,
  15. Type = 2,
  16. Value = 4,
  17. Import = 8,
  18. Any = 7
  19. }
  20. export declare enum UsageDomain {
  21. Namespace = 1,
  22. Type = 2,
  23. Value = 4,
  24. ValueOrNamespace = 5,
  25. Any = 7,
  26. TypeQuery = 8
  27. }
  28. export declare function getUsageDomain(node: ts.Identifier): UsageDomain | undefined;
  29. export declare function getDeclarationDomain(node: ts.Identifier): DeclarationDomain | undefined;
  30. export declare function collectVariableUsage(sourceFile: ts.SourceFile): Map<ts.Identifier, VariableInfo>;