Skip to content

Commit

Permalink
Fix misleading type annotation on getUrls
Browse files Browse the repository at this point in the history
Resolves TypeStrong#2318.
  • Loading branch information
Gerrit0 committed Jul 29, 2023
1 parent 6e2f5d4 commit 263ee3a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

- Fixed duplicate definitions in type hierarchy when using packages mode, #2327.
- `@inheritDoc` was not properly resolved across packages in packages mode, #2331.
- Fixed misleading type annotation on `Theme.getUrls`, #2318.

### Thanks!

Expand Down
8 changes: 6 additions & 2 deletions src/lib/output/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import * as Path from "path";
import { Event } from "../utils/events";
import type { ProjectReflection } from "../models/reflections/project";
import type { RenderTemplate, UrlMapping } from "./models/UrlMapping";
import type { DeclarationReflection, ReflectionKind } from "../models";
import type {
DeclarationReflection,
Reflection,
ReflectionKind,
} from "../models";

/**
* An event emitted by the {@link Renderer} class at the very beginning and
Expand All @@ -28,7 +32,7 @@ export class RendererEvent extends Event {
*
* This list can be altered during the {@link Renderer.EVENT_BEGIN} event.
*/
urls?: UrlMapping[];
urls?: UrlMapping<Reflection>[];

/**
* Triggered before the renderer starts rendering a project.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/output/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { Application } from "../application";
import type { Theme } from "./theme";
import { RendererEvent, PageEvent, IndexEvent } from "./events";
import type { ProjectReflection } from "../models/reflections/project";
import type { RenderTemplate, UrlMapping } from "./models/UrlMapping";
import type { RenderTemplate } from "./models/UrlMapping";
import { writeFileSync } from "../utils/fs";
import { DefaultTheme } from "./themes/default/DefaultTheme";
import { RendererComponent } from "./components";
Expand Down Expand Up @@ -265,7 +265,7 @@ export class Renderer extends ChildableComponent<
this.application.logger.verbose(
`There are ${output.urls.length} pages to write.`,
);
output.urls.forEach((mapping: UrlMapping) => {
output.urls.forEach((mapping) => {
clearSeenIconCache();
this.renderDocument(...output.createPageEvent(mapping));
validateStateIsClean(mapping.url);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/output/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export abstract class Theme extends RendererComponent {
* @returns A list of {@link UrlMapping} instances defining which models
* should be rendered to which files.
*/
abstract getUrls(project: ProjectReflection): UrlMapping[];
abstract getUrls(project: ProjectReflection): UrlMapping<Reflection>[];

/**
* Renders the provided page to a string, which will be written to disk by the {@link Renderer}
Expand Down

0 comments on commit 263ee3a

Please sign in to comment.