Description
Hey everybody! (and in particular @sheetalkamat and @Andy-MS !)
TypeScript Version: 2.9.1
Apologies for raising a bug. I suspect this probably isn't a bug. (Although I suppose it may be.) I'm raising this issue because it may be a bug; but either way I could really benefit from some guidance.
I'm one of the maintainers of ts-loader. I was just doing the relevant housekeeping to cut a new release. I thought I'd switch to building ts-loader with TypeScript 2.9. However, this presents the following compile error:
src/servicesHost.ts:190:9 - error TS2322: Type '{ rootFiles: string[]; options: CompilerOptions; useCaseSensitiveFileNames: () => boolean; getNew...' is not assignable to type 'WatchHost'.
Types of property 'createProgram' are incompatible.
Type '{ (newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram | undefined, config...' is not assignable to type 'CreateProgram<BuilderProgram>'.
Types of parameters 'newProgram' and 'rootNames' are incompatible.
Type 'ReadonlyArray<string> | undefined' is not assignable to type 'Program'.
Type 'undefined' is not assignable to type 'Program'.
190 const watchHost: WatchHost = {
~~~~~~~~~
The error message isn't as revealing as it might be but I think it's related to createAbstractBuilder
somehow no longer aligning with createProgram
.
The easiest way to see this in action is to take the ts-loader source code and amend this line from:
createProgram: compiler.createAbstractBuilder as any // TODO: Chase up with TypeScript team about API change
to:
createProgram: compiler.createAbstractBuilder
et voila! Compile error.
I've tried digging through the history of builder.ts
and I've a hunch that this may be linked to the strictNullChecks
switch that recently happened. Unfortunately I'm not getting enough information from the compiler to meaningful progress this. I'm drawing a blank.
Would you be able to give me some guidance please? My apologies if I'm missing something super obvious.