Options
All
  • Public
  • Public/Protected
  • All
Menu

Class for easy representation of an import.

This class maps the import declarations to simple attributes. Used for comparing them against each other.

Hierarchy

  • Import

Index

Constructors

  • new Import(importDeclaration: ImportDeclaration, sourceFile: SourceFile): Import
  • Constructor for the import. Directly reads out the declaration to make its uses easier.

    Parameters

    • importDeclaration: ImportDeclaration

      declaration from the AST

    • sourceFile: SourceFile

      source file to get the texts from it

    Returns Import

Properties

defaultElement?: ImportElement

If isNamed is true, this can hold an element.

elements: ImportElement[]

The imported elements, does not contain the default import.

isNamed: boolean = false

If the named imports were used. i.e.: "import {a, b, c}".

isNamespace: boolean = false

If the namespace import was used. i.e.: "import * as yourMom".

isTypeOnly: boolean

If only types were imported. Uses the syntax: "import type".

source: ImportSource

The source of the import, the right side.

Accessors

  • get isSideEffectOnly(): boolean

Methods

  • The basic toString function to format this to a string. If give some formatting options, it will format to the given options.

    Parameters

    Returns string

Generated using TypeDoc