Skip to content

Commit da04509

Browse files
committed
feat: Support for TypeScript 4.4
Closes #1664
1 parent 77552ff commit da04509

File tree

11 files changed

+596
-385
lines changed

11 files changed

+596
-385
lines changed

package-lock.json

Lines changed: 337 additions & 277 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@
2323
"glob": "^7.1.7",
2424
"handlebars": "^4.7.7",
2525
"lunr": "^2.3.9",
26-
"marked": "^2.1.1",
26+
"marked": "^3.0.2",
2727
"minimatch": "^3.0.0",
2828
"progress": "^2.0.3",
2929
"shiki": "^0.9.3",
3030
"typedoc-default-themes": "^0.12.10"
3131
},
3232
"peerDependencies": {
33-
"typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x"
33+
"typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x"
3434
},
3535
"devDependencies": {
36-
"@types/glob": "^7.1.3",
37-
"@types/lunr": "^2.3.3",
38-
"@types/marked": "^2.0.3",
39-
"@types/minimatch": "3.0.4",
40-
"@types/mocha": "^8.2.2",
41-
"@types/node": "^15.12.2",
42-
"@typescript-eslint/eslint-plugin": "^4.27.0",
43-
"@typescript-eslint/parser": "^4.27.0",
44-
"eslint": "^7.28.0",
45-
"mocha": "^9.0.0",
36+
"@types/glob": "^7.1.4",
37+
"@types/lunr": "^2.3.4",
38+
"@types/marked": "^3.0.0",
39+
"@types/minimatch": "3.0.5",
40+
"@types/mocha": "^9.0.0",
41+
"@types/node": "^16.7.3",
42+
"@typescript-eslint/eslint-plugin": "^4.29.3",
43+
"@typescript-eslint/parser": "^4.29.3",
44+
"eslint": "^7.32.0",
45+
"mocha": "^9.1.0",
4646
"nyc": "^15.1.0",
47-
"prettier": "2.3.1",
48-
"typescript": "^4.3.4"
47+
"prettier": "2.3.2",
48+
"typescript": "^4.4.2"
4949
},
5050
"files": [
5151
"bin",

src/lib/application.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
ignorePackage,
3636
loadPackageManifest,
3737
} from "./utils/package-manifest";
38+
import { ok } from "assert";
3839

3940
// eslint-disable-next-line @typescript-eslint/no-var-requires
4041
const packageInfo = require("../../package.json") as {
@@ -264,6 +265,7 @@ export class Application extends ChildableComponent<
264265
try {
265266
this.options.setValue(key as keyof TypeDocOptions, val);
266267
} catch (error) {
268+
ok(error instanceof Error);
267269
this.logger.error(error.message);
268270
}
269271
}

src/lib/utils/options/readers/arguments.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ok } from "assert";
12
import { OptionsReader, Options } from "..";
23
import { Logger } from "../../loggers";
34
import { ParameterType } from "../declaration";
@@ -35,6 +36,7 @@ export class ArgumentsReader implements OptionsReader {
3536
try {
3637
options.setValue(name, value);
3738
} catch (err) {
39+
ok(err instanceof Error);
3840
logger.error(err.message);
3941
}
4042
};

src/lib/utils/options/readers/tsconfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as ts from "typescript";
66
import { OptionsReader, Options } from "../options";
77
import { Logger } from "../../loggers";
88
import { normalizePath } from "../../fs";
9+
import { ok } from "assert";
910

1011
function isFile(file: string) {
1112
return existsSync(file) && statSync(file).isFile();
@@ -93,6 +94,7 @@ export class TSConfigReader implements OptionsReader {
9394
join(fileToRead, "..")
9495
);
9596
} catch (error) {
97+
ok(error instanceof Error);
9698
logger.error(error.message);
9799
}
98100
}

src/lib/utils/options/readers/typedoc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as FS from "fs";
44
import { OptionsReader } from "..";
55
import { Logger } from "../../loggers";
66
import { Options } from "../options";
7+
import { ok } from "assert";
78

89
/**
910
* Obtains option values from typedoc.json
@@ -93,6 +94,7 @@ export class TypeDocReader implements OptionsReader {
9394
resolve(dirname(file))
9495
);
9596
} catch (error) {
97+
ok(error instanceof Error);
9698
logger.error(error.message);
9799
}
98100
}

src/lib/utils/package-manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export function getTsEntryPointForPackage(
232232
if (/\.tsx?$/.test(entryPointPath) && existsSync(entryPointPath)) {
233233
return entryPointPath;
234234
}
235-
} catch (e) {
235+
} catch (e: any) {
236236
if (e.code !== "MODULE_NOT_FOUND") {
237237
throw e;
238238
} else {

src/lib/utils/plugins.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export function loadPlugins(app: Application, plugins: readonly string[]) {
3535
}
3636
} catch (error) {
3737
app.logger.error(`The plugin ${plugin} could not be loaded.`);
38-
app.logger.error(error.stack);
38+
if (error instanceof Error && error.stack) {
39+
app.logger.error(error.stack);
40+
}
3941
}
4042
}
4143
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export interface SymbolIndex {
2+
[sym: symbol]: unknown;
3+
}
4+
5+
export interface PartialIndex {
6+
[optName: `data-${string}`]: unknown;
7+
}
8+
9+
export interface UnionIndex {
10+
[optName: string | symbol]: unknown;
11+
}

0 commit comments

Comments
 (0)