Skip to content

Commit e4d6752

Browse files
donaldpipowitchmhegazy
authored andcommitted
add createProgram docs (#15697)
* add `createProgram` docs * updated `createProgram` docs
1 parent 49638ab commit e4d6752

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/compiler/program.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,19 @@ namespace ts {
386386
allDiagnostics?: Diagnostic[];
387387
}
388388

389+
/**
390+
* Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
391+
* that represent a compilation unit.
392+
*
393+
* Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and
394+
* triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
395+
*
396+
* @param rootNames - A set of root files.
397+
* @param options - The compiler options which should be used.
398+
* @param host - The host interacts with the underlying file system.
399+
* @param oldProgram - Reuses an old program structure.
400+
* @returns A 'Program' object.
401+
*/
389402
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program {
390403
let program: Program;
391404
let files: SourceFile[] = [];

0 commit comments

Comments
 (0)