Skip to content

Commit

Permalink
refactor: The Options interface was renamed to ProjectOptions
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The `Options` interface was renamed to `ProjectOptions`. This was so it's less ambiguous.
  • Loading branch information
dsherret committed Nov 13, 2018
1 parent 7f892fb commit 15316a3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ View [CHANGELOG.md](CHANGELOG.md) for more detail on releases. This file is only

## Version 19

* `Options` interface renamed to `ProjectOptions` in order to be more specific.

### Source file dependencies automatically added

Referenced source files in module specifiers and references are now added to the project when constructing a project and providing a tsconfig.
Expand Down
4 changes: 2 additions & 2 deletions lib/ts-simple-ast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export interface FileSystemHost {
glob(patterns: ReadonlyArray<string>): string[];
}

export interface Options {
export interface ProjectOptions {
/** Compiler options */
compilerOptions?: CompilerOptions;
/** File path to the tsconfig.json file */
Expand Down Expand Up @@ -367,7 +367,7 @@ export declare class Project {
* Initializes a new instance.
* @param options - Optional options.
*/
constructor(options?: Options);
constructor(options?: ProjectOptions);
/** Gets the manipulation settings. */
readonly manipulationSettings: ManipulationSettingsContainer;
/** Gets the compiler options for modification. */
Expand Down
4 changes: 2 additions & 2 deletions src/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SourceFileStructure } from "./structures";
import { ts, CompilerOptions } from "./typescript";
import { ArrayUtils, FileUtils, matchGlobs, TsConfigResolver } from "./utils";

export interface Options { // todo: rename to ProjectOptions
export interface ProjectOptions {
/** Compiler options */
compilerOptions?: CompilerOptions;
/** File path to the tsconfig.json file */
Expand Down Expand Up @@ -43,7 +43,7 @@ export class Project {
* Initializes a new instance.
* @param options - Optional options.
*/
constructor(options: Options = {}) {
constructor(options: ProjectOptions = {}) {
// setup file system
let fileSystem = options.fileSystem;
if (fileSystem != null && options.useVirtualFileSystem)
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export * from "./compiler";
export * from "./errors/classes";
export { Directory, DirectoryAddOptions, DirectoryCopyOptions, DirectoryEmitResult, DirectoryMoveOptions, FileSystemHost } from "./fileSystem";
export * from "./options";
export { Options, Project, SourceFileCreateOptions } from "./Project";
export { ProjectOptions, Project, SourceFileCreateOptions } from "./Project";
export { Project as default } from "./Project";
export * from "./structures";
export { Constructor, WriterFunction } from "./types";
Expand Down
4 changes: 2 additions & 2 deletions src/tests/projectTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ClassDeclaration, EmitResult, MemoryEmitResult, InterfaceDeclaration, N
import * as errors from "../errors";
import { VirtualFileSystemHost } from "../fileSystem";
import { IndentationText } from "../options";
import { Project, Options } from "../Project";
import { Project, ProjectOptions } from "../Project";
import { SourceFileStructure } from "../structures";
import { CompilerOptions, ScriptTarget, SyntaxKind, ts } from "../typescript";
import * as testHelpers from "./testHelpers";
Expand Down Expand Up @@ -93,7 +93,7 @@ describe(nameof(Project), () => {
});
});

function fileDependencyResolutionSetup(options: Options = {}) {
function fileDependencyResolutionSetup(options: ProjectOptions = {}) {
const fileSystem = new VirtualFileSystemHost();

fileSystem.writeFileSync("/package.json", `{ "name": "testing", "version": "0.0.1" }`);
Expand Down

0 comments on commit 15316a3

Please sign in to comment.