Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TSCommon

Common TypeScript interfaces between versions. We endeavour to write ts-node's own code against these types instead of against import "typescript", though we are not yet doing this consistently.

Sometimes typescript@next adds an API we need to use. But we build ts-node against typescript@latest. In these cases, we must declare that API explicitly here. Our declarations include the newer typescript@next APIs. Importantly, these re-declarations are not TypeScript internals. They are public APIs that only exist in pre-release versions of typescript.

Hierarchy

  • TSCommon

Index

Properties

Extension

Extension: typeof Extension

JsxEmit

JsxEmit: typeof JsxEmit

ModuleKind

ModuleKind: ModuleKindEnum

ModuleResolutionKind

ModuleResolutionKind: typeof ModuleResolutionKind

ScriptSnapshot

ScriptSnapshot: typeof ScriptSnapshot

ScriptTarget

ScriptTarget: typeof ScriptTarget

createDocumentRegistry

createDocumentRegistry: (useCaseSensitiveFileNames?: boolean, currentDirectory?: string) => DocumentRegistry

Type declaration

    • (useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry
    • Parameters

      • Optional useCaseSensitiveFileNames: boolean
      • Optional currentDirectory: string

      Returns DocumentRegistry

createEmitAndSemanticDiagnosticsBuilderProgram

createEmitAndSemanticDiagnosticsBuilderProgram: { (newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[]): EmitAndSemanticDiagnosticsBuilderProgram; (rootNames: undefined | readonly string[], options: undefined | CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[], projectReferences?: readonly ProjectReference[]): EmitAndSemanticDiagnosticsBuilderProgram }

Type declaration

    • (newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[]): EmitAndSemanticDiagnosticsBuilderProgram
    • (rootNames: undefined | readonly string[], options: undefined | CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[], projectReferences?: readonly ProjectReference[]): EmitAndSemanticDiagnosticsBuilderProgram
    • Create the builder that can handle the changes in program and iterate through changed files to emit the those files and manage semantic diagnostics cache as well

      Parameters

      • newProgram: Program
      • host: BuilderProgramHost
      • Optional oldProgram: EmitAndSemanticDiagnosticsBuilderProgram
      • Optional configFileParsingDiagnostics: readonly Diagnostic[]

      Returns EmitAndSemanticDiagnosticsBuilderProgram

    • Parameters

      • rootNames: undefined | readonly string[]
      • options: undefined | CompilerOptions
      • Optional host: CompilerHost
      • Optional oldProgram: EmitAndSemanticDiagnosticsBuilderProgram
      • Optional configFileParsingDiagnostics: readonly Diagnostic[]
      • Optional projectReferences: readonly ProjectReference[]

      Returns EmitAndSemanticDiagnosticsBuilderProgram

createIncrementalCompilerHost

createIncrementalCompilerHost: (options: CompilerOptions, system?: System) => CompilerHost

Type declaration

    • (options: CompilerOptions, system?: System): CompilerHost
    • Parameters

      • options: CompilerOptions
      • Optional system: System

      Returns CompilerHost

createIncrementalProgram

createIncrementalProgram: <T>(__namedParameters: IncrementalProgramOptions<T>) => T

Type declaration

    • <T>(__namedParameters: IncrementalProgramOptions<T>): T
    • Type parameters

      • T: BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram

      Parameters

      • __namedParameters: IncrementalProgramOptions<T>

      Returns T

createLanguageService

createLanguageService: (host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnlyOrLanguageServiceMode?: boolean | LanguageServiceMode) => LanguageService

Type declaration

    • (host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnlyOrLanguageServiceMode?: boolean | LanguageServiceMode): LanguageService
    • Parameters

      • host: LanguageServiceHost
      • Optional documentRegistry: DocumentRegistry
      • Optional syntaxOnlyOrLanguageServiceMode: boolean | LanguageServiceMode

      Returns LanguageService

createModuleResolutionCache

createModuleResolutionCache: (currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions) => ModuleResolutionCache

Type declaration

    • (currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache
    • Parameters

      • currentDirectory: string
      • getCanonicalFileName: (s: string) => string
          • (s: string): string
          • Parameters

            • s: string

            Returns string

      • Optional options: CompilerOptions

      Returns ModuleResolutionCache

createSourceFile

createSourceFile: (fileName: string, sourceText: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, setParentNodes?: boolean, scriptKind?: ScriptKind) => SourceFile

Type declaration

    • (fileName: string, sourceText: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile
    • Parameters

      • fileName: string
      • sourceText: string
      • languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions
      • Optional setParentNodes: boolean
      • Optional scriptKind: ScriptKind

      Returns SourceFile

displayPartsToString

displayPartsToString: (displayParts: undefined | SymbolDisplayPart[]) => string

Type declaration

    • (displayParts: undefined | SymbolDisplayPart[]): string
    • Parameters

      • displayParts: undefined | SymbolDisplayPart[]

      Returns string

findConfigFile

findConfigFile: (searchPath: string, fileExists: (fileName: string) => boolean, configName?: string) => string | undefined

Type declaration

    • (searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined
    • Parameters

      • searchPath: string
      • fileExists: (fileName: string) => boolean
          • (fileName: string): boolean
          • Parameters

            • fileName: string

            Returns boolean

      • Optional configName: string

      Returns string | undefined

flattenDiagnosticMessageText

flattenDiagnosticMessageText: (diag: undefined | string | DiagnosticMessageChain, newLine: string, indent?: number) => string

Type declaration

    • (diag: undefined | string | DiagnosticMessageChain, newLine: string, indent?: number): string
    • Parameters

      • diag: undefined | string | DiagnosticMessageChain
      • newLine: string
      • Optional indent: number

      Returns string

formatDiagnostics

formatDiagnostics: (diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost) => string

Type declaration

    • (diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string
    • Parameters

      • diagnostics: readonly Diagnostic[]
      • host: FormatDiagnosticsHost

      Returns string

formatDiagnosticsWithColorAndContext

formatDiagnosticsWithColorAndContext: (diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost) => string

Type declaration

    • (diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string
    • Parameters

      • diagnostics: readonly Diagnostic[]
      • host: FormatDiagnosticsHost

      Returns string

getDefaultLibFileName

getDefaultLibFileName: (options: CompilerOptions) => string

Type declaration

    • (options: CompilerOptions): string
    • Parameters

      • options: CompilerOptions

      Returns string

getDefaultLibFilePath

getDefaultLibFilePath: (options: CompilerOptions) => string

Type declaration

    • (options: CompilerOptions): string
    • Get the path of the default library files (lib.d.ts) as distributed with the typescript node package. The functionality is not supported if the ts module is consumed outside of a node module.

      Parameters

      • options: CompilerOptions

      Returns string

getPreEmitDiagnostics

getPreEmitDiagnostics: (program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken) => readonly Diagnostic[]

Type declaration

    • (program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]
    • Parameters

      • program: Program
      • Optional sourceFile: SourceFile
      • Optional cancellationToken: CancellationToken

      Returns readonly Diagnostic[]

parseJsonConfigFileContent

parseJsonConfigFileContent: (json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions) => ParsedCommandLine

Type declaration

    • (json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine
    • Parse the contents of a config file (tsconfig.json).

      Parameters

      • json: any

        The contents of the config file to parse

      • host: ParseConfigHost

        Instance of ParseConfigHost used to enumerate files in folder.

      • basePath: string

        A root directory to resolve relative path entries in the config file to. e.g. outDir

      • Optional existingOptions: CompilerOptions
      • Optional configFileName: string
      • Optional resolutionStack: Path[]
      • Optional extraFileExtensions: readonly FileExtensionInfo[]
      • Optional extendedConfigCache: Map<ExtendedConfigCacheEntry>
      • Optional existingWatchOptions: WatchOptions

      Returns ParsedCommandLine

readConfigFile

readConfigFile: (fileName: string, readFile: (path: string) => undefined | string) => { config?: any; error?: Diagnostic }

Type declaration

    • (fileName: string, readFile: (path: string) => undefined | string): { config?: any; error?: Diagnostic }
    • Read tsconfig.json file

      Parameters

      • fileName: string

        The path to the config file

      • readFile: (path: string) => undefined | string
          • (path: string): undefined | string
          • Parameters

            • path: string

            Returns undefined | string

      Returns { config?: any; error?: Diagnostic }

      • Optional config?: any
      • Optional error?: Diagnostic

resolveModuleName

resolveModuleName: (moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: CommonJS | ESNext) => ResolvedModuleWithFailedLookupLocations

Type declaration

    • (moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: CommonJS | ESNext): ResolvedModuleWithFailedLookupLocations
    • Parameters

      • moduleName: string
      • containingFile: string
      • compilerOptions: CompilerOptions
      • host: ModuleResolutionHost
      • Optional cache: ModuleResolutionCache
      • Optional redirectedReference: ResolvedProjectReference
      • Optional resolutionMode: CommonJS | ESNext

      Returns ResolvedModuleWithFailedLookupLocations

resolveModuleNameFromCache

resolveModuleNameFromCache: (moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: CommonJS | ESNext) => ResolvedModuleWithFailedLookupLocations | undefined

Type declaration

    • (moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: CommonJS | ESNext): ResolvedModuleWithFailedLookupLocations | undefined
    • Parameters

      • moduleName: string
      • containingFile: string
      • cache: ModuleResolutionCache
      • Optional mode: CommonJS | ESNext

      Returns ResolvedModuleWithFailedLookupLocations | undefined

resolveTypeReferenceDirective

resolveTypeReferenceDirective: (typeReferenceDirectiveName: string, containingFile: undefined | string, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference, cache?: TypeReferenceDirectiveResolutionCache, resolutionMode?: CommonJS | ESNext) => ResolvedTypeReferenceDirectiveWithFailedLookupLocations

Type declaration

    • (typeReferenceDirectiveName: string, containingFile: undefined | string, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference, cache?: TypeReferenceDirectiveResolutionCache, resolutionMode?: CommonJS | ESNext): ResolvedTypeReferenceDirectiveWithFailedLookupLocations
    • Parameters

      • typeReferenceDirectiveName: string
      • containingFile: undefined | string

        file that contains type reference directive, can be undefined if containing file is unknown. This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups is assumed to be the same as root directory of the project.

      • options: CompilerOptions
      • host: ModuleResolutionHost
      • Optional redirectedReference: ResolvedProjectReference
      • Optional cache: TypeReferenceDirectiveResolutionCache
      • Optional resolutionMode: CommonJS | ESNext

      Returns ResolvedTypeReferenceDirectiveWithFailedLookupLocations

sys

sys: System

transpileModule

transpileModule: (input: string, transpileOptions: TranspileOptions) => TranspileOutput

Type declaration

    • (input: string, transpileOptions: TranspileOptions): TranspileOutput
    • Parameters

      • input: string
      • transpileOptions: TranspileOptions

      Returns TranspileOutput

version

version: string

Generated using TypeDoc