Skip to content

Commit 5f12c63

Browse files
committed
ts2.4: work around object spread with Partial
You can no longer update an object using an object spread with Partial<T>. Seee bug: microsoft/TypeScript#16509 Work around it for now.
1 parent 88d063a commit 5f12c63

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ export function toClosureJS(
159159
{jsFiles: Map<string, string>, externs: string}|null {
160160
const closureJSOptions: ClosureJSOptions = {
161161
...getDefaultClosureJSOptions(fileNames, settings),
162-
...partialClosureJSOptions
162+
// Work around https://github.com/Microsoft/TypeScript/issues/16509.
163+
...(partialClosureJSOptions as ClosureJSOptions),
163164
};
164165
// Parse and load the program without tsickle processing.
165166
// This is so:

test/e2e_source_map_test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,11 @@ const DEFAULT_COMPILER_OPTIONS = {
345345

346346
function compile(sources: Map<string, string>, partialOptions = {} as Partial<CompilerOptions>):
347347
{compiledJS: string, dts: string | undefined, sourceMap: SourceMapConsumer} {
348-
const options: CompilerOptions = {...DEFAULT_COMPILER_OPTIONS, ...partialOptions};
348+
const options: CompilerOptions = {
349+
...DEFAULT_COMPILER_OPTIONS,
350+
// Work around https://github.com/Microsoft/TypeScript/issues/16509
351+
...(partialOptions as CompilerOptions),
352+
};
349353
const resolvedSources = new Map<string, string>();
350354
for (const fileName of toArray(sources.keys())) {
351355
resolvedSources.set(ts.sys.resolvePath(fileName), sources.get(fileName)!);

0 commit comments

Comments
 (0)