Skip to content

Commit

Permalink
fix: Fix extends option in tsconfig.json doesn't work (#1273)
Browse files Browse the repository at this point in the history
Clone typedoc options object after loading file content.

Closes #1272
  • Loading branch information
WilliamJns committed Apr 25, 2020
1 parent 91644a9 commit d5c2d47
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib/utils/options/readers/typedoc.ts
@@ -1,6 +1,6 @@
import * as Path from 'path';
import * as FS from 'fs';
import * as _ from 'lodash';
import { cloneDeep } from 'lodash';

import { OptionsReader } from '..';
import { Logger } from '../../loggers';
Expand Down Expand Up @@ -51,13 +51,16 @@ export class TypeDocReader implements OptionsReader {
}
seen.add(file);

const data: unknown = require(file);
const fileContent: unknown = require(file);

if (typeof data !== 'object' || !data) {
if (typeof fileContent !== 'object' || !fileContent) {
logger.error(`The file ${file} is not an object.`);
return;
}

// clone option object to avoid of property changes in re-calling this file
const data: object = cloneDeep(fileContent);

if ('extends' in data) {
const extended: string[] = getStringArray(data['extends']);
for (const extendedFile of extended) {
Expand Down

0 comments on commit d5c2d47

Please sign in to comment.