Skip to content

feat(@ngtools/webpack): expose TS TypeChecker from ng compiler plugin #11786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ export class AngularCompilerPlugin {
return { path, className };
}

get typeChecker(): ts.TypeChecker | null {
const tsProgram = this._getTsProgram();

return tsProgram ? tsProgram.getTypeChecker() : null;
}

static isSupported() {
return VERSION && parseInt(VERSION.major) >= 5;
}
Expand Down Expand Up @@ -351,7 +357,7 @@ export class AngularCompilerPlugin {
this._updateForkedTypeChecker(this._rootNames, this._getChangedCompilationFiles());
}

// Use an identity function as all our paths are absolute already.
// Use an identity function as all our paths are absolute already.
this._moduleResolutionCache = ts.createModuleResolutionCache(this._basePath, x => x);

if (this._JitMode) {
Expand Down Expand Up @@ -1020,7 +1026,7 @@ export class AngularCompilerPlugin {
.map((resourcePath) => resolve(dirname(resolvedFileName), normalize(resourcePath)));

// These paths are meant to be used by the loader so we must denormalize them.
const uniqueDependencies = new Set([
const uniqueDependencies = new Set([
...esImports,
...resourceImports,
...this.getResourceDependencies(this._compilerHost.denormalizePath(resolvedFileName)),
Expand Down