Skip to content

Commit 71a8d37

Browse files
committed
Runtime check that project is a string
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.
1 parent 7c20481 commit 71a8d37

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/servicesHost.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as path from 'path';
22
import type * as typescript from 'typescript';
3+
import { isString } from 'util';
34
import * as webpack from 'webpack';
45
import { getParsedCommandLine } from './config';
56
import * as constants from './constants';
@@ -799,7 +800,7 @@ export function makeSolutionBuilderHost(
799800
// The `configFilePath` is the same value that is used as the `project` parameter of
800801
// `getCustomtransformers` below.
801802
const project = options.configFilePath;
802-
if (project) {
803+
if (typeof project === "string") {
803804
// Custom transformers need a reference to the `typescript.Program`, that reference is
804805
// unavailable during the the `getCustomTransformers` callback below.
805806
const transformers = getCustomTransformers(instance.loaderOptions, result.getProgram(), result.getProgram);

0 commit comments

Comments
 (0)