Skip to content

Commit

Permalink
Use getCheckFlags, closes #2203
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Mar 19, 2023
1 parent ebf1b7b commit 015de24
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions scripts/compare_screenshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ test -d ./tmp/output && rm -rf ./tmp/output
mkdir -p ./tmp/{output,screenshots,baseline}

docker run \
--rm \
--name typedoc-reg-suit \
-v "$PWD/tmp/screenshots:/new" \
-v "$PWD/tmp/baseline:/old" \
Expand Down
7 changes: 2 additions & 5 deletions src/lib/converter/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1021,11 +1021,8 @@ function setModifiers(
);
reflection.setFlag(
ReflectionFlag.Readonly,
hasAllFlags(
// TS 4.9: symbol.checkFlags, links was introduced in 5.0
symbol.checkFlags ?? symbol.links?.checkFlags ?? 0,
ts.CheckFlags.Readonly
) || hasAllFlags(modifiers, ts.ModifierFlags.Readonly)
hasAllFlags(ts.getCheckFlags(symbol), ts.CheckFlags.Readonly) ||
hasAllFlags(modifiers, ts.ModifierFlags.Readonly)
);
reflection.setFlag(
ReflectionFlag.Abstract,
Expand Down
12 changes: 2 additions & 10 deletions src/lib/types/ts-internal/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ declare module "typescript" {
}

interface Symbol {
// TS before 5.0
// https://github.com/microsoft/TypeScript/blob/v4.1.5/src/compiler/types.ts#L4734-L4737
checkFlags?: CheckFlags;

// TS 5.0
// https://github.com/microsoft/TypeScript/blob/5.0.2/src/compiler/types.ts#L5891-L5898
links?: {
checkFlags: CheckFlags;
};

// https://github.com/microsoft/TypeScript/blob/v4.7.4/src/compiler/types.ts#L4941
// https://github.com/microsoft/TypeScript/issues/38344
parent?: ts.Symbol;
Expand All @@ -36,6 +26,8 @@ declare module "typescript" {
getTypeOfSymbol(symbol: Symbol): Type;
}

export function getCheckFlags(symbol: ts.Symbol): CheckFlags;

export interface Signature {
thisParameter?: ts.Symbol;
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/renderer/testProject/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"experimentalDecorators": true,
"resolveJsonModule": true,
"rootDir": ".",
"esModuleInterop": true
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["."]
}

0 comments on commit 015de24

Please sign in to comment.