Skip to content

Commit

Permalink
temp: package
Browse files Browse the repository at this point in the history
  • Loading branch information
ZEROM22 committed Dec 26, 2024
1 parent 0576ef7 commit 6420578
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/typedoc-signature/lib/concise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function functionsDeclaration(ctx: Context, f: J.Reflection): Signature {
let t: Token

if (f.type) {
const rp = returnsParameters(f.type)
const rp = genericParameters(f.type)
if (rp.length !== 0) {
t = new TextToken()
t.text = "<"
Expand Down Expand Up @@ -163,7 +163,7 @@ export function methodDeclaration(ctx: Context, m: J.Reflection): Signature {
let t: Token

if (m.type) {
const rp = returnsParameters(m.type)
const rp = genericParameters(m.type)
if (rp.length !== 0) {
t = new TextToken()
t.text = "<"
Expand Down Expand Up @@ -649,7 +649,7 @@ function reference(ctx: Context, t: number, n: string): Token | Reference {
return r
}

function returnsParameters(st: J.SomeType): Signature {
function genericParameters(st: J.SomeType): Signature {
const s: Signature = []
let t: Token

Expand All @@ -661,7 +661,7 @@ function returnsParameters(st: J.SomeType): Signature {
if (isUnionType(st) && st.types) {
for (const tp of st.types) {
if (isReferenceType(st) || isUnionType(st)) {
const p = returnsParameters(tp)
const p = genericParameters(tp)
if (p.length !== 0) {
s.push(...p)

Expand Down
12 changes: 9 additions & 3 deletions packages/typedoc-signature/lib/verbose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ export function variableDeclaration(ctx: Context, r: J.Reflection): Signature {
s.push(t)

t = new TextToken()
t.text = " = "
t.text = ": "
s.push(t)

if (r.type) {
Expand Down Expand Up @@ -637,6 +637,12 @@ export function value(ctx: Context, r: J.Reflection): Signature {
return s
}

if (r.flags.isRest) {
t = new TextToken()
t.text += "..."
s.push(t)
}

t = new ParameterToken()
t.text = r.name
s.push(t)
Expand Down Expand Up @@ -822,7 +828,7 @@ export function referenceType(ctx: Context, r: J.ReferenceType): Signature {
const s: Signature = []
let t: Token

let id
let id: number | undefined
if (typeof r.target === "number") {
id = ctx.t.idOf(r.target)
if (!id) {
Expand All @@ -832,7 +838,7 @@ export function referenceType(ctx: Context, r: J.ReferenceType): Signature {
console.error(`ReflectionSymbolId not supported for ${r.name}`)
}

if (id) {
if (id !== undefined) {
const rt = new Reference()
rt.id = String(id)
rt.token = new TypeToken()
Expand Down

0 comments on commit 6420578

Please sign in to comment.