Skip to content

Commit 690543b

Browse files
committed
Restore support for TS 4.0 through 4.5
Resolves #1945
1 parent a4945d3 commit 690543b

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
.idea
3+
.vs
34
.tscache
45
.baseDir.js
56
.baseDir.ts
@@ -22,4 +23,4 @@ src/test/renderer/specs/specs.json
2223
# Built theme JS
2324
static/main.js
2425

25-
/example/docs/
26+
/example/docs/

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
### Bug Fixes
4+
5+
- Restore support for TS 4.0 through 4.5, #1945.
6+
37
## v0.22.16 (2022-05-30)
48

59
### Features

src/lib/converter/symbols.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,13 @@ function convertProperty(
666666
}
667667
reflection.defaultValue = declaration && convertDefaultValue(declaration);
668668

669+
// FIXME: Once we drop support for TS 4.5, we can use context.checker.getTypeOfSymbol(symbol) here.
669670
reflection.type = context.converter.convertType(
670671
context,
671672
(context.isConvertingTypeNode() ? parameterType : void 0) ??
672-
context.checker.getTypeOfSymbol(symbol)
673+
context.checker.getTypeOfSymbolAtLocation(symbol, {
674+
kind: ts.SyntaxKind.SourceFile,
675+
} as any)
673676
);
674677

675678
if (reflection.flags.isOptional) {

src/lib/types/ts-internal/index.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ declare module "typescript" {
2121
signature: ts.Signature
2222
): ts.TypePredicate | undefined;
2323

24-
//https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/types.ts#L4188
25-
getTypeOfSymbol(symbol: Symbol): Type;
24+
// Since TS 4.6, not available earlier.
25+
// https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/types.ts#L4188
26+
// getTypeOfSymbol(symbol: Symbol): Type;
2627
}
2728

2829
export interface Signature {

0 commit comments

Comments
 (0)