Skip to content

Commit

Permalink
Runtime check that project is a string
Browse files Browse the repository at this point in the history
In a previous commit, I removed `.toString()` without validating what
the Typescript compiler would say. This change does a runtime check
that the project variable is an actual string.
  • Loading branch information
feosuna1 committed Nov 26, 2022
1 parent 7c20481 commit 71a8d37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/servicesHost.ts
@@ -1,5 +1,6 @@
import * as path from 'path';
import type * as typescript from 'typescript';
import { isString } from 'util';
import * as webpack from 'webpack';
import { getParsedCommandLine } from './config';
import * as constants from './constants';
Expand Down Expand Up @@ -799,7 +800,7 @@ export function makeSolutionBuilderHost(
// The `configFilePath` is the same value that is used as the `project` parameter of
// `getCustomtransformers` below.
const project = options.configFilePath;
if (project) {
if (typeof project === "string") {
// Custom transformers need a reference to the `typescript.Program`, that reference is
// unavailable during the the `getCustomTransformers` callback below.
const transformers = getCustomTransformers(instance.loaderOptions, result.getProgram(), result.getProgram);
Expand Down

0 comments on commit 71a8d37

Please sign in to comment.