Skip to content

API: parseConfigHostFromCompilerHost misbehaves if host.readDirectory is not implemented #26785

@ajafff

Description

@ajafff

TypeScript Version: 3.1.0-dev.20180830

Search Terms:

Code

src/tsconfig.json

{
  "compilerOptions": {"composite": true},
  "include": ["."]
}

test/tsconfig.json

{
  "references": [{"path": "../src"}]
}

Calling ts.createProgram on test/tsconfig.json with a custom CompilerHost that doesn't implement the optional method readDirectory.

Expected behavior:

Some kind of error or warning when passing projectReferences to ts.createProgram without implementing CompilerHost#readDirectory. I wondered what is wrong and only found this implementation detail by chance.

Actual behavior:

The ResolvedProjectReference returned from program.getProjectReferences() has an empty fileNames array.

https://github.com/Microsoft/TypeScript/blob/828279b611978e081eba0de1a1c126e415e306dd/src/compiler/program.ts#L2816

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIRelates to the public API for TypeScriptBugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions