Skip to content

⬅️ Back to Table of Contents

📄 spec.ts

📊 Analysis Summary

Metric Count
📦 Imports 2
📐 Interfaces 3
📑 Type Aliases 1

📚 Table of Contents

🛠️ File Location:

📂 packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts

📦 Imports

Name Source
AST_NODE_TYPES ../../ast-node-types
FunctionBase ../../base/FunctionBase

Interfaces

TSDeclareFunctionBase

Interface Code
interface TSDeclareFunctionBase extends FunctionBase {
  type: AST_NODE_TYPES.TSDeclareFunction;
  /**
   * TS1183: An implementation cannot be declared in ambient contexts.
   */
  body: undefined;
  /**
   * Whether the declaration has `declare` modifier.
   */
  declare: boolean;
  expression: false;
}

Properties

Name Type Optional Description
type AST_NODE_TYPES.TSDeclareFunction
body undefined
declare boolean
expression false

TSDeclareFunctionWithDeclare

Interface Code
export interface TSDeclareFunctionWithDeclare extends TSDeclareFunctionBase {
  /**
   * TS1040: 'async' modifier cannot be used in an ambient context.
   */
  async: false;
  declare: true;
  /**
   * TS1221: Generators are not allowed in an ambient context.
   */
  generator: false;
}

Properties

Name Type Optional Description
async false
declare true
generator false

TSDeclareFunctionNoDeclare

Interface Code
export interface TSDeclareFunctionNoDeclare extends TSDeclareFunctionBase {
  declare: false;
  /**
   * - TS1221: Generators are not allowed in an ambient context.
   * - TS1222: An overload signature cannot be declared as a generator.
   */
  generator: false;
}

Properties

Name Type Optional Description
declare false
generator false

Type Aliases

TSDeclareFunction

type TSDeclareFunction = | TSDeclareFunctionNoDeclare
  | TSDeclareFunctionWithDeclare;