Skip to content

Commit e718b09

Browse files
committed
Support TypeScript 5.4
Resolves #2517 Closes #2519
1 parent c3ae6ec commit e718b09

File tree

8 files changed

+635
-571
lines changed

8 files changed

+635
-571
lines changed

Diff for: example/package-lock.json

+232-232
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package-lock.json

+368-325
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@
3030
"shiki": "^0.14.7"
3131
},
3232
"peerDependencies": {
33-
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x"
33+
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x"
3434
},
3535
"devDependencies": {
36-
"@types/lunr": "^2.3.5",
36+
"@types/lunr": "^2.3.7",
3737
"@types/marked": "^4.0.8",
38-
"@types/mocha": "^10.0.2",
38+
"@types/mocha": "^10.0.6",
3939
"@types/node": "16",
40-
"@typescript-eslint/eslint-plugin": "^6.16.0",
41-
"@typescript-eslint/parser": "^6.16.0",
40+
"@typescript-eslint/eslint-plugin": "^7.1.1",
41+
"@typescript-eslint/parser": "^7.1.1",
4242
"@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#8abd1494280116ff5318dde2c50ad01e1663790c",
43-
"c8": "^8.0.1",
44-
"esbuild": "^0.19.11",
45-
"eslint": "^8.56.0",
46-
"mocha": "^10.2.0",
43+
"c8": "^9.1.0",
44+
"esbuild": "^0.20.1",
45+
"eslint": "^8.57.0",
46+
"mocha": "^10.3.0",
4747
"prettier": "3.0.3",
4848
"puppeteer": "^13.5.2",
4949
"ts-node": "^10.9.2",
50-
"typescript": "5.3.3"
50+
"typescript": "5.4.2"
5151
},
5252
"files": [
5353
"/bin",

Diff for: src/lib/converter/types.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,10 @@ const queryConverter: TypeConverter<ts.TypeQueryNode> = {
676676
return new QueryType(ref);
677677
},
678678
convertType(context, type, node) {
679+
// Order matters here - check the node location first so that if the typeof is targeting
680+
// an instantiation expression we get the user's exprName.
679681
const symbol =
680-
type.getSymbol() || context.getSymbolAtLocation(node.exprName);
682+
context.getSymbolAtLocation(node.exprName) || type.getSymbol();
681683
assert(
682684
symbol,
683685
`Query type failed to get a symbol for: ${context.checker.typeToString(

Diff for: src/lib/utils/options/declaration.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ export type KeyToDeclaration<K extends keyof TypeDocOptionMap> =
261261
? MixedDeclarationOption | ObjectDeclarationOption
262262
: TypeDocOptionMap[K] extends ManuallyValidatedOption<unknown>
263263
?
264-
| (MixedDeclarationOption & { validate(value: unknown): void })
265-
| (ObjectDeclarationOption & { validate(value: unknown): void })
264+
| (MixedDeclarationOption & {
265+
validate(value: unknown): void;
266+
})
267+
| (ObjectDeclarationOption & {
268+
validate(value: unknown): void;
269+
})
266270
: TypeDocOptionMap[K] extends Record<string, boolean>
267271
? FlagsDeclarationOption<TypeDocOptionMap[K]>
268272
: TypeDocOptionMap[K] extends Record<string | number, infer U>

Diff for: src/test/behavior.c2.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1171,4 +1171,12 @@ describe("Behavior Tests", () => {
11711171

11721172
logger.expectNoMessage("debug: Refusing to recurse*");
11731173
});
1174+
1175+
it("Handles NoInfer intrinsic type", () => {
1176+
const project = convert("noInfer");
1177+
const sig = querySig(project, "createStreetLight");
1178+
equal(sig.parameters?.length, 2);
1179+
equal(sig.parameters[0].type?.toString(), "C[]");
1180+
equal(sig.parameters[1].type?.toString(), "NoInfer");
1181+
});
11741182
});

Diff for: src/test/capture-screenshots.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PQueue {
3737
const nextPromise = Promise.resolve().then(next);
3838
queue.push(nextPromise);
3939
nextPromise.then(() => {
40-
queue.splice(queue.indexOf(nextPromise), 1);
40+
void queue.splice(queue.indexOf(nextPromise), 1);
4141
tick();
4242
}, doReject);
4343
} else {

Diff for: src/test/converter2/behavior/noInfer.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function createStreetLight<C extends string>(
2+
colors: C[],
3+
defaultColor?: NoInfer<C>,
4+
) {}
5+
6+
// @ts-expect-error
7+
createStreetLight(["red", "yellow", "green"], "blue");

0 commit comments

Comments
 (0)