add createProgram docs (#15697)

* add `createProgram` docs

* updated `createProgram` docs
This commit is contained in:
Donald Pipowitch 2017-05-23 19:40:46 +02:00 committed by Mohamed Hegazy
parent 49638ab2eb
commit e4d6752a93

View file

@ -386,6 +386,19 @@ namespace ts {
allDiagnostics?: Diagnostic[];
}
/**
* Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
* that represent a compilation unit.
*
* Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and
* triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
*
* @param rootNames - A set of root files.
* @param options - The compiler options which should be used.
* @param host - The host interacts with the underlying file system.
* @param oldProgram - Reuses an old program structure.
* @returns A 'Program' object.
*/
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program {
let program: Program;
let files: SourceFile[] = [];