0.6.3 • Published 1 year ago

ts-morph-helpers v0.6.3

Weekly downloads
-
License
Unlicense
Repository
github
Last release
1 year ago

Helpers for ts-morph

Helpers for ts-morph.

List

experimental/findJsxIdentifiersInJsxExpressions
experimental/findJsxSymbolsInJsxExpressions
experimental/getRealSourceFilesForImportDeclarations
experimental/getReferencedSourceFiles
experimental/hasSymbol
experimental/isBarrel
expressions/findCallExpressionsByName
expressions/findCallExpressionsWithArg
file/getRealSourceFileForImportDeclaration
file/getSourceFilesForNodes
jsx/findJsxNodeByName
jsx/findJsxNodes
jsx/isJsx
module/findDuplicateExportedNames
module/findExportDeclarationByIdentifier
module/findExportDeclarationByName
module/findExportIdentifierByName
module/findExportSpecifierByName
module/findImportIdentifierByName
module/findImportSpecifierByName
module/findReferencingNamespaceExports
module/findReferencingNamespaceImports
module/findReferencingNamespaceNodes
module/getImportDeclarationsForSymbols
module/hasReferencingDefaultImport
node/getDeclarationsForSymbols
node/getSymbolsOfNodes
react/findContextProviderIdentifierByContextName
react/findHookCallExpressions
react/findHookIdentifierByContextName

Naming Is Hard

Terminology

When looking at this example code...

import { a } from './a';
import { b } from 'b';
const c = a + b;
const d = b(c);
export { c };

...we can apply the following (incomplete) list of terms:

NameDescriptionExample
SymbolNamed declaration, connects declaration nodes.a, b, c, d
IdentifierNode, references a symbola (2x), b (3x), c (2x), d (1x)
SpecifierMore specific classification of identifierImportSpecifier a, ExportSpecifier c
Call expressionFunction call with argumentsb(c)
Import declarationAn import declaration with named and/or default importsimport { b } from 'b'
Export declarationAn export declaration with named (not default) exportsexport { b } from 'b'

Here is the example code in the TypeScript AST Viewer to see the nodes as described.

Additional terminology

  • SourceFile: The AST of a given source file
  • Program: Collection of source files, and its main entry

Conventions

The following conventions are used to name the helper functions:

  • To get something means the thing is a reference expected to be there (upwards and/or linked).
  • To find something means to query for things from a certain starting point (downwards).
  • To get things For something expresses an AncestorForDescendant hierarchy.
  • To get things Of something means the opposite: descendantOfAncestor.
0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago