Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bumped minimum TypeScript version to 4.3 #207

Merged
merged 5 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/actions/protect-main/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ runs:
{ context: "packages" },
{ context: "prettier" },
{ context: "spelling" },
{ context: "test (16.13.0, 4.2.4)" },
{ context: "test (16.13.0, 4.3.5)" },
{ context: "test (16.13.0, 4.4.4)" },
{ context: "test (16.13.0, 4.6.4)" },
{ context: "test (16.13.0, 4.9.5)" },
{ context: "test (16.13.0, latest)" },
{ context: "test (18.x, 4.2.4)" },
{ context: "test (18.x, 4.3.5)" },
{ context: "test (18.x, 4.4.4)" },
{ context: "test (18.x, 4.6.4)" },
{ context: "test (18.x, 4.9.5)" },
{ context: "test (18.x, latest)" },
{ context: "type-check" },
],
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
fail-fast: false
matrix:
node_version:
- "16.13.0"
- "18.x"
- "16.13.0"
ts_version:
- "latest"
- "4.4.4"
- "4.9.5"
- "4.6.4"
- "4.3.5"
- "4.2.4"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
Expand Down
4 changes: 1 addition & 3 deletions src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ export function forEachToken(
callback: ForEachTokenCallback,
sourceFile: ts.SourceFile = node.getSourceFile()
): void {
const isTS4dot3 = isTsVersionAtLeast(4, 3);

const queue = [];
while (true) {
if (isTS4dot3 && ts.isTokenKind(node.kind)) {
if (ts.isTokenKind(node.kind)) {
callback(node);
} else if (
// eslint-disable-next-line deprecation/deprecation -- need for support of TS < 4.7
Expand Down
24 changes: 11 additions & 13 deletions src/types/getters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,23 @@ describe("getWellKnownSymbolPropertyOfType", () => {
});
});

if (isTsVersionAtLeast(4, 3)) {
// https://github.com/JoshuaKGoldberg/ts-api-tools/issues/15
it("finds the symbol for an `asyncIterator` property when that property isn't directly on the type", () => {
const { sourceFile, typeChecker } = createSourceFileAndTypeChecker(`
// https://github.com/JoshuaKGoldberg/ts-api-tools/issues/15
it("finds the symbol for an `asyncIterator` property when that property isn't directly on the type", () => {
const { sourceFile, typeChecker } = createSourceFileAndTypeChecker(`
declare const x: Omit<{
[Symbol.asyncIterator](): AsyncIterator<any>;
}, 'z'>
`);

const node = (sourceFile.statements[0] as ts.VariableStatement)
.declarationList.declarations[0].name;
const node = (sourceFile.statements[0] as ts.VariableStatement)
.declarationList.declarations[0].name;

const type = typeChecker.getTypeAtLocation(node);
const type = typeChecker.getTypeAtLocation(node);

expect(
getWellKnownSymbolPropertyOfType(type, "asyncIterator", typeChecker)
).toMatchObject({
name: /^__@asyncIterator/,
});
expect(
getWellKnownSymbolPropertyOfType(type, "asyncIterator", typeChecker)
).toMatchObject({
name: /^__@asyncIterator/,
});
}
});
});