Skip to content

Typedoc 0.27 #174

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

Merged
merged 4 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.12"]
typedoc-version: ["0.25", "0.26"]
typedoc-version: ["0.25", "0.26", "0.27"]

name: Python ${{ matrix.python-version}} + typedoc ${{ matrix.typedoc-version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def tests(session: Session) -> None:


@nox.session(python=["3.12"])
@nox.parametrize("typedoc", ["0.25", "0.26"])
@nox.parametrize("typedoc", ["0.25", "0.26", "0.27"])
def test_typedoc(session: Session, typedoc: str) -> None:
# Install python dependencies
session.install("-r", "requirements_dev.txt")
Expand Down
18 changes: 10 additions & 8 deletions sphinx_js/js/convertType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ class TypeConverter implements TypeVisitor<Type> {
// up so in this case we index on file name and reference name.

// Another place where we incorrectly handle merged declarations
const src = refl.sources![0];
const src = type.reflection?.sources?.[0];
if (!src) {
return undefined;
}
const newTarget = this.symbolToType.get(
`${src.fullFileName}:${refl.name}`,
);
Expand Down Expand Up @@ -299,18 +302,17 @@ class TypeConverter implements TypeVisitor<Type> {
}

reference(type: ReferenceType): Type {
// if we got a reflection use that. It's not all that clear how to deal
// with type arguments here though...
const res = this.convertPrivateReferenceToReflection(type);
if (res) {
return res;
}
if (type.isIntentionallyBroken()) {
// If it's intentionally broken, don't add an xref. It's probably a type
// parameter.
return this.addTypeArguments(type, [type.name]);
} else {
// if we got a reflection use that. It's not all that clear how to deal
// with type arguments here though...
const res = this.convertPrivateReferenceToReflection(type);
// else use convertReferenceToXRef
if (res) {
return res;
}
return this.convertReferenceToXRef(type);
}
}
Expand Down
12 changes: 11 additions & 1 deletion tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ suite("types.ts", async () => {
function getObject(name: string): TopLevelIR {
const obj = map.get(name);
assert(obj);
return obj!;
return obj;
}
suite("basic", async () => {
for (const [obj_name, type_name] of [
Expand Down Expand Up @@ -100,4 +100,14 @@ suite("types.ts", async () => {
},
]);
});
await test("private_type_alias_1", () => {
const obj = getObject("typeIsPrivateTypeAlias1");
assert.strictEqual(obj.kind, "attribute");
assert.deepStrictEqual(joinType(obj.type), "{ a: number; b: string; }");
});
await test("private_type_alias_2", () => {
const obj = getObject("typeIsPrivateTypeAlias2");
assert.strictEqual(obj.kind, "attribute");
assert.deepStrictEqual(joinType(obj.type), "{ a: number; b: string; }");
});
});
Loading